@debridge-finance/solana-utils
Version:
Common utils package to power communication with Solana contracts at deBridge
75 lines • 2.89 kB
TypeScript
import { Buffer } from "buffer";
import { Commitment, Connection, Keypair, PublicKey, Signer, Transaction, VersionedTransaction } from "@solana/web3.js";
import { interfaces } from ".";
export declare function getAccountInfo(connection: Connection, account: PublicKey, commitment?: Commitment): Promise<import("@solana/web3.js").AccountInfo<Buffer<ArrayBufferLike>> | null>;
export declare function hexToBuffer(data: string, align?: number): Buffer;
export declare function bufferToHex(data: Buffer | number[] | Uint8Array): string;
export declare function sleep(milliSeconds: number): Promise<void>;
type AnyTransaction = Transaction | VersionedTransaction;
export declare class Wallet implements interfaces.IWallet {
private keypair;
publicKey: PublicKey;
constructor(keypair: Keypair);
signTransaction<T extends Transaction | VersionedTransaction>(tx: T, additionalSigners?: Signer[]): Promise<T>;
signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[], additionalSigners?: (Signer[] | undefined)[]): Promise<Awaited<T>[]>;
}
type SendAllOptions = {
/**
* @default false
* If tx was already signed by external party we will just send it
*/
skipSign?: boolean;
/**
* List of signers for each tx
* E.g. you provided [tx1, tx2], tx2 requires additional signature
* signers should be [[], [tx2Signer]]
*/
signers?: Keypair[][];
/**
* Wait for number of milliseconds, if not provided will send all transactions simultaneously
*/
waitBetweenSend?: number;
/**
* @default false
*/
skipPreflight?: boolean;
/**
* @default true
* Convert all transactions from legacy to TransactionV0? Default is `true`
*/
convertIntoTxV0?: boolean;
/**
* @deprecated
* Number of `sendTransaction` rpc calls for each transaction
*/
rpcCalls?: number;
/**
* Set blockhash with provided level for each transaction before sign & send. Default is `finalized`
*/
blockhashCommitment?: Commitment;
/**
* Logger function used to log tx being sent
*/
logger?: Function;
/**
* @experimental
* WARN!: This flag will set different commitment levels for blockhash and simulation
*/
simulationCommtiment?: Commitment;
/**
* @default false
* Set minContextSlot param to sendTransaction request
*/
useMinContextSlot?: boolean;
};
/**
*
* @param connection rpc connection
* @param wallet wallet interface to sign transaction
* @param transactions transaction(s) to send
* @param options additional {@link SendAllOptions|options}
* @returns
*/
export declare function sendAll(connection: Connection, wallet: interfaces.IWallet, transactions: AnyTransaction[] | AnyTransaction, options?: SendAllOptions): Promise<string[]>;
export {};
//# sourceMappingURL=helpers.d.ts.map