Skip to content

Instantly share code, notes, and snippets.

@Falci
Last active December 3, 2021 20:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Falci/e6913d424a985873db9e00047d3e2a25 to your computer and use it in GitHub Desktop.
Save Falci/e6913d424a985873db9e00047d3e2a25 to your computer and use it in GitHub Desktop.
This script parks a list of domain in parking.sinpapeles. It requires Bob Wallet.
const { WalletClient } = require('hs-client');
const { Network } = require('hsd');
const network = Network.get('main');
// Important: Bob needs to be running
// This is the phrase you use to unlock Bob Wallet.
const passphrase = 'MY PASSPPHASE';
// The list of domains you want to park;
const names = ['xn--um8h', 'x1f'];
// Contact info: it can be an email or a link:
// const contact = 'mailto:domains.seller@gmail.com';
const contact = 'http://iamfernando/';
// Price for each domain
const value = '1000 HNS';
const records = [
{ type: 'NS', ns: 'parking.sinpapeles.' },
{ type: 'TXT', txt: [`parking=${contact}`] }, // required
{ type: 'TXT', txt: [`parking-value=${value}`] }, // optional. Comment out this line if you don't want to set a value
];
const walletOptions = {
network: network.type,
port: network.walletPort,
host: '127.0.0.1',
apiKey: '871e1d9ffc3cadcd7e71efb6d5be2d22675b42d2', // Get this on Bob's settings page
};
const walletClient = new WalletClient(walletOptions);
(async () => {
const timeout = names.length;
await walletClient.execute('walletpassphrase', [passphrase, timeout]);
names.forEach(async name => {
const result = await walletClient.execute('sendupdate', [name, { records }]);
console.log({ name, tx: result.hash });
// Output:
// {
// name: 'xn--um8h',
// tx: 'd8ff787e7c37e7660faca4439a61b54b20b17adf8751804a517aa0cb1880ab69'
// }
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment