Aptos transaction

1. Generate Transaction

1.1. Generate Transaction (Single signer)

Generate transaction from readable JSON format payload.

Method type

async generateTransaction(
    payload: EntryFunctionPayload,
    options?: Partial<SubmitTransactionRequest>
): Promise<Response<Uint8Array>>;

type SubmitTransactionRequest = {
    sender: string;
    sequence_number: string; // U64
    max_gas_amount: string; // U64
    gas_unit_price: string; // U64
    expiration_timestamp_secs: string; // U64
    payload: object; // Transaction Payload (entry, script, module_bundle)
    signature: object; // ed25519, multi_ed25519, multi_agent
}

type EntryFunctionPayload = {
    type: string;
    function: string;
    type_arguments: Array<string>;
    arguments: Array<any>;
}

Example request

Example response

Response data: TxnBuilderTypes.RawTransaction as Uint8Array

Covert Uint8Array to TxnBuilderTypes.RawTransaction (optional)

1.2. Generate Raw Transaction (Single signer)

Generate unsigned transaction from BCS serialized payload

Method type

Example request

Example response

Response data: TxnBuilderTypes.RawTransaction as Uint8Array

Covert Uint8Array to TxnBuilderTypes.RawTransaction (optional)

1.3. Generate BCS Transaction (Single signer)

Generate signed BCS serialized transaction from BCS serialized payload. Connected account will sign this BCS serialized payload.

Method type

Example request

Example response

Response data: TxnBuilderTypes.RawTransaction as Uint8Array

Covert Uint8Array to TxnBuilderTypes.RawTransaction (optional)

2. Sign Transaction

2.1. Sign and Submit Transaction (Single signer)

We recommend you use this method

Method type

Example request

Example response

2.2. Sign Transaction (Single signer)

Sign a transaction and do not submit to the Aptos blockchain.

Method type

Example request

Example response

Response data: Uint8Array

2.3. Sign Message (Single signer)

3. Submit Transaction

3.1 Submit Transaction (Single signer)

Method type

Example request

Example response

Response data: Gen.HexEncodedBytes

4. Simulate Transaction

Verify if the transaction is valid. You can use this function to estimate gas consumer.

4.1. simulateTransaction (Single Signer, Multi-Sign)

Method type

Example request

Example response

Response data: Gen.UserTransaction[] (array of Gen.UserTransaction)

Learn more about response data types at Response Format and Types

5. Supported methods

Last updated

Was this helpful?