feat: add token methods (#11303)
This commit is contained in:
@@ -66,6 +66,14 @@ declare module '@solana/web3.js' {
|
||||
skipPreflight: ?boolean,
|
||||
};
|
||||
|
||||
declare export type TokenAccountsFilter =
|
||||
| {
|
||||
mint: PublicKey,
|
||||
}
|
||||
| {
|
||||
programId: PublicKey,
|
||||
};
|
||||
|
||||
declare export type RpcResponseAndContext<T> = {
|
||||
context: Context,
|
||||
value: T,
|
||||
@@ -166,6 +174,23 @@ 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 type AccountChangeCallback = (
|
||||
accountInfo: AccountInfo,
|
||||
context: Context,
|
||||
@@ -255,6 +280,21 @@ declare module '@solana/web3.js' {
|
||||
getMinimumLedgerSlot(): Promise<number>;
|
||||
getFirstAvailableBlock(): Promise<number>;
|
||||
getSupply(commitment: ?Commitment): Promise<RpcResponseAndContext<Supply>>;
|
||||
getTokenSupply(
|
||||
tokenMintAddress: PublicKey,
|
||||
commitment: ?Commitment,
|
||||
): Promise<RpcResponseAndContext<number>>;
|
||||
getTokenAccountBalance(
|
||||
tokenAddress: PublicKey,
|
||||
commitment: ?Commitment,
|
||||
): Promise<RpcResponseAndContext<number>>;
|
||||
getTokenAccountsByOwner(
|
||||
ownerAddress: PublicKey,
|
||||
filter: TokenAccountsFilter,
|
||||
commitment: ?Commitment,
|
||||
): Promise<
|
||||
RpcResponseAndContext<Array<{pubkey: PublicKey, account: TokenAccount}>>,
|
||||
>;
|
||||
getLargestAccounts(
|
||||
config: ?GetLargestAccountsConfig,
|
||||
): Promise<RpcResponseAndContext<Array<AccountBalancePair>>>;
|
||||
|
Reference in New Issue
Block a user