How to use the iotex-antenna/lib/contract/contract.Contract 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 / vita.ts View on Github external
public static create(address: string, provider: IRpcMethod): Vita {
    const vita = new Vita();
    vita.address = address;
    vita.provider = provider;
    vita.contract = new Contract(ABI, address, {
      provider: provider
    });

    const methods = {};
    // @ts-ignore
    for (const fnName of Object.keys(vita.contract.getABI())) {
      // @ts-ignore
      const fnAbi = vita.contract.getABI()[fnName];
      if (fnAbi.type === "constructor") {
        continue;
      }

      const args = getArgTypes(fnAbi);
      const header = getHeaderHash(fnAbi, args);

      // @ts-ignore
github iotexproject / iotex-explorer / src / erc20 / erc20.ts View on Github external
public static create(
    address: string,
    provider: IRpcMethod,
    abi: Array = ABI
  ): ERC20 {
    const erc20 = new ERC20();
    erc20.address = address;
    erc20.provider = provider;
    erc20.contract = new Contract(abi, address, {
      provider: provider
    });

    const methods = {};
    // @ts-ignore
    for (const fnName of Object.keys(erc20.contract.getABI())) {
      // @ts-ignore
      const fnAbi = erc20.contract.getABI()[fnName];
      if (fnAbi.type === "constructor") {
        continue;
      }

      const args = getArgTypes(fnAbi);
      const header = getHeaderHash(fnAbi, args);

      // @ts-ignore
github iotexproject / iotex-explorer / src / shared / wallet / contract / interact.tsx View on Github external
this.props.form.validateFields(async (err, values) => {
      if (err) {
        return;
      }

      const { contractAddress, abi, selectedFunction, args = [] } = values;
      const contract = new Contract(JSON.parse(abi), contractAddress);
      const bytecode = contract
        .pureEncodeMethod("0", selectedFunction, ...args)
        .data.toString("hex");
      copyCB(bytecode);
    });
  };