import type { SuiCallArg, SuiClient, SuiObjectRef, SuiTransactionBlockResponse, SuiTransactionBlockResponseOptions } from "@mysten/sui/client"; import type { SignatureWithBytes, Signer } from "@mysten/sui/cryptography"; import type { Transaction, TransactionObjectInput, TransactionResult } from "@mysten/sui/transactions"; /** * An item in the array returned by a `Transaction.moveCall()` call. */ export type NestedResult = ReturnType extends (infer Item)[] ? Item : never; /** * Either a `TransactionObjectInput` or a `SuiObjectRef`. */ export type ObjectInput = TransactionObjectInput | SuiObjectRef; /** * Get the value of a `SuiCallArg` (transaction input). * If the argument is a pure value, return it. * If the argument is an object, return its ID. */ export declare function getArgVal(arg: SuiCallArg): T; /** * Transform an `ObjectInput` into an argument for `Transaction.moveCall()`. */ export declare function objectArg(tx: Transaction, obj: ObjectInput): { $kind: "Input"; Input: number; type?: "object"; }; /** * Validate a `SuiTransactionBlockResponse` of the `ProgrammableTransaction` kind * and return its `.transaction.data`. */ export declare function txResToData(resp: SuiTransactionBlockResponse): { sender: string; gasData: import("@mysten/sui/dist/cjs/client/index.js").SuiGasData; inputs: SuiCallArg[]; txs: import("@mysten/sui/dist/cjs/client/index.js").SuiTransaction[]; }; /** * A function that can sign a `Transaction`. * * For apps that use `@mysten/dapp-kit` to sign with a Sui wallet: ``` const { mutateAsync: walletSignTx } = useSignTransaction(); const signTx: SignTx = async (tx) => { return walletSignTx({ transaction: tx }); }; ``` * For code that has direct access to the private key: ``` const secretKey = "suiprivkey1..."; const signer = pairFromSecretKey(secretKey) const signTx: SignTx = async (tx) => { tx.setSenderIfNotSet(signer.toSuiAddress()); const txBytes = await tx.build({ client: suiClient }); return signer.signTransaction(txBytes); }; ``` */ export type SignTx = (tx: Transaction) => Promise; /** * Create a `SignTx` function that uses a `Signer` to sign a `Transaction`. */ export declare function newSignTx(suiClient: SuiClient, signer: Signer): SignTx; /** * Options for `SuiClient.waitForTransaction()`. */ export type WaitForTxOptions = { pollInterval: number; timeout?: number; }; export type SignAndExecuteTx = ReturnType; /** * Create a function that signs and executes a `Transaction`. * TODO: add to README */ export declare function newSignAndExecuteTx({ suiClient, signTx, sender: _sender, txRespOptions: _txRespOptions, waitForTxOptions: _waitForTxOptions, }: { suiClient: SuiClient; signTx: SignTx; sender?: string | undefined; txRespOptions?: SuiTransactionBlockResponseOptions; waitForTxOptions?: WaitForTxOptions | false; }): ({ tx, sender, txRespOptions, waitForTxOptions, dryRun, }: { tx: Transaction; sender?: string; txRespOptions?: SuiTransactionBlockResponseOptions; waitForTxOptions?: WaitForTxOptions | false; dryRun?: boolean; }) => Promise; /** * Build transactions for the `sui::transfer` module. */ export declare const TransferModule: { public_freeze_object(tx: Transaction, obj_type: string, obj: ObjectInput): TransactionResult; public_share_object(tx: Transaction, obj_type: string, obj: ObjectInput): TransactionResult; public_transfer(tx: Transaction, obj_type: string, obj: ObjectInput, recipient: string): TransactionResult; };