utils
library
Functions
anyEmulateFailed (List emulateResponses )
→ bool
Check the emulate response, if any tx reverted then it is a fail
buildParams (List <String > types , List args )
→ Uint8List
ABI encode params according to types
buildTransaction (List <Clause > clauses , int chainTag , String blockRef , int nonce , {int expiration = 32 , int gasPriceCoef = 0 , int gas = 0 , String ? dependsOn , bool feeDelegation = false })
→ Transaction
buildTxBody (List clauses , int chainTag , String blockRef , int nonce , {int expiration = 32 , int gasPriceCoef = 0 , int gas = 0 , String ? dependsOn , bool feeDelegation = false })
→ Map
Build a Tx body.
Clause should confine to "thor_devkit.transaction.CLAUSE" schema. {to, value, data}
Tx body shall confine to "thor_devkit.transaction.BODY" schema.
calcBlockRef (String blockId )
→ String
Calculate a blockRef from a given block_id, id should starts with 0x
calcEmulateTxBody (String caller , Map txBody , {String ? gaspayer })
→ Map
Rip an emulated tx body from a normal tx body.
calcGas (int vmGas , int intrinsicGas )
→ int
Calculate recommended (safe) gas
calcNonce ()
→ int
Calculate a random number for nonce
calcTxSigned (Wallet wallet , Map txBody )
→ Transaction
Build signed transaction from tx body
calcTxSignedEncoded (Wallet wallet , Map txBody )
→ String
Build signed transaction from tx body
calcTxSignedWithFeeDelegation (Wallet caller , Wallet payer , Transaction tx )
→ Transaction
injectDecodedEvent (Map eventDict , Contract contract )
→ Map
Inject 'decoded' and 'name' into event
injectDecodedReturn (Map emulateResponse , Contract contract , String funcName )
→ Map
Inject 'decoded' return value into a emulate response
injectRevertReason (Map emulateResponse )
→ Map
isEmulateFailed (dynamic emulateResponse )
→ bool
If a single clause emulation is failed
readVmGases (List emulatedResponses )
→ List <int >
Extract vm gases from a batch of emulated executions.
suggestGasForTx (int vmGas , Map txBody )
→ int
Calculate the suggested gas for a transaction