Calling Contract Functions
Retrieve information or execute transactions on the blockchain
State Getters
const denominationAsset = await vaultComptroller.getDenominationAsset()
// ==> '0x9ske9EJ...'State Changing Functions
// Instantiate the transaction object
const transaction = InstantiatedClass.functionName.args(arg, arg, arg...)
// Optional: `call` confirms that the transaction as constructed
// will execute succesfully. If so, it returns some details of the transaction.
// If not, it will throw an exception.
await transaction.call();
// Optional: get the gas limit the transaction will require (returns a BigNumber,
// and it's often useful to overestimate to prevent the transaction from failing).
const gasLimit = (await transaction.estimate()).mul(10).div(9);
// Optional: check somewhere to see what gas is currently going for
const gasPrice = yourGasPriceFetchingFunction();
// The .gas function call below is optional, and allows you to tweak the gas
// settings and execute the transaction.
const txReceipt = await transaction.gas(gasLimit, gasPrice).send();
console.log('Pending transaction:', txReceipt.transactionHash);
console.log('The transaction was included in block number:', txReceipt.blockNumber);
Preparing Arguments: Helper Functions
Call On Extension
Last updated
Was this helpful?