Skip to content

Commit

Permalink
Added a h160-to-ss58 converter script
Browse files Browse the repository at this point in the history
  • Loading branch information
Watchmaker committed Oct 16, 2024
1 parent 0c137bb commit 6de223f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions examples/eth-addr-format-to-ss58.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const { ethers } = require('ethers');
const { ApiPromise, WsProvider, Keyring } = require('@polkadot/api');
const { convertH160ToSS58 } = require('./address-mapping.js');

// PROTECT YOUR PRIVATE KEYS WELL, NEVER COMMIT THEM TO GITHUB OR SHARE WITH ANYONE
const { ethPrivateKey, subSeed, rpcUrl, wsUrl } = require('./config.js');

async function main() {
// Get ethereum address that matches the private key from the secrets file
// const recipientEthereumAddress = "put your destination address here";
// const recipientEthereumAddress = "0x709615c655B24919F48B365D292521EFcC74467B";
const recipientEthereumAddress = "0xd685a847471F7f07Ce36f89F99C198B098B13817";
const ss58Address = convertH160ToSS58(recipientEthereumAddress);
console.log(`For your Ethereum H160 address: ${recipientEthereumAddress}, the SS58 address is: ${ss58Address}`);
process.exit(0);
}

main().catch(console.error);
console.warn = () => {};

0 comments on commit 6de223f

Please sign in to comment.