Files
api/packages/api-contract
2021-04-26 18:20:50 +00:00
..
2021-04-26 18:20:50 +00:00
2021-03-05 12:34:38 +00:00
2021-04-26 20:11:39 +02:00

@polkadot/api-contract

Interfaces to allow for the encoding and decoding of Substrate contract ABIs.

import {ApiPromise, WsProvider } from '@polkadot/api';
import { Abi } from '@polkadot/api-contract';

const wsProvider = new WsProvider(<...Node Url...>);
const api = await ApiPromise.create({ provider: wsProvider });
const abi = new Abi(<...JSON ABI...>, api.registry.getChainProperties());

api.tx.contracts
  .call(<contract addr>, <value>, <max gas>, abi.messages.<method name>(<...params...>))
  .signAndSend(<keyring pair>, (result: SubmittableResult) => { ... });