I am trying to use the ContractPromise from @polkadot/api-contract to interact with a published smart contract on the moonriver network but when I try and create a new ContractPromise object I get the error

Error: createType(ContractProjectInfo):: Struct: Unable to map" + abi string + "array to object with known keys source, contract"

I'm not entirely sure why this is because the ABI and contract address seem to be correct.

The code I am using to test it out is here:

import { ApiPromise, WsProvider } from "@polkadot/api";
import { ContractPromise } from "@polkadot/api-contract";
import { ksmContractABI } from "./consts";

async function main() {
  const ksmContractAddress = "0xFfc7780C34B450d917d557E728f033033CB4fA8C";
  const wsProvider = new WsProvider("wss://kusama-rpc.polkadot.io");
  const api = await ApiPromise.create({ provider: wsProvider });
  const contract = new ContractPromise(

the contract can be seen here: https://moonriver.moonscan.io/address/0xFfc7780C34B450d917d557E728f033033CB4fA8C

and the code from which I generated my abi can be found here: https://github.com/mixbytes/lido-dot-ksm/blob/main/contracts/Lido.sol

  • 1
    @polkadot/api-contracts cannot interact with Ethereum-like contracts, only those using the Substrate contracts pallet. In this case it would seem, since you are trying on Moon*, it is an Ethereum-like contract. (To verify, sharing your ABI would be useful)
    – Jaco
    Jun 14, 2022 at 5:00
  • Oh that would make sense, I just assumed that since moonriver was built on kusama that the polkadot api would be able to interact with it. Here is the abi I was using: pastebin.com/D5GnE8cE. Also if you have any tips for how to interact with this contract using javascript that would be super helpful:) Jun 14, 2022 at 6:06
  • 1
    For ETH-contracts you can use the normal web3.js/ethers.js toolsets. Jul 3, 2022 at 6:52
  • Also, you are saying that you connect to the Moonriver network but the RPC endpoint you are using is kusama-rpc.polkadot.io. This Kusama and not Moonriver. Parachains have their own endpoint. You do not connect through their relay chain. Jul 27, 2022 at 22:08

1 Answer 1


The comments are correct, @polkadot/api-contract can only interact with wasm contracts deployed on chains that include pallet-contracts

In your case, you need a JS solution to interact with an Ethereum smart contract on Moonriver, which uses a different set of pallets.

The Moonbeam docs have a tutorial on how to configure Hardhat and interact with a deployed contract in the Hardhat console. https://docs.moonbeam.network/builders/build/eth-api/dev-env/hardhat

Another option you could try is compiling Solidity for Substrate with Solang and using it with @polkadot/api

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.