fix: update token API handling

This commit is contained in:
Justin Starry
2020-08-06 12:17:29 +08:00
committed by Justin Starry
parent 7430896c79
commit 2261c066f3
4 changed files with 48 additions and 113 deletions

25
web3.js/module.d.ts vendored
View File

@ -158,21 +158,10 @@ declare module '@solana/web3.js' {
root: number;
};
export type TokenAccountInfo = {
mint: PublicKey;
owner: PublicKey;
amount: number;
delegate: null | PublicKey;
delegatedAmount: number;
isInitialized: boolean;
isNative: boolean;
};
export type TokenAccount = {
executable: boolean;
owner: PublicKey;
lamports: number;
data: TokenAccountInfo;
export type TokenAmount = {
uiAmount: number;
decimals: number;
amount: string;
};
export type AccountChangeCallback = (
@ -267,17 +256,17 @@ declare module '@solana/web3.js' {
getTokenSupply(
tokenMintAddress: PublicKey,
commitment?: Commitment,
): Promise<RpcResponseAndContext<number>>;
): Promise<RpcResponseAndContext<TokenAmount>>;
getTokenAccountBalance(
tokenAddress: PublicKey,
commitment?: Commitment,
): Promise<RpcResponseAndContext<number>>;
): Promise<RpcResponseAndContext<TokenAmount>>;
getTokenAccountsByOwner(
ownerAddress: PublicKey,
filter: TokenAccountsFilter,
commitment?: Commitment,
): Promise<
RpcResponseAndContext<Array<{pubkey: PublicKey; account: TokenAccount}>>
RpcResponseAndContext<Array<{pubkey: PublicKey; account: AccountInfo}>>
>;
getLargestAccounts(
config?: GetLargestAccountsConfig,