Skip to content

Commit 4b5ed87

Browse files
committed
Added a dummy transfer script
1 parent 1e2790a commit 4b5ed87

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

scripts/dummy-transfer.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import * as hre from 'hardhat';
2+
import { EnvironmentInfo, loadEnvironmentInfo } from './environment';
3+
import { newWalletOptions, WalletOptions } from './wallet-options';
4+
import { waitForInput } from './helper-functions';
5+
6+
async function dummyTransfer(): Promise<EnvironmentInfo> {
7+
const env = loadEnvironmentInfo(hre.network.name);
8+
const { network } = env;
9+
10+
console.log(`[${network}] Consuming nonce, PROCEED WITH CARE!...`);
11+
12+
await waitForInput();
13+
14+
// Setup wallet
15+
const wallets: WalletOptions = await newWalletOptions(env);
16+
const signer = wallets.getWallet();
17+
const signerAddress = await signer.getAddress();
18+
19+
console.log(`[${env.network}] Starting a 0 value transfer from ${signerAddress} to ${signerAddress}`);
20+
21+
const tx = await signer.sendTransaction({
22+
to: signerAddress,
23+
value: 0,
24+
})
25+
await tx.wait();
26+
console.log(`[${env.network}] Transfer completed with hash ${tx.hash}`);
27+
28+
return env;
29+
}
30+
31+
// Call primary function
32+
dummyTransfer()
33+
.then((env: EnvironmentInfo) => {
34+
console.log(`[${env.network}] Transfer successful...`);
35+
process.exit(0);
36+
})
37+
.catch(err => {
38+
console.error(err.message);
39+
process.exit(1);
40+
});
41+

scripts/wallet-options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class WalletOptions {
1919
constructor(env: EnvironmentInfo, coldWallet: Signer, walletImplLocatorImplChanger: Signer) {
2020
console.log(`[${env.network}] Using ledger for operations...`);
2121
this.useLedger = true;
22-
const accountIndex0 = 10;
22+
const accountIndex0 = 0;
2323
const derivationPath0 = `m/44'/60'/${accountIndex0.toString()}'/0/0`;
2424
this.ledger = new LedgerSigner(hardhat.provider, derivationPath0);
2525

0 commit comments

Comments
 (0)