Fixes for examples (#1408)
* Add various fixes for the examples * Add the workaround for proposals for `impl_version` 94 * TODO: fix `toPromise` issue for queries with RxJS
This commit is contained in:
committed by
Jaco Greeff
parent
7b56a52fc3
commit
e7f488ed89
@@ -9,7 +9,7 @@ async function main () {
|
||||
const api = await ApiPromise.create();
|
||||
|
||||
// Subscribe to chain updates and log the current block number on update.
|
||||
const unsubscribe = await api.rpc.chain.subscribeNewHead((header) => {
|
||||
const unsubscribe = await api.rpc.chain.subscribeNewHeads((header) => {
|
||||
console.log(`Chain is at block: #${header.number}`);
|
||||
});
|
||||
|
||||
|
||||
+1
-2
@@ -10,8 +10,7 @@
|
||||
"start": "node index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@polkadot/api": "0.80.1",
|
||||
"@polkadot/keyring": "^0.93.1"
|
||||
"@polkadot/api": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^2.6.2"
|
||||
|
||||
@@ -25,9 +25,11 @@ async function main () {
|
||||
const keyring = testKeyring.default();
|
||||
const adminPair = keyring.getPair(adminId.toString());
|
||||
|
||||
// Retrieve the runtime to upgrade to
|
||||
// Retrieve the runtime to upgrade
|
||||
const code = fs.readFileSync('./test.wasm').toString('hex');
|
||||
const proposal = api.tx.consensus.setCode(`0x${code}`);
|
||||
const proposal = api.tx.system && api.tx.system.setCode
|
||||
? api.tx.system.setCode(`0x${code}`) // For newer versions of Substrate
|
||||
: api.tx.consensus.setCode(`0x${code}`); // For previous versions
|
||||
|
||||
console.log(`Upgrading from ${adminId}, ${code.length / 2} bytes`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user