Skip to content

Commit

Permalink
feat: ens scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiter committed May 18, 2022
1 parent 67efaea commit d7f0df3
Show file tree
Hide file tree
Showing 8 changed files with 10,606 additions and 211 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Expand Up @@ -8,4 +8,5 @@ module.exports = {
parserOptions: {
project: ['tsconfig.json', 'tsconfig.eslint.json'],
},
ignorePatterns: ['src/utils/domains-build.js'],
};
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -35,7 +35,9 @@
"ganache": "ganache-cli -m \"candy maple cake sugar pudding cream honey rich smooth crumble sweet treat\" -p 8544 --chainId 1337 -a 20 -e 10000000 -l=10000000",
"test:watch": "npm run start-rpc -- \"jest --coverage --env=./jest.env.js --watchAll\"",
"test": "npm run start-rpc -- \"jest --no-cache --env=./jest.env.js\"",
"test:watch:windows": "concurrently \"npm run start-rpc\" \"jest --coverage --env=./jest.env.js --watchAll\""
"test:watch:windows": "concurrently \"npm run start-rpc\" \"jest --coverage --env=./jest.env.js --watchAll\"",
"updateDomains": "npx ts-node scripts/update_domains",
"transferDomains": "npx ts-node scripts/transfer_omains"
},
"keywords": [
"decentralized",
Expand Down
7 changes: 7 additions & 0 deletions scripts/data.ts
@@ -0,0 +1,7 @@
export const domains = [];

export const owners = [];

export const voltaPrivateKey = '';

export const ewcPrivateKey = '';
23 changes: 23 additions & 0 deletions scripts/transfer_domains.ts
@@ -0,0 +1,23 @@
import { EWC_CHAIN_ID } from '@energyweb/credential-governance';
import { Wallet } from 'ethers';
import { transferDomain } from '../src/utils/domains';
import { domains, ewcPrivateKey } from './data';

export const newOwner = '0x3451aaEDD3f25204D483aADCF060e344155DEB02';

(async function () {
try {
for await (const rootDomain of domains) {
await transferDomain({
rootDomain,
signer: new Wallet(ewcPrivateKey),
newOwner,
chainId: EWC_CHAIN_ID,
dryRun: true,
});
}
console.log('Domains are transferred');
} catch (e) {
console.error('Error transferring domains:', e);
}
})();
20 changes: 20 additions & 0 deletions scripts/update_domains.ts
@@ -0,0 +1,20 @@
import { EWC_CHAIN_ID } from '@energyweb/credential-governance';
import { Wallet } from 'ethers';
import { updateLegacyDomains } from '../src/utils/domains';
import { domains, ewcPrivateKey } from './data';

(async function () {
try {
for await (const rootDomain of domains) {
await updateLegacyDomains({
rootDomain,
signer: new Wallet(ewcPrivateKey),
chainId: EWC_CHAIN_ID,
dryRun: true,
});
}
console.log('Domains are updated');
} catch (e) {
console.error('Error updating domains:', e);
}
})();

0 comments on commit d7f0df3

Please sign in to comment.