opengsn/gsn

Error: Not a paymaster contract: unknown account #0

Opened this issue · 6 comments

Trying to run a NodeJS script to send a meta transaction for a simple example contract. I've followed the OpenGSN instructions here.

I'm getting the error when trying to initialize a RelayProvider. I'm using the TestPaymasterEverythingAccepted deployed to the Arbitrum Goerli network and I'm using the latest ^3.0.0-beta.9 versions of the @opengsn/contracts and @opengsn/provider packages. I'm passing the web3 provider into the newWeb3Provider function but it fails because there's no account. I'm not familiar with the web3 package and I can't seem to find how to configure it with accounts. I've tried web3.eth.accounts.wallet.add(process.env.PRIVATE_KEY) but that doesn't seem to affect the web3 provider. Any help would be appreciated!

Error

Error: Not a paymaster contract: unknown account #0 (operation="getAddress", code=UNSUPPORTED_OPERATION, version=providers/5.7.2)
    at /Users/1/code/solidity/GSN-with-HardHat-main/node_modules/@opengsn/common/src/ContractInteractor.ts:260:72

My code

Gsn = require('@opengsn/provider');
const Web3 = require('web3');
const Counter = require('../artifacts/contracts/Counter.sol/Counter.json');
async function main() {
    web3 = new Web3(process.env.INFURA_URL);
    chainId = await [web3.eth.net](http://web3.eth.net/).getId()
    const config = {
      paymasterAddress: '0x9dC769B8cBD07131227b0815BEd3526b1f8ACD52',
      loggerConfiguration: {
        logLevel: 'info'
      }
    }
    const provider = await Gsn.RelayProvider.newWeb3Provider({
      provider: web3.currentProvider,
      config
    });
    web3.setProvider(provider);
    //Create a new gasless account:
    user = provider.newAccount();
    counter = new web3.eth.Contract(Counter.abi, '...', {
      from: user.address,
      gasPrice: 0
    });
    //Check current counter value
    const oldCount = await counter.methods.counter().call();
    //Increment count using gasless user
    await counter.methods.increment().send({ gas: 210000 });
}
main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

I found that after the release of the beta9 version, the beta9 version configuration cannot be loaded through the network, and the beta8 version was loaded before
image
config url:https://client-config.opengsn.org/3.0.0-beta.9/client-config.json

I see this message in the logs but I get it for any of the opengsn versions I've tried, including beta 8.

Could not fetch default configuration: Request failed with status code 404

In the latest beta9 version, listAccount is called here, and the obtained address is used to build the paymaster contract object, which causes the contract construction to fail. I have been searching for a long time and do not know where to add this account.
image

I have the same an error.
How can I resolve this?

Same issue in v3.0.0-beta.10 with ethers v5 provider

Any updates for v3.0.0-beta.10 web3?