I'm trying to use Ether.js in React-Native environment to send ether. I followed the example on the Etherjs guide.
This is my code:
let privateKey = 'walletPrivateKey';
let destinationAddress = '0xa43cBF460670deA2AcC7642bBF71DBe867dB2e06';
var wallet = new ethers.Wallet(privateKey,['rinkeby','rinkebyKeyAPI']);
console.log('Address: ' + wallet.address);
console.log(wallet);
var transaction = {
gasLimit: 1000000,
gasPrice: ethers.utils.bigNumberify("20000000000"),
to: "0xa43cBF460670deA2AcC7642bBF71DBe867dB2e06",
data: "0x",
value: ethers.utils.parseEther("0.000666"),
};
let sendTransactionPromise = wallet.sendTransaction(transaction);
sendTransactionPromise.then(function(transactionHash) {
console.log(transactionHash);
});
When I throw this function i will get the following error:
this.provider.getTransactionCount is not a function
How I could solve this?