Sui

Sui supports the following signature kinds:

  • Transaction, unsigned transaction.

Transaction

Signs an unsigned transaction.

Field
Description
Type - Optiional

blockchainKind

Sui

String

kind

Transaction

String

transaction

The unsigned hex encoded transaction as shown below.

String

{
  "blockchainKind": "Sui",
  "kind": "Transaction",
  "transaction": "0x0000020008010000000000000000201d9c96adb0eda0b3beca44ed89143444b4147b30f06eef7bfc39cbbff848f6e5020200010100000101030000000001010020d672470dc607fe9afb01f4c20778716ebeb69a542e7a7dea9bebafdbd28546016d03aa3a104560ced4e75b988fcd5913576258fe664c7d6a8f27f065c36035a5ae11d0140000000020a4053ac8443987ed5f189777e783ddb7570e46f3ec31eef082d0b35c9d5ef88120d672470dc607fe9afb01f4c20778716ebeb69a542e7a7dea9bebafdbd28546e80300000000000040ab3c000000000000"
}

Sui does not have a serialized format for a signed transaction. The response only includes the signature. You must package it correctly before calling sui_executeTransactionBlock.

Typescript Example with Sui SDK

First install the Sui SDK. You can find the full documentation here: https://sdk.mystenlabs.com/typescript

Here a code sample to generate a signature via the Dfns TypeScript SDK:

import { SuiClient } from '@mysten/sui/client'
import { Transaction } from '@mysten/sui/transactions'

const walletId = 'wa-3b6ka-b6a4k-xxxxxxxxxxxxxxxx'
const wallet = await dfnsClient.wallets.getWallet({ walletId })

const client = new SuiClient({ url: process.env.SUI_RPC_URL! })

const transaction = new Transaction()
const [coin] = transaction.splitCoins(transaction.gas, [1])
transaction.transferObjects([coin], '0x20d672470dc607fe9afb01f4c20778716ebeb69a542e7a7dea9bebafdbd28546')
transaction.setSender(wallet.address!)
const bytes = await transaction.build({ client })

const res = await dfnsClient.wallets.generateSignature({
  walletId,
  body: {
    kind: 'Transaction',
    transaction: `0x${Buffer.from(bytes).toString('hex')}`,
  },
})

Last updated