@drift-labs/common
Version:
Common functions for Drift
17 lines (16 loc) • 1.14 kB
TypeScript
import { Connection, PublicKey, TransactionInstruction } from '@solana/web3.js';
export { TOKEN_PROGRAM_ID, createTransferCheckedInstruction, } from '@solana/spl-token';
export declare const getTokenAddress: (mintAddress: string, userPubKey: string) => Promise<PublicKey>;
/**
* Get the associated token address for the given mint and user public key. If the mint is SOL, return the user public key.
* This should be used for spot token movement in and out of the user's wallet.
* @param mintAddress - The mint address
* @param authorityPubKey - The authority's public key
* @returns The associated token address
*/
export declare const getTokenAddressForDepositAndWithdraw: (mintAddress: PublicKey, authorityPubKey: PublicKey) => Promise<PublicKey>;
export declare const getTokenAccount: (connection: Connection, mintAddress: string, userPubKey: string) => Promise<{
pubkey: PublicKey;
account: import('@solana/web3.js').AccountInfo<import('@solana/web3.js').ParsedAccountData>;
}>;
export declare const createTokenAccountIx: (owner: PublicKey, mintAddress: PublicKey, payer?: PublicKey) => Promise<TransactionInstruction>;