0

I have 2 wallets.

I want to send coins from one to the other (1), and from the 2nd one to an external wallet (2).

const wallet = get_wallet();
const balance = await provider.getBalance(wallet.address);
const gasPrice = await provider.getGasPrice();
const balanceMinusGas = balance.sub(gasPrice.mul(ETH_GAS_LIMIT));
let amountToSend = balanceMinusGas;



let tx = wallet.sendTransaction({
  to: MY_2ND_WALLET,
  gasLimit: ETH_GAS_LIMIT,
  gasPrice: gasPrice,
  value: amountToSend,
});

//
//sent only? but hasn't arrived, gotten mined, settled yet?
//

Once I've made a tx (1), how will one find out whether a TX has been 100% settled, or confirmed, mined, and the coins received such that they've become available for being sent out (2) further?

const receipt = await tx.wait();

// is it now 100% that the TX has been mined, confirmed, 
// **and** the ETH received
// may now be used by the 2nd wallet?

// TODO ...send the ETH out from MY_2ND_WALLET

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.