繁体   English   中英

Infura React Native Expo 未处理的承诺拒绝:错误:在 sendTransaction 上缺少响应

[英]Infura React Native Expo Unhandled promise rejection: Error: missing response on sendTransaction

const SIGNER_PRIVATE_KEY = await SecureStore.getItemAsync('Ethereum.privatekey')
  const provider = new ethers.providers.InfuraProvider(
    'ropsten',
    INFURA_PROJECT_ID
  );
  const signer = new ethers.Wallet(JSON.parse(SIGNER_PRIVATE_KEY), provider);
// console.log(signer)
  const tx = await signer.sendTransaction({
    to,
    value: ethers.utils.parseEther("0.001"),
  });
  console.log("Mining transaction...");
  console.log(`https://${network}.etherscan.io/tx/${tx.hash}`);
  // Waiting for the transaction to be mined
  const receipt = await tx.wait();
  // The transaction is now on chain!
  console.log(`Mined in block ${receipt.blockNumber}`);

  return tx;

我无法使用 react native infura ethers.js 库发送交易。 不断收到同样的错误。 请看一看。

就我而言,下面的解决方案解决了这个问题。

https://github.com/ethers-io/ethers.js/issues/993#issuecomment-687869294

我的版本是

  "dependencies": {
    "@ethersproject/shims": "^5.6.0",
    "ethers": "^5.6.9",

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM