tx library

Functions

delayedWithdraw(Token token, String privateKey, {BigInt? gasLimit, int gasPrice = 0}) Future<String?>
Makes the final withdrawal from the WithdrawalDelayer smart contract after enough time has passed.
delayedWithdrawGasLimit(String fromEthereumAddress, Token token) Future<BigInt>
deposit(HermezCompressedAmount amount, String hezEthereumAddress, Token token, String babyJubJub, String privateKey, {BigInt? approveMaxGas, BigInt? depositMaxGas, int gasPrice = 0}) Future<String?>
Makes a deposit. It detects if it's a 'createAccountDeposit' or a 'deposit' and prepares the parameters accordingly. Detects if it's an Ether, ERC 20 token and sends the transaction accordingly.
depositGasLimit(HermezCompressedAmount amount, String hezEthereumAddress, Token token, String babyJubJub) Future<LinkedHashMap<String, BigInt>>
forceExit(HermezCompressedAmount amount, String? accountIndex, Token token, String privateKey, {dynamic gasLimit = GAS_LIMIT, dynamic gasPrice = GAS_MULTIPLIER}) Future<String?>
Makes a force Exit. This is the L1 transaction equivalent of Exit.
forceExitGasLimit(String hezEthereumAddress, HermezCompressedAmount amount, String accountIndex, Token token) Future<BigInt>
Estimates a force Exit Max Gas. This is the L1 transaction equivalent of Exit.
generateAndSendL2Tx(dynamic transaction, HermezWallet wallet, Token token) → dynamic
Compact L2 transaction generated and sent to a Coordinator. @param {Object} transaction - ethAddress and babyPubKey together @param {String} transaction.from - The account index that's sending the transaction e.g hez:DAI:4444 @param {String} transaction.to - The account index of the receiver e.g hez:DAI:2156. If it's an Exit, set to a falseable value @param {BigInt} transaction.amount - The amount being sent as a BigInt @param {Number} transaction.fee - The amount of tokens to be sent as a fee to the Coordinator @param {Number} transaction.nonce - The current nonce of the sender's token account @param {HermezWallet} wallet - Transaction sender Hermez Wallet @param {Token} token - The token information object as returned from the Coordinator.
getGasPrice(num multiplier, Web3Client web3client) Future<int>
Get current average gas price from the last ethereum blocks and multiply it @param {Number} multiplier - multiply the average gas price by this parameter @param {Web3Client} web3Client - Network url (i.e, http://localhost:8545). Optional @returns {Future
isInstantWithdrawalAllowed(double amount, Token token) Future<bool?>
sendL2Transaction(Map<String, dynamic> transaction, String? bJJ) → dynamic
Sends a L2 transaction to the Coordinator
withdraw(double amount, String? accountIndex, Token token, String babyJubJub, int batchNumber, List<BigInt>? merkleSiblings, String privateKey, {bool isInstant = true, BigInt? gasLimit, int gasPrice = 0}) Future<String?>
Finalise the withdraw. This a L1 transaction.
withdrawGasLimit(double amount, String fromEthereumAddress, String? accountIndex, Token token, String babyJubJub, int batchNumber, List<BigInt> merkleSiblings, {bool isInstant = true}) Future<BigInt>