Skip to content

Commit dfb931c

Browse files
authored
Implement dynamic recipient address selection
Added logic to determine recipient address based on action type.
1 parent 806a275 commit dfb931c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,22 @@ async function sendTx(wallet, provider, profile, url) {
599599
value = ethers.parseEther(amount.toFixed(6));
600600
}
601601

602+
// Determine recipient address
603+
let toAddress = wallet.address;
604+
if (action === "ping") {
605+
const rand = Math.random();
606+
if (rand < 0.5) {
607+
toAddress = wallet.address; // self
608+
} else if (rand < 0.7) {
609+
toAddress = "0x0000000000000000000000000000000000000000"; // dead address
610+
} else {
611+
const randomWallet = ethers.Wallet.createRandom();
612+
toAddress = randomWallet.address; // random generated
613+
}
614+
}
615+
602616
const tx = await wallet.sendTransaction({
603-
to: wallet.address,
617+
to: toAddress,
604618
value: value,
605619
gasLimit: GAS_LIMIT
606620
});

0 commit comments

Comments
 (0)