UNPKG

fsl-js-sdk

Version:
181 lines (180 loc) 7.31 kB
/// <reference types="bn.js" /> /// <reference types="node" /> /// <reference types="node" /> import { Program, web3 } from '@coral-xyz/anchor'; import { GgusdOft } from './target/types/ggusd_oft'; import { Connection, Keypair, PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js'; import { EndpointProgram, SimpleMessageLibProgram, UlnProgram } from '@layerzerolabs/lz-solana-sdk-v2'; import { OptionOrNullable, Umi } from '@metaplex-foundation/umi'; import { EndpointId } from '@layerzerolabs/lz-definitions'; import NodeWallet from '@coral-xyz/anchor/dist/cjs/nodewallet'; export declare let program: Program<GgusdOft>; export declare const OFT_TEST: { programId: string; mint: string; escrow: string; oftStore: string; }; export declare const OFT: { programId: string; mint: string; mintAuthority: string; escrow: string; oftStore: string; }; /** * Initializes the program with the given connection and keypair. */ export declare function initProgram(connection: Connection, keyPair: NodeWallet | Keypair): void; export declare namespace LzArgs { type SetOFTConfigParamsArgs = { __kind: 'Admin'; fields: [PublicKey]; } | { __kind: 'Delegate'; fields: [PublicKey]; } | { __kind: 'DefaultFee'; fields: [number]; } | { __kind: 'Paused'; fields: [boolean]; } | { __kind: 'Pauser'; fields: [OptionOrNullable<PublicKey>]; } | { __kind: 'Unpauser'; fields: [OptionOrNullable<PublicKey>]; } | { __kind: 'FeeReceiver'; fields: [PublicKey]; } | { __kind: 'AddWhitelist'; fields: [PublicKey]; } | { __kind: 'DelWhitelist'; fields: [PublicKey]; }; interface SendArgs { endpoint?: string; srcEid: number; dstEid: number; srcWallet: string; dstWallet: string; amount: number | string; } function createSetOFTConfigParams(arg: SetOFTConfigParamsArgs): any; function storeAdmin(): Promise<PublicKey>; function feeReceiver(): Promise<PublicKey>; } export declare namespace LzKits { function toPublicKey(key: string | PublicKey): PublicKey; function createLayerZeroUmi(connection: Connection): Umi; const deriveConnection: () => Promise<{ connection: web3.Connection; umi: Umi; }>; function getSendLibraryProgram(connection: Connection, endpoint: EndpointProgram.Endpoint, payer: string, oftStore: string, remoteEid: number): Promise<SimpleMessageLibProgram.SimpleMessageLib | UlnProgram.Uln>; const getAddressLookupTable: (connection: Connection, umi: Umi, fromEid: EndpointId) => Promise<import("@metaplex-foundation/umi-public-keys").PublicKey<string>>; function versionedTransaction(fromEid: EndpointId, payer: string | PublicKey, instructions: web3.TransactionInstruction[]): Promise<web3.VersionedTransaction>; } export declare namespace SolanaLz { /** Quote the native fee for sending tokens via OFT. */ function quoteSend(arg: LzArgs.SendArgs): Promise<bigint>; /** * Sends tokens from the source wallet to the destination wallet on the specified endpoint. * @param arg.endpointId - The endpoint ID for the destination chain. * @param arg.srcEid - The source endpoint ID. * @param arg.dstEid - The destination endpoint ID. * @param arg.srcWallet - The source wallet address. * @param arg.dstWallet - The destination wallet address. * @param arg.amount - The amount of tokens to send. * @returns A Promise transaction object for sending tokens. */ function send(arg: LzArgs.SendArgs): Promise<VersionedTransaction>; /** * Withdraws the fee collected from the OFT transactions. * @param para - Parameters for withdrawing the fee. * @param para.fee - The amount of fee to withdraw, if fee==0, will withdraw all available fees. * @param para.receiver - The receiver's public key or address. * @returns A Promise transaction object for withdrawing the fee. */ function withdrawFee(para: { payer: string | PublicKey; fee?: number | string; receiver?: string | PublicKey; }): Promise<web3.Transaction>; /** * Sends tokens and withdraws the fee in a single transaction. * @param arg - Arguments for sending tokens. * @returns A Promise transaction object that includes both sending tokens and withdrawing the fee. */ function sendAndWithdrawFee(arg: LzArgs.SendArgs): Promise<VersionedTransaction>; /** * Sets the configuration parameters for the OFT store. * @param para - Parameters for setting the configuration. * @param para.__kind - The kind of configuration parameter to set. * @param para.fields - The fields associated with the configuration parameter. * @param para.admin - The admin's public key or address. * @returns A Promise transaction object for setting the configuration. */ function setConfig(para: LzArgs.SetOFTConfigParamsArgs & { admin?: string | PublicKey; }): Promise<web3.Transaction>; /** * Sets the fee basis points and receiver for the OFT store. * @param defaultBps - The default fee basis points. * @param feeReceiver - The fee receiver's public key or address. * @returns A Promise transaction object for setting the fee basis points and receiver. */ function setFeeBpsAndReceiver(defaultBps: number, feeReceiver?: string | PublicKey): Promise<Transaction>; function getStoreConfig(): Promise<{ oftType: ({ native?: undefined; } & { adapter: Record<string, never>; }) | ({ adapter?: undefined; } & { native: Record<string, never>; }); ld2sdRate: import("bn.js"); tokenMint: web3.PublicKey; tokenEscrow: web3.PublicKey; endpointProgram: web3.PublicKey; bump: number; tvlLd: import("bn.js"); admin: web3.PublicKey; defaultFeeBps: number; paused: boolean; pauser: web3.PublicKey | null; unpauser: web3.PublicKey | null; feeReceiver: web3.PublicKey; whitelistFreeFee: web3.PublicKey[]; }>; /** Sets the fee basis points for a specific endpoint ID. * @param dstEid - The destination endpoint ID. * @param feeBps - The fee basis points to set. * @returns A Promise transaction object for setting the fee basis points. */ function setEidFeeBps(dstEid: number, feeBps?: number): Promise<Transaction>; function getPeerConfig(dstEid: number): Promise<{ peerAddress: number[]; enforcedOptions: { send: Buffer; sendAndCall: Buffer; }; outboundRateLimiter: { capacity: import("bn.js"); tokens: import("bn.js"); refillPerSecond: import("bn.js"); lastRefillTime: import("bn.js"); } | null; inboundRateLimiter: { capacity: import("bn.js"); tokens: import("bn.js"); refillPerSecond: import("bn.js"); lastRefillTime: import("bn.js"); } | null; feeBps: number | null; bump: number; }>; }