Skip to main content
This function is deprecated. Use signTransaction instead.
Signs a Sui transaction block without executing it.

Usage

import { signTransactionBlock, 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 signTransactionBlock({
    transactionBlock: tx,
    walletAccount,
  });

  console.log('Signature:', result.signature);
}

Parameters

ParameterTypeDescription
transactionBlockTransactionThe Sui transaction block to sign
walletAccountSuiWalletAccountThe wallet account to sign the transaction with
clientDynamicClient (optional)The Dynamic client instance. Only required when using multiple clients.

Returns

Promise<SuiSignTransactionBlockResult> - A promise that resolves to an object containing the signature and transaction block bytes.

Errors

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