3.1.5 • Published 1 year ago

sc-decoder-zoidpay v3.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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, isDev);

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

3.1.5

1 year ago

3.1.4

1 year ago

3.1.3

1 year ago

3.1.2

1 year ago

3.1.1

1 year ago

3.1.0

1 year ago