@debridge-finance/solana-utils
Version:
Common utils package to power communication with Solana contracts at deBridge
37 lines • 1.24 kB
TypeScript
import { Connection, PublicKey, SimulateTransactionConfig, SimulatedTransactionResponse, Transaction, VersionedTransaction } from "@solana/web3.js";
import { ContractErrors, RpcErrors } from "./interfaces";
type AccountDiff = {
spl: {
before: bigint;
after: bigint;
token: PublicKey;
owner: PublicKey;
} | null;
native: {
before: number;
after: number;
} | null;
};
type DiffMap = Map<string, AccountDiff>;
export declare function simulateTransaction(connection: Connection, tx: VersionedTransaction, simulateConfig: SimulateTransactionConfig): Promise<SimulatedTransactionResponse & {
diff: DiffMap;
}>;
/**
* Serializes transaction and returns serialized size
* @param transaction tx to get length
* @param feePayer optional fee payer
* @returns transaction size
*/
export declare function getTransactionSize(tx: Transaction | VersionedTransaction): number | null;
/**
* Parse logs
* @param logs array of strings
* @param err object or string
* @returns parsed logs
*/
export declare function getErrorData(logs: string[], err?: RpcErrors): {
message: string;
parsedError?: ContractErrors | RpcErrors;
};
export {};
//# sourceMappingURL=transaction.d.ts.map