Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TokenInfo interface can't handle integer totalSupply values #921

Open
hal0x2328 opened this issue Nov 13, 2023 · 0 comments
Open

TokenInfo interface can't handle integer totalSupply values #921

hal0x2328 opened this issue Nov 13, 2023 · 0 comments

Comments

@hal0x2328
Copy link
Member

hal0x2328 commented Nov 13, 2023

The legacy neon-js code can't deal with smart contracts that return an Integer response to a totalSupply invocation.
The existing interface code looks like:

const parseTokenInfo = rpc.buildParser(
  rpc.StringParser,
  rpc.StringParser,
  rpc.IntegerParser,
  rpc.Fixed8Parser
);

Most contracts return a Fixed8 ByteArray for the totalSupply (the last field in the structure above) but at least one Flamingo pair (probably all of them) returns an Integer. Example for FLP-nNEO-fUSDT:

{
  "jsonrpc": "2.0",
  "id": 1234,
  "result": {
    "script": "00046e616d65678cada6a808e694ac897ceb271f4bc527a9a33374000673796d626f6c678cada6a808e694ac897ceb271f4bc527a9a333740008646563696d616c73678cada6a808e694ac897ceb271f4bc527a9a33374000b746f74616c537570706c79678cada6a808e694ac897ceb271f4bc527a9a33374",
    "state": "HALT",
    "gas_consumed": "0.651",
    "stack": [
      {
        "type": "ByteArray",
        "value": "45786368616e67652050616972"
      },
      {
        "type": "ByteArray",
        "value": "464c502d6e4e454f2d6655534454"
      },
      {
        "type": "Integer",
        "value": "8"
      },
      {
        "type": "Integer",
        "value": "33119936322"
      }
    ]
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant