Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
demirtasarkinbaris opened this issue Aug 12, 2024 · 0 comments

Comments

@demirtasarkinbaris
Copy link

demirtasarkinbaris commented Aug 12, 2024

`
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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant