git.delta.rocks / unique-network / refs/commits / 137320b42c82

difftreelog

source

js-packages/scripts/createHrmp.ts1.2 KiBsourcehistory
1import {usingPlaygrounds} from '@unique/test-utils/util.js';2import config from '../tests/config.js';34const profile = process.argv[2];5if(!profile) throw new Error('missing profile/relay argument');67await usingPlaygrounds(async (helper, privateKey) => {8  const bidirOpen = async (a: number, b: number) => {9    console.log(`Opening ${a} <=> ${b}`);10    await helper.getSudo().executeExtrinsic(alice, 'api.tx.hrmp.forceOpenHrmpChannel', [a, b, 8, 512]);11    await helper.getSudo().executeExtrinsic(alice, 'api.tx.hrmp.forceOpenHrmpChannel', [b, a, 8, 512]);12  };13  const alice = await privateKey('//Alice');14  switch (profile) {15    case 'opal':16      await bidirOpen(1001, 1002);17      break;18    case 'quartz':19      await bidirOpen(1001, 1002);20      await bidirOpen(1001, 1003);21      await bidirOpen(1001, 1004);22      await bidirOpen(1001, 1005);23      break;24    case 'unique':25      await bidirOpen(1001, 1002);26      await bidirOpen(1001, 1003);27      await bidirOpen(1001, 1004);28      await bidirOpen(1001, 1005);29      await bidirOpen(1001, 1006);30      await bidirOpen(1001, 1007);31      break;32    default:33      throw new Error(`unknown hrmp config profile: ${profile}`);34  }35}, config.relayUrl);36// We miss disconnect/unref somewhere.37process.exit(0);