Skip to Content

Transactions

Transaction methods

WaaP supports signing and executing transactions as per Sui Wallet Standard for sui:signTransaction and sui:signAndExecuteTransaction.

  • sui:signTransaction - Prompt the user to sign a transaction and return the serialized transaction and signature back to the app. This method does not submit the transaction for execution.

  • sui:signAndExecuteTransaction - Prompt the user to sign a transaction, then submit it for execution to the blockchain.

Sign and Execute Transaction (standard)

import { getWallets } from '@mysten/wallet-standard' import { Transaction } from '@mysten/sui/transactions' const wallets = getWallets().get() const wallet = wallets.find(w => w.name === 'WaaP') if (!wallet) return const tx = new Transaction() const [coin] = tx.splitCoins(tx.gas, [1000]) tx.transferObjects([coin], '0xRecipient...') // The wallet expects serialized bytes const bytes = await tx.build({ client: suiClient }) const result = await wallet.features['sui:signAndExecuteTransaction'].signAndExecuteTransaction({ transaction: bytes, account: wallet.accounts[0], chain: 'sui:testnet', }) console.log('Digest:', result.digest)

Sign and Execute Transaction (with @mysten/dapp-kit)

@mysten/dapp-kit provides convenient hooks for signing transactions.

import { useSignAndExecuteTransaction } from '@mysten/dapp-kit' import { Transaction } from '@mysten/sui/transactions' export function ExecuteTransaction() { const { mutate: signAndExecuteTransaction } = useSignAndExecuteTransaction() const sendSui = () => { const tx = new Transaction() // Create a coin split const [coin] = tx.splitCoins(tx.gas, [1000]) // Transfer the split coin to a recipient tx.transferObjects([coin], '0xRecipientAddress...') signAndExecuteTransaction( { transaction: tx, }, { onSuccess: (result) => { console.log('Transaction executed:', result.digest) }, onError: (error) => { console.error('Transaction failed:', error) } }, ) } return ( <button onClick={sendSui}> Send 1000 MIST </button> ) }

Legacy Transaction Methods

WaaP maintains backward compatibility with older Sui SDK standards by supporting legacy methods. These methods map internally to the modern signTransaction and signAndExecuteTransaction implementations.

  • sui:signTransactionBlock - Legacy version of sui:signTransaction.
  • sui:signAndExecuteTransactionBlock - Legacy version of sui:signAndExecuteTransaction.

Sign and Execute Transaction Block (standard)

import { getWallets } from '@mysten/wallet-standard' import { Transaction } from '@mysten/sui/transactions' const wallets = getWallets().get() const wallet = wallets.find(w => w.name === 'WaaP') if (!wallet) return const tx = new Transaction() const [coin] = tx.splitCoins(tx.gas, [1000]) tx.transferObjects([coin], '0xRecipient...') // The wallet expects serialized bytes const bytes = await tx.build({ client: suiClient }) const result = await wallet.features['sui:signAndExecuteTransactionBlock'].signAndExecuteTransactionBlock({ transactionBlock: bytes, account: wallet.accounts[0], chain: 'sui:testnet', }) console.log('Digest:', result.digest)

Sign and Execute Transaction Block (with @mysten/dapp-kit)

import { useSignAndExecuteTransactionBlock } from '@mysten/dapp-kit' import { Transaction } from '@mysten/sui/transactions' export function ExecuteTransactionBlock() { const { mutate: signAndExecuteTransactionBlock } = useSignAndExecuteTransactionBlock() const sendSui = () => { const tx = new Transaction() // Create a coin split const [coin] = tx.splitCoins(tx.gas, [1000]) // Transfer the split coin to a recipient tx.transferObjects([coin], '0xRecipientAddress...') signAndExecuteTransactionBlock( { transactionBlock: tx, }, { onSuccess: (result) => { console.log('Transaction executed:', result.digest) }, onError: (error) => { console.error('Transaction failed:', error) } }, ) } return ( <button onClick={sendSui}> Send 1000 MIST </button> ) }

Security and User Experience

  • User Consent: All signing and transaction actions require explicit user approval via the WaaP modal.
  • No Private Key Exposure: The private key is never reconstructed anywhere but done via 2PC (Two-party computation) and 2PC-MPC (Two-party computation - Multi-party computation).