solana-labs / solana-program-library

A collection of Solana programs maintained by Solana Labs
https://solanalabs.com
Apache License 2.0
3.5k stars 2.04k forks source link

stake-pool JS (getStakePoolAccounts) - RangeError: offset is not uint #2564

Closed 0xMentorNotAPseudo closed 2 years ago

0xMentorNotAPseudo commented 2 years ago

Hi,

When trying to read the stake pool accounts from the index example I have the following exception:

RangeError: offset is not uint
    at checkOffset (index.js:1097)
    at Uint8Array.readUInt8 (index.js:1133)
    at solana-service.ts:101
    at Array.map (<anonymous>)
    at getStakePoolAccounts (solana-service.ts:95)
    at async handleClick (stake-pool.tsx:33)

This happen when trying to readUInt8 the account data on index.ts:

      if (a.account.data.readUInt8() === 1) {

However IT tests are running correctly. Also before calling the getStakePoolAccounts I make sure to add the borsh schema as follow:

schema.addStakePoolSchema(SOLANA_SCHEMA);

0xMentorNotAPseudo commented 2 years ago

@joncinque can you please give it a look?

joncinque commented 2 years ago

The JS schema definitions for the stake pool are unused and out of date unfortunately. I'll be spending time on stake pools js library within the next few weeks, but in the meantime, this will fail. PRs are very appreciated!

joncinque commented 2 years ago

Closing since the bindings were redone in https://github.com/solana-labs/solana-program-library/pull/2604