Skip to content

APTOS Sign Transaction

Sign Transaction Example

typescript
import { Web3Kit, ChainType } from "@web3jskit/dapp";

interface ISignTransactionRes {
  signature: string;
}

function signTransaction(transaction: string) {
  const web3Kit = new Web3Kit();
  const serRes = (await web3Kit.request({
    chainType: ChainType.APTOS,
    methodName: "signTransaction",
    params: {
        function,
        functionArguments,
        typeArguments
    },
  }));
}

Request Parameters

typescript
//see detail here https://aptos.dev/en/build/sdks/ts-sdk/quickstart#2-build-the-transaction
{
    chainType: ChainType.APTOS,
    methodName: "signTransaction",
    params: {
        function, //string, function name,such as 0x1::aptos_account::transfer_coins
        functionArguments, //Array<string>, function arguments,
        typeArguments
    },
}

Return Value

typescript
{
    accountAuthenticator:{
        signature: string;
        public_key: string;
    },
    rawTxn:SimpleTransaction
}