This classes provides an interface to interact with the Xsigners ink contract on the substrate ecosystem.
- with
npm
:
npm i xsigners-sdk
- with
yarn
:
yarn add xsigners-sdk
- Importing the class
import { ApiPromise, WsProvider } from '@polkadot/api';
import { MultisigFactory } from "xsigners-sdk/dist/xsigners_sdk/src";
- Initialize the Polkadot API
const wsProvider = new WsProvider('wss://your-node-url');
const api = await ApiPromise.create({ provider: wsProvider });
- Create the instance
const multisigFactory = new MultisigFactory(api, 'chainId');
- Get a contract ContractPromise
With the builder ready, you can now create a ContractPromise
for a specific chain:
const chainId = 'shibuya-testnet'; // Replace with your desired chain ID
const contract = multisigFactory.buildContractPromise(chainId); // If not supplied, the instance will be used.
- Interact with the Contract
const result = await contract.query.methodName(accountAddress, /* method parameters */);
console.log(result.output?.toHuman());
const tx = contract.tx.methodName({ value, gasLimit }, /* method parameters */);
const result = await tx.signAndSend(accountAddress);
Ensure that the chainId
you provide is supported. If it's not, the MultisigFactory
will throw an error.