ethers.js/packages/hardware-wallets/test.html

32 lines
1.1 KiB
HTML
Raw Normal View History

2020-01-11 04:09:40 +03:00
<html>
<head>
<title>Browser Test - Ledger</title>
</head>
<body>
<script type="module">
import { ethers } from "../ethers/dist/ethers.esm.js";
import { LedgerSigner } from "./dist/hardware-wallets.esm.js";
console.log(ethers, LedgerSigner);
(async function() {
const provider = ethers.getDefaultProvider();
const signer = new LedgerSigner(provider);
console.log("Signer", signer);
const address = await signer.getAddress();
console.log(address);
const tx = await signer.populateTransaction({ to: "ricmoo.eth", value: ethers.utils.parseEther("1.0") });
console.log(tx);
delete tx.from;
const signedTx = await signer.signTransaction(tx);
console.log("TX", signedTx);
const signature = await signer.signMessage("Hello World");
console.log("Signature", signature);
})();
</script>
</body>
</html>