Skip to content

Class: BatchTransaction ​

Properties ​

PropertyTypeDescriptionDefined in
batchContractnull | ContractParent Batch Smart Contract Used for aggregating all different transaction batches and executing in single transaction call.execute.ts:39
batchProcessingContractnull | ContractBatch smart contract with methods for executing Batched ETH and ERC20 transfer transactionsexecute.ts:33
providernull | ProviderProvider used to interact with the network This is fetched directly if ethereum object is present in Window (being used in browser)execute.ts:23
signernull | SignerSigner used as runner for executing smart contracts transactionsexecute.ts:28

Methods ​

executeERC20Batch() ​

executeERC20Batch(erc20Batch, allowanceAmount): Promise<ContractTransaction>

Function to generate transaction data of only batch transactions of ERC20 transfers

Parameters ​

ParameterTypeDescription

erc20Batch

ERC20Batch

takes an array of recipients address and corresponding array of ERC20 token address and amounts to transfer to each recipient

allowanceAmount

TokenAllowance

total bigint amount of respective ERC20 tokens to be approved for batchProcessingContract to transfer

Returns ​

Promise<ContractTransaction>

Populated ERC20 Batch transaction calldata of the smart contract call.

Remarks ​

This function is called internally by processBatchTransaction, but is also exported from the class for the users to generate the calldata of their batch transactions to use it for their own.

Defined in ​

execute.ts:252


executeEthBatch() ​

executeEthBatch(ethBatch, totalEthAmount): Promise<ContractTransaction>

Function to generate transaction data of only batch transactions of ETH transfers

Parameters ​

ParameterTypeDescription

ethBatch

ETHBatch

takes an array of recipients address and corresponding array of ETH amount to transfer to each recipient

totalEthAmount

BigInt

Total amount of ETH that the spender is going to transfer

Returns ​

Promise<ContractTransaction>

Populated ETH Batch transaction calldata of the smart contract call.

Remarks ​

This function is called internally by processBatchTransaction, but is also exported from the class for the users to generate the calldata of their batch transactions to use it for their own.

Defined in ​

execute.ts:226


getTxnLink(hash?): null | string

Parameters ​

ParameterType

hash?

string

Returns ​

null | string

Defined in ​

execute.ts:275


init() ​

init(initialize?): Promise<boolean>

Initializes BatchTransaction class by performing setup operations for contracts and class variables

Parameters ​

ParameterTypeDescription

initialize?

Initializer

optional in Browser if ethereum object present. Required in Node env to pass provider, signer or private key.

Returns ​

Promise<boolean>

true if successful

Defined in ​

execute.ts:54


processBatchTransactions() ​

processBatchTransactions(batchData, gasPrice): Promise<InvalidTransactions[] | object>

Function to process the ETH and ERC20 batch transactions

Parameters ​

ParameterTypeDefault valueDescription

batchData

BatchData[]

undefined

User prepared raw transaction array of {BatchData} type

gasPrice

null | bigint

null

Optional param if you want to send current gasPrice for this transaction.

Returns ​

Promise<InvalidTransactions[] | object>

Promise<{ txn: ethers.TransactionResponse, invalidTxns: InvalidTransactions[] } | InvalidTransactions[]>

Defined in ​

execute.ts:110