πŸ—οΈTx Builder

You won't need to use this class directly. In 0xWeb generated classes TxDataBuilder and TxWriter are used under the hood to send transactions.

Prepares the Tx DataπŸ”— to be submitted to the chain.

import { TxDataBuilder } from '@dequanto/txs/TxDataBulder'

let builder = new TxDataBuilder(client, account?)
let txData = builder
    // demo with types
    .setInputDataWithTypes(types: any[], paramaters: any[])
    .setInputDataWithABI(fnAbi: string | AbiItem, ...params)
    .setValue(wei: bigint)
    .setNonce(nonceConfig?: TNonceConfig)
    .setGas(gasConfig?: TGasConfig)
    .signToString(privateKey: string);

    
type TNonceConfig {
    // sets the nonce of the first tx in pending state
    overriding?: boolean
    // set the nonce of the N-th tx in pending state
    noncePending?: number
    // custom nonce value
    nonce?: number
}
type TGasConfig {
    price?: bigint
    priceRatio?: number
    gasLimitRatio?: number
    gasLimit?: string | number
    gasEstimation?: boolean
    from?: TAddress
    type?: 1 | 2
}

Last updated