From 41e44206897000aee8b5030af00e9b77b635de64 Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Tue, 17 Oct 2023 18:35:22 +0200 Subject: [PATCH] fix: move propose-upgrade script to tests --- gov/scripts/.gitignore | 3 - gov/scripts/package.json | 16 - gov/scripts/src/proposeupgrade.ts | 39 -- gov/scripts/tsconfig.json | 17 - gov/scripts/yarn.lock | 606 ------------------------------ tests/package.json | 5 +- tests/src/proposeupgrade.ts | 39 ++ 7 files changed, 42 insertions(+), 683 deletions(-) delete mode 100644 gov/scripts/.gitignore delete mode 100644 gov/scripts/package.json delete mode 100644 gov/scripts/src/proposeupgrade.ts delete mode 100644 gov/scripts/tsconfig.json delete mode 100644 gov/scripts/yarn.lock create mode 100644 tests/src/proposeupgrade.ts diff --git a/gov/scripts/.gitignore b/gov/scripts/.gitignore deleted file mode 100644 index 15eaf4cbc0..0000000000 --- a/gov/scripts/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/node_modules/ -.yarn/cache -.yarn/install-state.gz diff --git a/gov/scripts/package.json b/gov/scripts/package.json deleted file mode 100644 index 661752da93..0000000000 --- a/gov/scripts/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "gov-scripts", - "version": "1.0.0", - "description": "Governance Scripts", - "license": "MIT", - "type": "module", - "scripts": { - "propose-upgrade": "ts-node --esm ./src/proposeupgrade.ts" - }, - "dependencies": { - "@polkadot/api": "^10.10.1", - "@types/node": "^20.4.2", - "ts-node": "^10.9.1", - "typescript": "^5.1.6" - } -} diff --git a/gov/scripts/src/proposeupgrade.ts b/gov/scripts/src/proposeupgrade.ts deleted file mode 100644 index f6c7cf0a98..0000000000 --- a/gov/scripts/src/proposeupgrade.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { ApiPromise, WsProvider } from '@polkadot/api'; -import { blake2AsHex } from '@polkadot/util-crypto'; -import { readFileSync } from 'fs'; - -async function main() { - const networkUrl = process.argv[2]; - const wasmFile = process.argv[3]; - - const wsProvider = new WsProvider(networkUrl); - const api = await ApiPromise.create({ provider: wsProvider }); - - const wasmFileBytes = readFileSync(wasmFile); - const wasmFileHash = blake2AsHex(wasmFileBytes, 256); - - const authorizeUpgrade = api.tx.parachainSystem.authorizeUpgrade(wasmFileHash, true); - - const councilMembers = (await api.query.council.members()).toJSON() as any[]; - const councilProposalThreshold = Math.floor(councilMembers.length / 2) + 1; - - const democracyProposal = api.tx.democracy.externalProposeDefault({ - Inline: authorizeUpgrade.method.toHex(), - }); - - const councilProposal = api.tx.council.propose( - councilProposalThreshold, - democracyProposal, - democracyProposal.method.encodedLength, - ); - - const encodedCall = councilProposal.method.toHex(); - - console.log('-----------------'); - console.log('Upgrade Proposal: ', `https://polkadot.js.org/apps/?rpc=${networkUrl}#/extrinsics/decode/${encodedCall}`); - console.log('-----------------'); - - await api.disconnect(); -} - -await main(); diff --git a/gov/scripts/tsconfig.json b/gov/scripts/tsconfig.json deleted file mode 100644 index cf1964d114..0000000000 --- a/gov/scripts/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "moduleResolution": "node", - "esModuleInterop": true, - "resolveJsonModule": true, - "module": "ESNext", - "sourceMap": true, - "outDir": "dist", - "strict": true - }, - "include": ["./src/**/*"], - "lib": ["es2017"], - "ts-node": { - "experimentalSpecifierResolution": "node" - } -} diff --git a/gov/scripts/yarn.lock b/gov/scripts/yarn.lock deleted file mode 100644 index 206d0cd616..0000000000 --- a/gov/scripts/yarn.lock +++ /dev/null @@ -1,606 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@cspotcode/source-map-support@^0.8.0": - version "0.8.1" - resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" - integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== - dependencies: - "@jridgewell/trace-mapping" "0.3.9" - -"@jridgewell/resolve-uri@^3.0.3": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" - integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== - -"@jridgewell/sourcemap-codec@^1.4.10": - version "1.4.15" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" - integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== - -"@jridgewell/trace-mapping@0.3.9": - version "0.3.9" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" - integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== - dependencies: - "@jridgewell/resolve-uri" "^3.0.3" - "@jridgewell/sourcemap-codec" "^1.4.10" - -"@noble/curves@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" - integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== - dependencies: - "@noble/hashes" "1.3.2" - -"@noble/hashes@1.3.2", "@noble/hashes@^1.3.2": - version "1.3.2" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" - integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== - -"@polkadot/api-augment@10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-augment/-/api-augment-10.10.1.tgz#d3d296c923b0ff915c8d4f163e9b3bad70b89b9b" - integrity sha512-J0r1DT1M5y75iO1iwcpUBokKD3q6b22kWlPfiHEDNFydVw5vm7OTRBk9Njjl8rOnlSzcW/Ya8qWfV/wkrqHxUQ== - dependencies: - "@polkadot/api-base" "10.10.1" - "@polkadot/rpc-augment" "10.10.1" - "@polkadot/types" "10.10.1" - "@polkadot/types-augment" "10.10.1" - "@polkadot/types-codec" "10.10.1" - "@polkadot/util" "^12.5.1" - tslib "^2.6.2" - -"@polkadot/api-base@10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-base/-/api-base-10.10.1.tgz#2d02f96960cbdd9d0ab61fe016587585902d1ee8" - integrity sha512-joH2Ywxnn+AStkw+JWAdF3i3WJy4NcBYp0SWJM/WqGafWR/FuHnati2pcj/MHzkHT8JkBippmSSJFvsqRhlwcQ== - dependencies: - "@polkadot/rpc-core" "10.10.1" - "@polkadot/types" "10.10.1" - "@polkadot/util" "^12.5.1" - rxjs "^7.8.1" - tslib "^2.6.2" - -"@polkadot/api-derive@10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-10.10.1.tgz#555d755c393f57c8855b9fc28062148a3723e333" - integrity sha512-Q9Ibs4eRPqdV8qnRzFPD3dlWNbLHxRqMqNTNPmNQwKPo5m6fcQbZ0UZy3yJ+PI9S4AQHGhsWtfoi5qW8006GHQ== - dependencies: - "@polkadot/api" "10.10.1" - "@polkadot/api-augment" "10.10.1" - "@polkadot/api-base" "10.10.1" - "@polkadot/rpc-core" "10.10.1" - "@polkadot/types" "10.10.1" - "@polkadot/types-codec" "10.10.1" - "@polkadot/util" "^12.5.1" - "@polkadot/util-crypto" "^12.5.1" - rxjs "^7.8.1" - tslib "^2.6.2" - -"@polkadot/api@10.10.1", "@polkadot/api@^10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-10.10.1.tgz#06fcbdcc8e17d2312d4b4093733d506f15ff62ad" - integrity sha512-YHVkmNvjGF4Eg3thAbVhj9UX3SXx+Yxk6yVuzsEcckEudIRHzL2ikIWGCfUprfzSeFNpUCKdJIi1tsxVHtA7Tg== - dependencies: - "@polkadot/api-augment" "10.10.1" - "@polkadot/api-base" "10.10.1" - "@polkadot/api-derive" "10.10.1" - "@polkadot/keyring" "^12.5.1" - "@polkadot/rpc-augment" "10.10.1" - "@polkadot/rpc-core" "10.10.1" - "@polkadot/rpc-provider" "10.10.1" - "@polkadot/types" "10.10.1" - "@polkadot/types-augment" "10.10.1" - "@polkadot/types-codec" "10.10.1" - "@polkadot/types-create" "10.10.1" - "@polkadot/types-known" "10.10.1" - "@polkadot/util" "^12.5.1" - "@polkadot/util-crypto" "^12.5.1" - eventemitter3 "^5.0.1" - rxjs "^7.8.1" - tslib "^2.6.2" - -"@polkadot/keyring@^12.5.1": - version "12.5.1" - resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-12.5.1.tgz#2f38504aa915f54bbd265f3793a6be55010eb1f5" - integrity sha512-u6b+Q7wI6WY/vwmJS9uUHy/5hKZ226nTlVNmxjkj9GvrRsQvUSwS94163yHPJwiZJiIv5xK5m0rwCMyoYu+wjA== - dependencies: - "@polkadot/util" "12.5.1" - "@polkadot/util-crypto" "12.5.1" - tslib "^2.6.2" - -"@polkadot/networks@12.5.1", "@polkadot/networks@^12.5.1": - version "12.5.1" - resolved "https://registry.yarnpkg.com/@polkadot/networks/-/networks-12.5.1.tgz#685c69d24d78a64f4e750609af22678d57fe1192" - integrity sha512-PP6UUdzz6iHHZH4q96cUEhTcydHj16+61sqeaYEJSF6Q9iY+5WVWQ26+rdjmre/EBdrMQkSS/CKy73mO5z/JkQ== - dependencies: - "@polkadot/util" "12.5.1" - "@substrate/ss58-registry" "^1.43.0" - tslib "^2.6.2" - -"@polkadot/rpc-augment@10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-augment/-/rpc-augment-10.10.1.tgz#c25ec45687631ea649e2d5c7f7f9b0813ac4ca9f" - integrity sha512-PcvsX8DNV8BNDXXnY2K8F4mE7cWz7fKg8ykXNZTN8XUN6MrI4k/ohv7itYic7X5LaP25ZmQt5UiGyjKDGIELow== - dependencies: - "@polkadot/rpc-core" "10.10.1" - "@polkadot/types" "10.10.1" - "@polkadot/types-codec" "10.10.1" - "@polkadot/util" "^12.5.1" - tslib "^2.6.2" - -"@polkadot/rpc-core@10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-10.10.1.tgz#5837e9ce635d5804cad897c6336771b61f3ef61a" - integrity sha512-awfFfJYsVF6W4DrqTj5RP00SSDRNB770FIoe1QE1Op4NcSrfeLpwh54HUJS716f4l5mOSYuvMp+zCbKzt8zKow== - dependencies: - "@polkadot/rpc-augment" "10.10.1" - "@polkadot/rpc-provider" "10.10.1" - "@polkadot/types" "10.10.1" - "@polkadot/util" "^12.5.1" - rxjs "^7.8.1" - tslib "^2.6.2" - -"@polkadot/rpc-provider@10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-10.10.1.tgz#387b1a915fa7b40d5f48a408c7b0ee5980f7ce07" - integrity sha512-VMDWoJgx6/mPHAOT66Sq+Jf2lJABfV/ZUIXtT2k8HjOndbm6oKrFqGEOSSLvB2q4olDee3FkFFxkyW1s6k4JaQ== - dependencies: - "@polkadot/keyring" "^12.5.1" - "@polkadot/types" "10.10.1" - "@polkadot/types-support" "10.10.1" - "@polkadot/util" "^12.5.1" - "@polkadot/util-crypto" "^12.5.1" - "@polkadot/x-fetch" "^12.5.1" - "@polkadot/x-global" "^12.5.1" - "@polkadot/x-ws" "^12.5.1" - eventemitter3 "^5.0.1" - mock-socket "^9.3.1" - nock "^13.3.4" - tslib "^2.6.2" - optionalDependencies: - "@substrate/connect" "0.7.33" - -"@polkadot/types-augment@10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-augment/-/types-augment-10.10.1.tgz#178ce0b22681109396fc681a027f35da7d757cef" - integrity sha512-XRHE75IocXfFE6EADYov3pqXCyBk5SWbiHoZ0+4WYWP9SwMuzsBaAy84NlhLBlkG3+ehIqi0HpAd/qrljJGZbg== - dependencies: - "@polkadot/types" "10.10.1" - "@polkadot/types-codec" "10.10.1" - "@polkadot/util" "^12.5.1" - tslib "^2.6.2" - -"@polkadot/types-codec@10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-codec/-/types-codec-10.10.1.tgz#61d28a461493bfb72606b4399078460969a049c8" - integrity sha512-ETPG0wzWzt/bDKRQmYbO7CLe/0lUt8VrG6/bECdv+Kye+8Qedba2LZyTWm/9f2ngms8TZ82yI8mPv/mozdtfnw== - dependencies: - "@polkadot/util" "^12.5.1" - "@polkadot/x-bigint" "^12.5.1" - tslib "^2.6.2" - -"@polkadot/types-create@10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-create/-/types-create-10.10.1.tgz#76f1729ef3f4699d99e708801312e43825368827" - integrity sha512-7OiLzd+Ter5zrpjP7fDwA1m89kd38VvMVixfOSv8x7ld2pDT+yyyKl14TCwRSWrKWCMtIb6M3iasPhq5cUa7cw== - dependencies: - "@polkadot/types-codec" "10.10.1" - "@polkadot/util" "^12.5.1" - tslib "^2.6.2" - -"@polkadot/types-known@10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-known/-/types-known-10.10.1.tgz#ccaa1364ea1073a95c5cb0d73258e154de5103d2" - integrity sha512-yRa1lbDRqg3V/zoa0vSwdGOiYTIWktILW8OfkaLDExTu0GZBSbVHZlLAta52XVpA9Zww7mrUUC9+iernOwk//w== - dependencies: - "@polkadot/networks" "^12.5.1" - "@polkadot/types" "10.10.1" - "@polkadot/types-codec" "10.10.1" - "@polkadot/types-create" "10.10.1" - "@polkadot/util" "^12.5.1" - tslib "^2.6.2" - -"@polkadot/types-support@10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/types-support/-/types-support-10.10.1.tgz#a22d319d4ba795e386000ddf6fdc8c55f9d81a9c" - integrity sha512-Cd2mwk9RG6LlX8X3H0bRY7wCTbZPqU3z38CMFhvNkFDAyjqKjtn8hpS4n8mMrZK2EwCs/MjQH1wb7rtFkaWmJw== - dependencies: - "@polkadot/util" "^12.5.1" - tslib "^2.6.2" - -"@polkadot/types@10.10.1": - version "10.10.1" - resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-10.10.1.tgz#4a55909ff35b0b568c0b1539ae923a259b0dba6a" - integrity sha512-Ben62P1tjYEhKag34GBGcLX6NqcFR1VD5nNbWaxgr+t36Jl/tlHs6P9DlbFqQP7Tt9FmGrAYY0m3oTkhjG1NzA== - dependencies: - "@polkadot/keyring" "^12.5.1" - "@polkadot/types-augment" "10.10.1" - "@polkadot/types-codec" "10.10.1" - "@polkadot/types-create" "10.10.1" - "@polkadot/util" "^12.5.1" - "@polkadot/util-crypto" "^12.5.1" - rxjs "^7.8.1" - tslib "^2.6.2" - -"@polkadot/util-crypto@12.5.1", "@polkadot/util-crypto@^12.5.1": - version "12.5.1" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-12.5.1.tgz#1753b23abfb9d72db950399ef65b0cbe5bef9f2f" - integrity sha512-Y8ORbMcsM/VOqSG3DgqutRGQ8XXK+X9M3C8oOEI2Tji65ZsXbh9Yh+ryPLM0oBp/9vqOXjkLgZJbbVuQceOw0A== - dependencies: - "@noble/curves" "^1.2.0" - "@noble/hashes" "^1.3.2" - "@polkadot/networks" "12.5.1" - "@polkadot/util" "12.5.1" - "@polkadot/wasm-crypto" "^7.2.2" - "@polkadot/wasm-util" "^7.2.2" - "@polkadot/x-bigint" "12.5.1" - "@polkadot/x-randomvalues" "12.5.1" - "@scure/base" "^1.1.3" - tslib "^2.6.2" - -"@polkadot/util@12.5.1", "@polkadot/util@^12.5.1": - version "12.5.1" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-12.5.1.tgz#f4e7415600b013d3b69527aa88904acf085be3f5" - integrity sha512-fDBZL7D4/baMG09Qowseo884m3QBzErGkRWNBId1UjWR99kyex+cIY9fOSzmuQxo6nLdJlLHw1Nz2caN3+Bq0A== - dependencies: - "@polkadot/x-bigint" "12.5.1" - "@polkadot/x-global" "12.5.1" - "@polkadot/x-textdecoder" "12.5.1" - "@polkadot/x-textencoder" "12.5.1" - "@types/bn.js" "^5.1.1" - bn.js "^5.2.1" - tslib "^2.6.2" - -"@polkadot/wasm-bridge@7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-bridge/-/wasm-bridge-7.2.2.tgz#957b82b17927fe080729e8930b5b5c554f77b8df" - integrity sha512-CgNENd65DVYtackOVXXRA0D1RPoCv5+77IdBCf7kNqu6LeAnR4nfTI6qjaApUdN1xRweUsQjSH7tu7VjkMOA0A== - dependencies: - "@polkadot/wasm-util" "7.2.2" - tslib "^2.6.1" - -"@polkadot/wasm-crypto-asmjs@7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-7.2.2.tgz#25243a4d5d8d997761141b616623cacff4329f13" - integrity sha512-wKg+cpsWQCTSVhjlHuNeB/184rxKqY3vaklacbLOMbUXieIfuDBav5PJdzS3yeiVE60TpYaHW4iX/5OYHS82gg== - dependencies: - tslib "^2.6.1" - -"@polkadot/wasm-crypto-init@7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-init/-/wasm-crypto-init-7.2.2.tgz#ffd105b87fc1b679c06c85c0848183c27bc539e3" - integrity sha512-vD4iPIp9x+SssUIWUenxWLPw4BVIwhXHNMpsV81egK990tvpyIxL205/EF5QRb1mKn8WfWcNFm5tYwwh9NdnnA== - dependencies: - "@polkadot/wasm-bridge" "7.2.2" - "@polkadot/wasm-crypto-asmjs" "7.2.2" - "@polkadot/wasm-crypto-wasm" "7.2.2" - "@polkadot/wasm-util" "7.2.2" - tslib "^2.6.1" - -"@polkadot/wasm-crypto-wasm@7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-7.2.2.tgz#9e49a1565bda2bc830708693b491b37ad8a2144d" - integrity sha512-3efoIB6jA3Hhv6k0YIBwCtlC8gCSWCk+R296yIXRLLr3cGN415KM/PO/d1JIXYI64lbrRzWRmZRhllw3jf6Atg== - dependencies: - "@polkadot/wasm-util" "7.2.2" - tslib "^2.6.1" - -"@polkadot/wasm-crypto@^7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-7.2.2.tgz#3c4b300c0997f4f7e2ddcdf8101d97fa1f5d1a7f" - integrity sha512-1ZY1rxUTawYm0m1zylvBMFovNIHYgG2v/XoASNp/EMG5c8FQIxCbhJRaTBA983GVq4lN/IAKREKEp9ZbLLqssA== - dependencies: - "@polkadot/wasm-bridge" "7.2.2" - "@polkadot/wasm-crypto-asmjs" "7.2.2" - "@polkadot/wasm-crypto-init" "7.2.2" - "@polkadot/wasm-crypto-wasm" "7.2.2" - "@polkadot/wasm-util" "7.2.2" - tslib "^2.6.1" - -"@polkadot/wasm-util@7.2.2", "@polkadot/wasm-util@^7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@polkadot/wasm-util/-/wasm-util-7.2.2.tgz#f8aa62eba9a35466aa23f3c5634f3e8dbd398bbf" - integrity sha512-N/25960ifCc56sBlJZ2h5UBpEPvxBmMLgwYsl7CUuT+ea2LuJW9Xh8VHDN/guYXwmm92/KvuendYkEUykpm/JQ== - dependencies: - tslib "^2.6.1" - -"@polkadot/x-bigint@12.5.1", "@polkadot/x-bigint@^12.5.1": - version "12.5.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-bigint/-/x-bigint-12.5.1.tgz#0a6a3a34fae51468e7b02b42e0ff0747fd88a80a" - integrity sha512-Fw39eoN9v0sqxSzfSC5awaDVdzojIiE7d1hRSQgVSrES+8whWvtbYMR0qwbVhTuW7DvogHmye41P9xKMlXZysg== - dependencies: - "@polkadot/x-global" "12.5.1" - tslib "^2.6.2" - -"@polkadot/x-fetch@^12.5.1": - version "12.5.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-fetch/-/x-fetch-12.5.1.tgz#41532d1324cef56a28c31490ac81062d487b16fb" - integrity sha512-Bc019lOKCoQJrthiS+H3LwCahGtl5tNnb2HK7xe3DBQIUx9r2HsF/uEngNfMRUFkUYg5TPCLFbEWU8NIREBS1A== - dependencies: - "@polkadot/x-global" "12.5.1" - node-fetch "^3.3.2" - tslib "^2.6.2" - -"@polkadot/x-global@12.5.1", "@polkadot/x-global@^12.5.1": - version "12.5.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-global/-/x-global-12.5.1.tgz#947bb90e0c46c853ffe216dd6dcb6847d5c18a98" - integrity sha512-6K0YtWEg0eXInDOihU5aSzeb1t9TiDdX9ZuRly+58ALSqw5kPZYmQLbzE1d8HWzyXRXK+YH65GtLzfMGqfYHmw== - dependencies: - tslib "^2.6.2" - -"@polkadot/x-randomvalues@12.5.1": - version "12.5.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-randomvalues/-/x-randomvalues-12.5.1.tgz#b30c6fa8749f5776f1d8a78b6edddb9b0f9c2853" - integrity sha512-UsMb1d+77EPNjW78BpHjZLIm4TaIpfqq89OhZP/6gDIoS2V9iE/AK3jOWKm1G7Y2F8XIoX1qzQpuMakjfagFoQ== - dependencies: - "@polkadot/x-global" "12.5.1" - tslib "^2.6.2" - -"@polkadot/x-textdecoder@12.5.1": - version "12.5.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-textdecoder/-/x-textdecoder-12.5.1.tgz#8d89d2b5efbffb2550a48f8afb4a834e1d8d4f6e" - integrity sha512-j2YZGWfwhMC8nHW3BXq10fAPY02ObLL/qoTjCMJ1Cmc/OGq18Ep7k9cXXbjFAq3wf3tUUewt/u/hStKCk3IvfQ== - dependencies: - "@polkadot/x-global" "12.5.1" - tslib "^2.6.2" - -"@polkadot/x-textencoder@12.5.1": - version "12.5.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-textencoder/-/x-textencoder-12.5.1.tgz#9104e37a60068df2fbf57c81a7ce48669430c76c" - integrity sha512-1JNNpOGb4wD+c7zFuOqjibl49LPnHNr4rj4s3WflLUIZvOMY6euoDuN3ISjQSHCLlVSoH0sOCWA3qXZU4bCTDQ== - dependencies: - "@polkadot/x-global" "12.5.1" - tslib "^2.6.2" - -"@polkadot/x-ws@^12.5.1": - version "12.5.1" - resolved "https://registry.yarnpkg.com/@polkadot/x-ws/-/x-ws-12.5.1.tgz#ff9fc78ef701e18d765443779ab95296a406138c" - integrity sha512-efNMhB3Lh6pW2iTipMkqwrjpuUtb3EwR/jYZftiIGo5tDPB7rqoMOp9s6KRFJEIUfZkLnMUtbkZ5fHzUJaCjmQ== - dependencies: - "@polkadot/x-global" "12.5.1" - tslib "^2.6.2" - ws "^8.14.1" - -"@scure/base@^1.1.3": - version "1.1.3" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.3.tgz#8584115565228290a6c6c4961973e0903bb3df2f" - integrity sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q== - -"@substrate/connect-extension-protocol@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@substrate/connect-extension-protocol/-/connect-extension-protocol-1.0.1.tgz#fa5738039586c648013caa6a0c95c43265dbe77d" - integrity sha512-161JhCC1csjH3GE5mPLEd7HbWtwNSPJBg3p1Ksz9SFlTzj/bgEwudiRN2y5i0MoLGCIJRYKyKGMxVnd29PzNjg== - -"@substrate/connect@0.7.33": - version "0.7.33" - resolved "https://registry.yarnpkg.com/@substrate/connect/-/connect-0.7.33.tgz#6fa309557b5b45cb918f5f4fe25a356384de9808" - integrity sha512-1B984/bmXVQvTT9oV3c3b7215lvWmulP9rfP3T3Ri+OU3uIsyCzYw0A+XG6J8/jgO2FnroeNIBWlgoLaUM1uzw== - dependencies: - "@substrate/connect-extension-protocol" "^1.0.1" - smoldot "2.0.1" - -"@substrate/ss58-registry@^1.43.0": - version "1.43.0" - resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.43.0.tgz#93108e45cb7ef6d82560c153e3692c2aa1c711b3" - integrity sha512-USEkXA46P9sqClL7PZv0QFsit4S8Im97wchKG0/H/9q3AT/S76r40UHfCr4Un7eBJPE23f7fU9BZ0ITpP9MCsA== - -"@tsconfig/node10@^1.0.7": - version "1.0.9" - resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" - integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== - -"@tsconfig/node12@^1.0.7": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" - integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== - -"@tsconfig/node14@^1.0.0": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" - integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== - -"@tsconfig/node16@^1.0.2": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" - integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== - -"@types/bn.js@^5.1.1": - version "5.1.2" - resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.2.tgz#162f5238c46f4bcbac07a98561724eca1fcf0c5e" - integrity sha512-dkpZu0szUtn9UXTmw+e0AJFd4D2XAxDnsCLdc05SfqpqzPEBft8eQr8uaFitfo/dUUOZERaLec2hHMG87A4Dxg== - dependencies: - "@types/node" "*" - -"@types/node@*", "@types/node@^20.4.2": - version "20.8.6" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.6.tgz#0dbd4ebcc82ad0128df05d0e6f57e05359ee47fa" - integrity sha512-eWO4K2Ji70QzKUqRy6oyJWUeB7+g2cRagT3T/nxYibYcT4y2BDL8lqolRXjTHmkZCdJfIPaY73KbJAZmcryxTQ== - dependencies: - undici-types "~5.25.1" - -acorn-walk@^8.1.1: - version "8.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" - integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== - -acorn@^8.4.1: - version "8.10.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" - integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== - -arg@^4.1.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" - integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== - -bn.js@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" - integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== - -create-require@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" - integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== - -data-uri-to-buffer@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e" - integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== - -debug@^4.1.0: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== - -eventemitter3@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" - integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== - -fetch-blob@^3.1.2, fetch-blob@^3.1.4: - version "3.2.0" - resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9" - integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ== - dependencies: - node-domexception "^1.0.0" - web-streams-polyfill "^3.0.3" - -formdata-polyfill@^4.0.10: - version "4.0.10" - resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423" - integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g== - dependencies: - fetch-blob "^3.1.2" - -json-stringify-safe@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== - -lodash@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -make-error@^1.1.1: - version "1.3.6" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" - integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== - -mock-socket@^9.3.1: - version "9.3.1" - resolved "https://registry.yarnpkg.com/mock-socket/-/mock-socket-9.3.1.tgz#24fb00c2f573c84812aa4a24181bb025de80cc8e" - integrity sha512-qxBgB7Qa2sEQgHFjj0dSigq7fX4k6Saisd5Nelwp2q8mlbAFh5dHV9JTTlF8viYJLSSWgMCZFUom8PJcMNBoJw== - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -nock@^13.3.4: - version "13.3.4" - resolved "https://registry.yarnpkg.com/nock/-/nock-13.3.4.tgz#4ed3ed1465a75c87833044a881dbdd6546337e8d" - integrity sha512-DDpmn5oLEdCTclEqweOT4U7bEpuoifBMFUXem9sA4turDAZ5tlbrEoWqCorwXey8CaAw44mst5JOQeVNiwtkhw== - dependencies: - debug "^4.1.0" - json-stringify-safe "^5.0.1" - lodash "^4.17.21" - propagate "^2.0.0" - -node-domexception@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" - integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== - -node-fetch@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b" - integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA== - dependencies: - data-uri-to-buffer "^4.0.0" - fetch-blob "^3.1.4" - formdata-polyfill "^4.0.10" - -propagate@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/propagate/-/propagate-2.0.1.tgz#40cdedab18085c792334e64f0ac17256d38f9a45" - integrity sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag== - -rxjs@^7.8.1: - version "7.8.1" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" - integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== - dependencies: - tslib "^2.1.0" - -smoldot@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/smoldot/-/smoldot-2.0.1.tgz#c899cbb0827a010d3ca7944034f081786f533a4d" - integrity sha512-Wqw2fL/sELQByLSeeTX1Z/d0H4McmphPMx8vh6UZS/bIIDx81oU7s/drmx2iL/ME36uk++YxpRuJey8/MOyfOA== - dependencies: - ws "^8.8.1" - -ts-node@^10.9.1: - version "10.9.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" - integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== - dependencies: - "@cspotcode/source-map-support" "^0.8.0" - "@tsconfig/node10" "^1.0.7" - "@tsconfig/node12" "^1.0.7" - "@tsconfig/node14" "^1.0.0" - "@tsconfig/node16" "^1.0.2" - acorn "^8.4.1" - acorn-walk "^8.1.1" - arg "^4.1.0" - create-require "^1.1.0" - diff "^4.0.1" - make-error "^1.1.1" - v8-compile-cache-lib "^3.0.1" - yn "3.1.1" - -tslib@^2.1.0, tslib@^2.6.1, tslib@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" - integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== - -typescript@^5.1.6: - version "5.2.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" - integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== - -undici-types@~5.25.1: - version "5.25.3" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.25.3.tgz#e044115914c85f0bcbb229f346ab739f064998c3" - integrity sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA== - -v8-compile-cache-lib@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" - integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== - -web-streams-polyfill@^3.0.3: - version "3.2.1" - resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" - integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== - -ws@^8.14.1, ws@^8.8.1: - version "8.14.2" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f" - integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g== - -yn@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" - integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== diff --git a/tests/package.json b/tests/package.json index 01ca1ad5e8..c669f54d63 100644 --- a/tests/package.json +++ b/tests/package.json @@ -130,7 +130,8 @@ "polkadot-types-from-defs": "ts-node --esm ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .", "polkadot-types-from-chain": "ts-node --esm ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .", "polkadot-types": "echo \"export default {}\" > src/interfaces/lookup.ts && yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain", - "generateEnv": "ts-node --esm ./src/generateEnv.ts" + "generateEnv": "ts-node --esm ./src/generateEnv.ts", + "propose-upgrade": "ts-node --esm ./src/proposeupgrade.ts" }, "author": "", "license": "SEE LICENSE IN ../LICENSE", @@ -159,4 +160,4 @@ }, "type": "module", "packageManager": "yarn@3.6.1" -} \ No newline at end of file +} diff --git a/tests/src/proposeupgrade.ts b/tests/src/proposeupgrade.ts new file mode 100644 index 0000000000..a008f7ec40 --- /dev/null +++ b/tests/src/proposeupgrade.ts @@ -0,0 +1,39 @@ +import {ApiPromise, WsProvider} from '@polkadot/api'; +import {blake2AsHex} from '@polkadot/util-crypto'; +import {readFileSync} from 'fs'; + +async function main() { + const networkUrl = process.argv[2]; + const wasmFile = process.argv[3]; + + const wsProvider = new WsProvider(networkUrl); + const api = await ApiPromise.create({provider: wsProvider}); + + const wasmFileBytes = readFileSync(wasmFile); + const wasmFileHash = blake2AsHex(wasmFileBytes, 256); + + const authorizeUpgrade = api.tx.parachainSystem.authorizeUpgrade(wasmFileHash, true); + + const councilMembers = (await api.query.council.members()).toJSON() as any[]; + const councilProposalThreshold = Math.floor(councilMembers.length / 2) + 1; + + const democracyProposal = api.tx.democracy.externalProposeDefault({ + Inline: authorizeUpgrade.method.toHex(), + }); + + const councilProposal = api.tx.council.propose( + councilProposalThreshold, + democracyProposal, + democracyProposal.method.encodedLength, + ); + + const encodedCall = councilProposal.method.toHex(); + + console.log('-----------------'); + console.log('Upgrade Proposal: ', `https://polkadot.js.org/apps/?rpc=${networkUrl}#/extrinsics/decode/${encodedCall}`); + console.log('-----------------'); + + await api.disconnect(); +} + +await main();