JSPM

sc-decoder-zoidpay

3.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q53416F
  • License MIT

Smart Contracts Decoder

Package Exports

  • sc-decoder-zoidpay
  • sc-decoder-zoidpay/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sc-decoder-zoidpay) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

sc-decoder

npm (scoped)

Example

const { decode } = require('sc-decoder-zoidpay')

const scAddress = "erd1qqqqqqqqqqqqqpgqd06v3r6r94hgyarcar27hkexamh50u283tpqlyspkr";
const funcName = "getStaking";
const struct = {
    "pool_id": "Address",
    "staked_amount": "BigUint",
    "timestamp": "u64",
    "months": "u16",
    "is_pool": "bool",
    "address": "Address"
};
const type = "VecMapper<struct>";
const args = ["df1262d8e96f1f24ffff170e6eb5be6b0fd9fa7fb1dc53dc71b2822c42fc7ed4"];
const result = await decode(scAddress, funcName, struct, type, args);

Use cases:


NOTE Please adapt to the example above!

Single value || SingleValueMapper:

{
  "scAddress": "erd1qqqqqqqqqqqqqpgqd06v3r6r94hgyarcar27hkexamh50u283tpqlyspkr",
  "funcName": "getPoolLimit",
  "struct": {},
  "type": "u32",
  "args": []
}

If single value === struct:

{
  "scAddress": "erd1qqqqqqqqqqqqqpgqd06v3r6r94hgyarcar27hkexamh50u283tpqlyspkr",
  "funcName": "getPool",
  "struct": {
    "id": "Address",
    "owner": "Address",
    "total_staked": "BigUint",
    "zoidsters": "u32",
    "name": "String",
    "status": "u8"
  },
  "type": "struct",
  "args": [
    "df1262d8e96f1f24ffff170e6eb5be6b0fd9fa7fb1dc53dc71b2822c42fc7ed4"
  ]
}

VecMapper

{
  "scAddress": "erd1qqqqqqqqqqqqqpgqd06v3r6r94hgyarcar27hkexamh50u283tpqlyspkr",
    "funcName": "getStaking",
    "struct": {
        "pool_id": "Address",
        "staked_amount": "BidUint",
        "timestamp": "u64",
        "months": "u16",
        "is_pool": "bool",
        "address": "Address"
    },
    "type": "VecMapper<struct>",
    "args": [
        "df1262d8e96f1f24ffff170e6eb5be6b0fd9fa7fb1dc53dc71b2822c42fc7ed4"
    ]
}

MapMapper

{
  "scAddress": "erd1qqqqqqqqqqqqqpgqd06v3r6r94hgyarcar27hkexamh50u283tpqlyspkr",
  "funcName": "getPools",
  "struct": {
    "id": "Address",
    "owner": "Address",
    "total_staked": "BigUint",
    "zoidsters": "u32",
    "name": "String",
    "status": "u8"
  },
  "type": "MapMapper<Address, struct>",
  "args": []
}

License MIT