How to use the iotex-antenna/lib/action/method.ExecutionMethod function in iotex-antenna

To help you get started, we’ve selected a few iotex-antenna examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iotexproject / iotex-explorer / src / erc20 / erc20.ts View on Github external
public async estimateExecutionGas(
    method: string,
    account: Account,
    amount: string,
    // tslint:disable-next-line
    ...args: Array
  ): Promise {
    const execution = this.contract.pureEncodeMethod(amount, method, ...args);
    const executionMethod = new ExecutionMethod(
      getAntenna().iotx,
      account,
      execution
    );
    const { gasPrice } = await getAntenna().iotx.suggestGasPrice({});
    const envelop = await executionMethod.baseEnvelop("100000", `${gasPrice}`);
    envelop.execution = execution;
    const selp = SealedEnvelop.sign(
      account.privateKey,
      account.publicKey,
      envelop
    );

    let gasLimit = "400000";
    try {
      const { gas } = await getAntenna().iotx.estimateGasForAction({