@kamino-finance/klend-sdk
Version:
Typescript SDK for interacting with the Kamino Lending (klend) protocol
34 lines • 2.08 kB
TypeScript
import { Connection, PublicKey, TransactionInstruction } from '@solana/web3.js';
import Decimal from 'decimal.js';
import { AnchorProvider } from '@coral-xyz/anchor';
/**
* Create an idempotent create ATA instruction
* Overrides the create ATA ix to use the idempotent version as the spl-token library does not provide this ix yet
* @param owner - owner of the ATA
* @param mint - mint of the ATA
* @param payer - payer of the transaction
* @param tokenProgram - optional token program address - spl-token if not provided
* @param ata - optional ata address - derived if not provided
* @returns The ATA address public key and the transaction instruction
*/
export declare function createAssociatedTokenAccountIdempotentInstruction(owner: PublicKey, mint: PublicKey, payer?: PublicKey, tokenProgram?: PublicKey, ata?: PublicKey): [PublicKey, TransactionInstruction];
export declare function getAssociatedTokenAddress(mint: PublicKey, owner: PublicKey, allowOwnerOffCurve?: boolean, programId?: PublicKey, associatedTokenProgramId?: PublicKey): PublicKey;
export declare const getAtasWithCreateIxnsIfMissing: (connection: Connection, user: PublicKey, mints: Array<{
mint: PublicKey;
tokenProgram: PublicKey;
}>) => Promise<{
atas: PublicKey[];
createAtaIxs: TransactionInstruction[];
}>;
export declare function createAtasIdempotent(user: PublicKey, mints: Array<{
mint: PublicKey;
tokenProgram: PublicKey;
}>): Array<{
ata: PublicKey;
createAtaIx: TransactionInstruction;
}>;
export declare function getDepositWsolIxns(owner: PublicKey, ata: PublicKey, amountLamports: Decimal): TransactionInstruction[];
export declare function removeBudgetAndAtaIxns(ixns: TransactionInstruction[], mints: string[]): TransactionInstruction[];
export declare function getTokenAccountBalance(provider: AnchorProvider, tokenAccount: PublicKey): Promise<number>;
export declare function getTokenAccountBalanceDecimal(connection: Connection, mint: PublicKey, owner: PublicKey, tokenProgram?: PublicKey): Promise<Decimal>;
//# sourceMappingURL=ata.d.ts.map