簡體   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