@firefly-exchange/library-sui
Version:
Sui library housing helper methods, classes to interact with Bluefin protocol(s) deployed on Sui
102 lines (101 loc) • 5.45 kB
TypeScript
import { ZkTransactionParams } from "../interfaces";
import { DryRunTransactionBlockResponse, SignatureWithBytes, SuiClient, SuiTransactionBlockResponse, SuiTransactionBlockResponseOptions, TransactionBlock } from "../types";
export declare class SuiBlocks {
/**
* Signs and executes transaction using zk login
* @param args : ZKTransaction
* @returns SuiTransactionBlockResponse
*/
static signAndExecuteTransactionUsingZkWallet(args: ZkTransactionParams): Promise<SuiTransactionBlockResponse>;
/**
* Signs a transaction using zk login
* @param args : ZKTransaction
* @returns SuiTransactionBlockResponse
*/
static signTransactionUsingZkWallet(args: ZkTransactionParams): Promise<SignatureWithBytes>;
/**
* Builds the transaction block. If the signer is an UI Wallet, then it
* does not support signing of `Uint8Array`, so just return the block.
* @param txBlock Sui Transaction block
* @returns Built tx block Uin8tArray
*/
static buildTxBlock(txBlock: TransactionBlock, suiClient: SuiClient, signerAddress: string, uiWallet?: boolean): Promise<Uint8Array | TransactionBlock>;
/**
* Signs the provided sui transaction block. The `uiWallet` flag controls
* whether signer is an UI Wallet or a backend one; for the UI Wallet,
* we still need to use `signTransactionBlock`, which receives a
* `TransactionBlock` instead of `Uint8Array`.
*
* @param builtBlock the sui transaction block or transaction block bytes
* @param signer
* @param uiWallet whether the wallet is a browser extension one or not
* @returns signature along with tx block bytes
*/
static signTxBlock(builtBlock: Uint8Array | TransactionBlock, signer: any, uiWallet?: boolean): Promise<SignatureWithBytes>;
/**
* Builds and signs a TransactionBlock.
* @param txBlock the sui transaction block
* @param suiClient
* @param signer
* @param uiWallet whether the wallet is a browser extension one or not
* @returns
*/
static buildAndSignTxBlock(txBlock: TransactionBlock, suiClient: SuiClient, signer: any, uiWallet?: boolean): Promise<SignatureWithBytes>;
/**
* signs the provided sui transaction bytes
* @param txBytes the sui transaction block bytes
* @returns signature along with tx block bytes
*/
static signTxBytes(txBytes: string, signer: any): Promise<SignatureWithBytes>;
/**
* Executes the signed sponsored tx block
* @param blockTxBytes transaction block bytes
* @param userSignature the signature of the user/caller
* @param sponsorSignature the signature of the sponsor paying the gas fee of tx
* @param suiClient the sui client
* @param options (optional) by default returns complete tx details
* @returns SuiTransactionBlockResponse
*/
static executeSponsoredTxBlock(blockTxBytes: string, userSignature: string, sponsorSignature: string, suiClient: SuiClient, options?: SuiTransactionBlockResponseOptions): Promise<SuiTransactionBlockResponse>;
/**
* Executes the signed transaction block
* @param signedTxBlock signed transaction block
* @param suiClient the sui client
* @param options (optional) by default returns complete tx details
* @returns SuiTransactionBlockResponse
*/
static executeSignedTxBlock(signedTxBlock: SignatureWithBytes, suiClient: SuiClient, options?: SuiTransactionBlockResponseOptions): Promise<SuiTransactionBlockResponse>;
/**
* Builds gasless payload bytes from given transaction block
* @param txb transaction block
* @param suiClient sui client
* @returns transaction payload bytes string
*/
static buildGaslessTxPayloadBytes(txb: TransactionBlock, suiClient: SuiClient): Promise<string>;
/**
* Signs and executes the given transaction block
* @param txBlock Sui transaction block
* @param suiClient The sui client to be used
* @param signer The signer that will be singing the Tx
* @param isUIWallet (optional) is the signer UI wallet? defaults to `False`
* @param options (optional) the response fields user wants to see in `SuiTransactionBlockResponse`
* @returns Sui Transaction Block Response
*/
static signAndExecuteTxBlock(txBlock: TransactionBlock, suiClient: SuiClient, signer: any, isUIWallet?: boolean, options?: SuiTransactionBlockResponseOptions): Promise<SuiTransactionBlockResponse>;
/**
* Executes dry run for the given tx block
* @param txBlock Sui transaction block
* @param suiClient The sui client to be used
* @param signer The signer that will be singing the Tx
* @param isUIWallet (optional) is the signer UI wallet? defaults to `False`
* @returns Sui Transaction Block Response
*/
static dryRunTxBlock(txBlock: TransactionBlock, suiClient: SuiClient, signer: any, isUIWallet?: boolean): Promise<DryRunTransactionBlockResponse>;
/**
* Dry runs or executes the call on chain depending on the params
* @param dryRun True if dry run is to be performed
* @param txBlock The transaction block
* @returns DryRunTransactionBlockResponse | SuiTransactionBlockResponse
*/
static execCall(txBlock: TransactionBlock, suiClient: SuiClient, signer: any, dryRun: boolean, isUIWallet?: boolean): Promise<DryRunTransactionBlockResponse | SuiTransactionBlockResponse>;
}