AccountInfo::data should already be a Buffer
This commit is contained in:
parent
e02d632b36
commit
d7d3f08a5e
|
@ -94,7 +94,7 @@ export async function getAccountInfo(
|
||||||
if (!info.owner.equals(programId)) throw new TokenInvalidAccountOwnerError();
|
if (!info.owner.equals(programId)) throw new TokenInvalidAccountOwnerError();
|
||||||
if (info.data.length != ACCOUNT_SIZE) throw new TokenInvalidAccountSizeError();
|
if (info.data.length != ACCOUNT_SIZE) throw new TokenInvalidAccountSizeError();
|
||||||
|
|
||||||
const rawAccount = AccountLayout.decode(Buffer.from(info.data));
|
const rawAccount = AccountLayout.decode(info.data);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
address,
|
address,
|
||||||
|
|
|
@ -74,7 +74,7 @@ export async function getMintInfo(
|
||||||
if (!info.owner.equals(programId)) throw new TokenInvalidAccountOwnerError();
|
if (!info.owner.equals(programId)) throw new TokenInvalidAccountOwnerError();
|
||||||
if (info.data.length != MINT_SIZE) throw new TokenInvalidAccountSizeError();
|
if (info.data.length != MINT_SIZE) throw new TokenInvalidAccountSizeError();
|
||||||
|
|
||||||
const rawMint = MintLayout.decode(Buffer.from(info.data));
|
const rawMint = MintLayout.decode(info.data);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
address,
|
address,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { struct, u8 } from '@solana/buffer-layout';
|
import { struct, u8 } from '@solana/buffer-layout';
|
||||||
import { bool, publicKey } from '@solana/buffer-layout-utils';
|
import { bool, publicKey } from '@solana/buffer-layout-utils';
|
||||||
import { Commitment, Connection, PublicKey } from '@solana/web3.js';
|
import { Commitment, Connection, PublicKey } from '@solana/web3.js';
|
||||||
import { Buffer } from 'buffer';
|
|
||||||
import { TOKEN_PROGRAM_ID } from '../constants';
|
import { TOKEN_PROGRAM_ID } from '../constants';
|
||||||
import { TokenAccountNotFoundError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError } from '../errors';
|
import { TokenAccountNotFoundError, TokenInvalidAccountOwnerError, TokenInvalidAccountSizeError } from '../errors';
|
||||||
|
|
||||||
|
@ -74,7 +73,7 @@ export async function getMultisigInfo(
|
||||||
if (!info.owner.equals(programId)) throw new TokenInvalidAccountOwnerError();
|
if (!info.owner.equals(programId)) throw new TokenInvalidAccountOwnerError();
|
||||||
if (info.data.length != MULTISIG_SIZE) throw new TokenInvalidAccountSizeError();
|
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
|
/** Get the minimum lamport balance for a multisig to be rent exempt
|
||||||
|
|
Loading…
Reference in New Issue