* Use Si V1 in contracts (w/ PortableRegistry usage) * Type id lookups * Fix build & linting * Remove extra .toNumber() (VSCode has gone crazy) * v1 tests * Cleanup parsing * Explicit type cast for v1 types * Unneeded toNumber * Align events exposure with messages/constructors * dedupe * Re-add typedef extraction tests * with typedefs * Override for always primitives * displayName improvements * Versioned project * New structure * Fixes * Cleanups * Ensure API registry is the default used * Adjust arg & return encoding/decoding * Recursive contract * DoNotConstruct to Si type
@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) => { ... });