Closed secretshardul closed 3 years ago
Sometimes connection.onAccountChange() receives an empty buffer, causing an error
connection.onAccountChange()
←→1 of 2 errors on the page Unhandled Rejection (RangeError): Trying to access beyond buffer length ▶ 4 stack frames were collapsed. parseTokenAccountData src/utils/tokens.ts:73 70 | 71 | export function parseTokenAccountData(data: Buffer): TokenAccount { 72 | // @ts-ignore > 73 | let { mint, owner, amount } = ACCOUNT_LAYOUT.decode(data); 74 | // @ts-ignore 75 | return { 76 | mint: new PublicKey(mint),
Try-catch exception handling is added and decodes are not attempted on empty buffers.
Sometimes
connection.onAccountChange()
receives an empty buffer, causing an errorTry-catch exception handling is added and decodes are not attempted on empty buffers.