Skip to main content
This function is deprecated. Use signAndExecuteTransaction instead.
Signs and executes a Sui transaction block in a single step.

Usage

import { signAndExecuteTransactionBlock, isSuiWalletAccount } from '@dynamic-labs-sdk/sui';
import { getPrimaryWalletAccount } from '@dynamic-labs-sdk/client';
import { Transaction } from '@mysten/sui/transactions';

const walletAccount = getPrimaryWalletAccount();

if (walletAccount && isSuiWalletAccount(walletAccount)) {
  const tx = new Transaction();
  tx.transferObjects(
    [tx.object('0x...')],
    tx.pure.address(recipientAddress)
  );

  const result = await signAndExecuteTransactionBlock({
    transactionBlock: tx,
    walletAccount,
    options: {
      showEffects: true,
      showEvents: true,
    },
  });

  console.log('Transaction digest:', result.digest);
}

Parameters

ParameterTypeDescription
transactionBlockTransactionThe Sui transaction block to sign and execute
walletAccountSuiWalletAccountThe wallet account to sign the transaction with
optionsSuiTransactionBlockResponseOptions (optional)The fields to return in the execution response (e.g., transaction, effects, events). By default, only the transaction digest is returned.
requestTypeExecuteTransactionRequestType (optional)The request type to use for the transaction execution
clientDynamicClient (optional)The Dynamic client instance. Only required when using multiple clients.

Returns

Promise<SuiSignAndExecuteTransactionBlockResult> - A promise that resolves to an object containing the transaction result.

Errors

ErrorDescription
NotSuiProviderErrorThrown if the wallet account’s provider is not a Sui provider
MethodNotImplementedErrorThrown if the wallet provider does not implement this method