After subscribing to websocket for "onAccountChange" (this is real time changes, no historical data):
- I am receiving data from accounts that haven't changed in months
- I am receiving strange account data sizes: 355, 0, 1, 16...
Code:
import { PublicKey, Connection } from "@solana/web3.js";import { TOKEN_PROGRAM_ID } from "@solana/spl-token";const RPC_URL:string = [YOUR_RPC_URL];const WSS_URL:string = [YOUR_WEBSOCKET_URL];(async () => { const solanaConnection:Connection = new Connection(RPC_URL, { wsEndpoint: WSS_URL }); solanaConnection.onProgramAccountChange( TOKEN_PROGRAM_ID, (updatedProgramInfo, context) =>console.log(JSON.stringify(updatedProgramInfo)),"confirmed" ); // Stop after 5 seconds setTimeout(()=>{ solanaConnection.removeProgramAccountChangeListener(0); }, 5000);})();
Account size: 355 => ?? (4 months without activity)
{"accountId":"94HxW9Rqoj54P7sGRhRN21ztPv2VQDdVuNrauGFSbykH","accountInfo":{"lamports":3361680,"data":{"type":"Buffer","data":[2,2,1,76,205,76,50,83,231,168,9,12,229,166,79,234,225,121,74,195,173,157,177,100,203,8,219,116,204,225,193,194,114,71,185,118,9,173,106,77,93,114,229,40,114,122,96,2,153,203,234,16,158,12,53,75,199,143,238,175,30,79,27,163,75,172,132,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},"owner":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","executable":false,"rentEpoch":18446744073709552000,"space":355}}
Account size: 165 => PDA account (2 months without activity)
{"accountId":"94A74q1W6AWSKfxsFRxnveg8XzoDT5C9A7G2ugAd3LPW","accountInfo":{"lamports":2039280,"data":{"type":"Buffer","data":[19,91,159,118,10,160,182,249,42,16,146,139,218,86,239,175,155,89,120,75,232,193,182,203,147,6,110,82,155,94,99,159,141,107,84,74,162,84,23,175,30,77,187,14,223,12,127,162,149,201,254,210,22,194,249,167,66,1,49,126,25,89,215,205,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},"owner":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","executable":false,"rentEpoch":18446744073709552000,"space":165}}
Size: 0 => ??
{"accountId":"9Ag4FpZd27btPzgdq1wpJjP8sZLf9RcaqvqbRjHpMmGd","accountInfo":{"lamports":1000000,"data":{"type":"Buffer","data":[]},"owner":"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA","executable":false,"rentEpoch":18446744073709552000,"space":0}}