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

View File

@ -174,21 +174,10 @@ declare module '@solana/web3.js' {
root: number,
};
declare export type TokenAccountInfo = {
mint: PublicKey,
owner: PublicKey,
amount: number,
delegate: null | PublicKey,
delegatedAmount: number,
isInitialized: boolean,
isNative: boolean,
};
declare export type TokenAccount = {
executable: boolean,
owner: PublicKey,
lamports: number,
data: TokenAccountInfo,
declare export type TokenAmount = {
uiAmount: number,
decimals: number,
amount: string,
};
declare type AccountChangeCallback = (
@ -283,17 +272,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,