forked from anders-torbjornsen/ethers-ledger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestTransact.js
More file actions
24 lines (22 loc) · 743 Bytes
/
testTransact.js
File metadata and controls
24 lines (22 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"use strict";
const { ethers } = require("ethers");
const { LedgerSigner } = require("./lib");
(async function() {
const provider = new ethers.providers.JsonRpcProvider("http://localhost:8545");
const signer = new LedgerSigner(provider);
console.log(signer);
console.log(await signer.getAddress());
console.log(await provider.getGasPrice());
console.log(await provider.getFeeData());
try {
let tx = await signer.sendTransaction({
to: "0xAaF147Cee92E94016e66C88355cDaE02AdD31b36",
value: ethers.utils.parseEther("0.001")
});
console.log(tx);
tx = await tx.wait();
console.log(tx);
} catch (error) {
console.log("ERR", error);
}
})();