escrow-market-sdk
Version:
SDK for Escrow Market Solana Program
39 lines (38 loc) • 1.67 kB
TypeScript
import { PublicKey, Transaction, TransactionInstruction, Keypair, Connection, Signer } from '@solana/web3.js';
import BN from 'bn.js';
/**
* Tìm PDA cho Config account
*/
export declare const findConfigAddress: (programId: PublicKey) => Promise<[PublicKey, number]>;
/**
* Tìm PDA cho Vault authority
*/
export declare const findVaultAuthorityAddress: (mint: PublicKey, programId: PublicKey) => Promise<[PublicKey, number]>;
/**
* Tìm PDA cho Vault token account
*/
export declare const findVaultTokenAccountAddress: (mint: PublicKey, programId: PublicKey) => Promise<[PublicKey, number]>;
/**
* Tìm PDA cho WithdrawNonce account
*/
export declare const findWithdrawNonceAddress: (user: PublicKey, nonce: BN, programId: PublicKey) => Promise<[PublicKey, number]>;
/**
* Tìm PDA cho Deal account
*/
export declare const findDealAddress: (dealId: string, programId: PublicKey) => Promise<[PublicKey, number]>;
/**
* Tạo Associated Token Account nếu chưa tồn tại
*/
export declare const createAssociatedTokenAccountIfNotExist: (connection: Connection, payer: Keypair, mint: PublicKey, owner: PublicKey) => Promise<PublicKey>;
/**
* Chuyển đổi số lượng thành BN
*/
export declare const toBN: (amount: number | bigint | string) => BN;
/**
* Xây dựng và ký transaction
*/
export declare const buildAndSignTransaction: (connection: Connection, payer: PublicKey, instructions: TransactionInstruction[], signers?: Signer[]) => Promise<Transaction>;
/**
* Ước tính phí giao dịch
*/
export declare const estimateFee: (connection: Connection, instructions: TransactionInstruction[], payer: PublicKey) => Promise<number | null>;