AccountInfo::data should already be a Buffer

This commit is contained in:
Jordan Sexton 2021-12-15 19:29:58 -06:00
parent e02d632b36
commit d7d3f08a5e
3 changed files with 3 additions and 4 deletions

View File

@ -94,7 +94,7 @@ export async function getAccountInfo(
if (!info.owner.equals(programId)) throw new TokenInvalidAccountOwnerError();
if (info.data.length != ACCOUNT_SIZE) throw new TokenInvalidAccountSizeError();
const rawAccount = AccountLayout.decode(Buffer.from(info.data));
const rawAccount = AccountLayout.decode(info.data);
return {
address,

View File

@ -74,7 +74,7 @@ export async function getMintInfo(
if (!info.owner.equals(programId)) throw new TokenInvalidAccountOwnerError();
if (info.data.length != MINT_SIZE) throw new TokenInvalidAccountSizeError();
const rawMint = MintLayout.decode(Buffer.from(info.data));
const rawMint = MintLayout.decode(info.data);
return {
address,

View File

@ -1,7 +1,6 @@
import { struct, u8 } from '@solana/buffer-layout';
import { bool, publicKey } from '@solana/buffer-layout-utils';
import { Commitment, Connection, PublicKey } from '@solana/web3.js';
import { Buffer } from 'buffer';
import { TOKEN_PROGRAM_ID } from '../constants';
import { TokenAccountNotFoundError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError } from '../errors';
@ -74,7 +73,7 @@ export async function getMultisigInfo(
if (!info.owner.equals(programId)) throw new TokenInvalidAccountOwnerError();
if (info.data.length != MULTISIG_SIZE) throw new TokenInvalidAccountSizeError();
return { address, ...MultisigLayout.decode(Buffer.from(info.data)) };
return { address, ...MultisigLayout.decode(info.data) };
}
/** Get the minimum lamport balance for a multisig to be rent exempt