git.delta.rocks / unique-network / refs/commits / f29e16fd1f41

difftreelog

source

js-packages/scripts/authorizeEnactUpgrade.ts760 Bsourcehistory
1import {readFile} from 'fs/promises';2import {u8aToHex} from '@polkadot/util';3import {usingPlaygrounds} from '@unique/test-utils/util.js';4import {blake2AsHex} from '@polkadot/util-crypto';567const codePath = process.argv[2];8if(!codePath) throw new Error('missing code path argument');910const code = await readFile(codePath);1112await usingPlaygrounds(async (helper, privateKey) => {13  const alice = await privateKey('//Alice');14  const hex = blake2AsHex(code);15  await helper.getSudo().executeExtrinsic(alice, 'api.tx.parachainSystem.authorizeUpgrade', [hex, true]);16  await helper.getSudo().executeExtrinsicUncheckedWeight(alice, 'api.tx.parachainSystem.enactAuthorizedUpgrade', [u8aToHex(code)]);17});18// We miss disconnect/unref somewhere.19process.exit(0);