import { AccountInfo , PublicKey } from '@solana/web3.js' ; import { Schema } from 'borsh' ; import { deserializeBorsh } from '../tools/borsh' ; import { ProgramAccount } from '../tools/sdk/runtime' ; export function BorshAccountParser ( classFactory , getSchema ) { return ( pubKey , info ) => { const buffer = Buffer . from ( info . data ) ; const data = deserializeBorsh ( getSchema ( info . data [ 0 ] ) , classFactory , buffer ) ; return { pubkey : pubKey , owner : info . owner , account : data , } as ProgramAccount < any > ; } ; }