darwinia-js-sdk is a library that enables easy interaction with a Darwinia node.
Developers can use Darwinia node's Ethereum-compatible JSON RPC to retrieve storage and dispatch substrate calls. Additionally, it provides derived APIs to simplify tasks.
It is compatible with Ethers and web3.js, and can be used with MetaMask and other web3-compatible wallets.
It works roughly like this:
typescriptconst provider = new ethers.providers.Web3Provider(window.ethereum); await provider.send('eth_requestAccounts', []); const signer = provider.getSigner(); const pangolin = clientBuilder.buildPangolinClient(provider); const receipt = await pangolin.calls.session.setKeys( signer, { aura: "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da28c" }, // keys "" // proof ); console.log(`tx hash: ${receipt.transactionHash}`);