1import {readFile} from 'fs/promises';2import {u8aToHex} from '@polkadot/util';3import {usingPlaygrounds} from '.';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});1819process.exit(0);