ScopeLift / umbra-protocol

🌕🌑 Privacy Preserving Shielded Payments On The Ethereum Blockchain
https://app.umbra.cash
MIT License
360 stars 93 forks source link

Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.7.2) #691

Open demirtasarkinbaris opened 2 months ago

demirtasarkinbaris commented 2 months ago

` import { Umbra } from '@umbracash/umbra-js'; import { ethers } from 'ethers';

    const privateTransferTest = async () => {
    try {
      // RPC provider
      const provider = new ethers.providers.JsonRpcProvider(
        'https://polygon-bor-rpc.publicnode.com'
      );

    // private key
    const PrivateKey ='0x00000';

    const signer = new ethers.Wallet(PrivateKey, provider);
    const tokenAddress = 'ETH_ADDRESS';
    const amount = ethers.utils.parseEther('0.01');
    const recipientId = '0xD9e3ebE6B10Bc1f692a83B941Fe9BF53851b91C6';

    const manualGasLimit = ethers.BigNumber.from('1000000');
    const gasPrice = await provider.getGasPrice();
    const overrides = { gasPrice, gasLimit: manualGasLimit };

    const umbra = new Umbra(provider, provider.network.chainId);

    console.log('umbra', umbra);

   // Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.7.2) 
    const { tx, stealthKeyPair } = await umbra.send(
      signer,
      tokenAddress,
      amount,
      recipientId,
      overrides
    );
    await tx.wait();
    console.log('Transaction hash:', tx.hash);
    console.log('Stealth key pair:', stealthKeyPair);
  } catch (error) {
    console.error('Error in privateTransferTest:', error);
  }
};

`

"@umbracash/umbra-js": "^0.2.0", "ethers": "^5.7.2",

I want to transfer 0.01 matic, but the log is like this:

[Log] umbra – _Umbra {provider: JsonRpcProvider, chainConfig: Object, umbraContract: Contract, …} (Home.component.tsx, line 514) [Error] Failed to load resource: the server responded with a status of 404 (Not Found) (undefined, line 0) [Error] Error in privateTransferTest: – Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.7.2)