diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 575653128e..73824afaf6 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -23,7 +23,9 @@ - [Listen to balance change](examples/promise/03_listen_to_balance_change/README.md) - [Read chain state](examples/promise/05_read_storage/README.md) - [Make a transfer](examples/promise/07_transfer_dots/README.md) - - [Display system events](examples/promise/08_system_events/README.md) + - [Display system events](examples/promise/08_system_events/README.md)( + - [Transaction with events](examples/promise/09_transfer_events/README.md) + - [Upgrade with upgradeKey](examples/promise/10_upgrade_chain/README.md) diff --git a/docs/examples/deprecated-rpc/01_simple_connect/README.md b/docs/examples/deprecated-rpc/01_simple_connect/README.md deleted file mode 100644 index 5b207a4ab6..0000000000 --- a/docs/examples/deprecated-rpc/01_simple_connect/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Simple Connect - -The following example shows how to instantiate a Polkadot API object and use it to connect to a node. - -[include](index.js) diff --git a/docs/examples/deprecated-rpc/01_simple_connect/index.html b/docs/examples/deprecated-rpc/01_simple_connect/index.html deleted file mode 100644 index 5148c13332..0000000000 --- a/docs/examples/deprecated-rpc/01_simple_connect/index.html +++ /dev/null @@ -1,472 +0,0 @@ - - - - - - - Simple connect · Polkadot API Book - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - -
- -
- -
- - - - - - - - -
-
- -
-
- -
- -

Simple Connect

-

The following example shows how to instantiate a Polkadot API object and use it to connect to a node.

-
const Rpc = require('@polkadot/rpc-core').default;
-const WsProvider = require('@polkadot/rpc-provider/ws').default;
-const provider = new WsProvider('ws://127.0.0.1:9944');
-const api = new Rpc(provider);
-
-async function getChain () {
-  return api.system.chain();
-}
-
-async function main () {
-  const chain = await getChain();
-
-  console.log('You are connected to chain:', chain);
-}
-
-main().finally(_ => process.exit());
-
- - -
- -
-
-
- -

results matching ""

-
    - -
    -
    - -

    No results matching ""

    - -
    -
    -
    - -
    -
    - -
    - - - - - - - - - - - - - - -
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/examples/deprecated-rpc/01_simple_connect/index.js b/docs/examples/deprecated-rpc/01_simple_connect/index.js deleted file mode 100755 index 166b720e7f..0000000000 --- a/docs/examples/deprecated-rpc/01_simple_connect/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const Rpc = require('@polkadot/rpc-core').default; -const WsProvider = require('@polkadot/rpc-provider/ws').default; -const provider = new WsProvider('ws://127.0.0.1:9944'); -const api = new Rpc(provider); - -async function getChain () { - return api.system.chain(); -} - -async function main () { - const chain = await getChain(); - - console.log('You are connected to chain:', chain); -} - -main().finally(_ => process.exit()); diff --git a/docs/examples/deprecated-rpc/01_simple_connect/package.json b/docs/examples/deprecated-rpc/01_simple_connect/package.json deleted file mode 100644 index a6bad168b0..0000000000 --- a/docs/examples/deprecated-rpc/01_simple_connect/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "01_simple_connect", - "version": "0.1.0", - "description": "Example showing how to connect using a WebSocket", - "main": "index.js", - "author": "chevdor", - "license": "MIT", - "scripts": { - "clean": "rimraf node_modules", - "start": "node index.js" - }, - - "dependencies": { - "@polkadot/rpc-core": "^0.31.1", - "@polkadot/rpc-provider": "^0.31.1" - }, - "devDependencies": { - "rimraf": "^2.6.2" - } -} diff --git a/docs/examples/deprecated-rpc/02_listen_to_blocks/README.md b/docs/examples/deprecated-rpc/02_listen_to_blocks/README.md deleted file mode 100644 index 3c78aca531..0000000000 --- a/docs/examples/deprecated-rpc/02_listen_to_blocks/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# Listen to new blocks - -This example shows how to subscribe to new blocks. - -It displays the block number every time a new block is seen by the node you are connected to. - -NOTE: The example runs until you stop it with CTRL+C - -[include](index.js) diff --git a/docs/examples/deprecated-rpc/02_listen_to_blocks/index.html b/docs/examples/deprecated-rpc/02_listen_to_blocks/index.html deleted file mode 100644 index caf97d37c6..0000000000 --- a/docs/examples/deprecated-rpc/02_listen_to_blocks/index.html +++ /dev/null @@ -1,479 +0,0 @@ - - - - - - - Listen to blocks · Polkadot API Book - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - - - - - -
    - -
    - -
    - - - - - - - - -
    -
    - -
    -
    - -
    - -

    Listen to new blocks

    -

    This example shows how to subscribe to new blocks.

    -

    It displays the block number every time a new block is seen by the node you are connected to.

    -

    NOTE: The example runs until you stop it with CTRL+C

    -
    const Rpc = require('@polkadot/rpc-core').default;
    -const WsProvider = require('@polkadot/rpc-provider/ws').default;
    -const provider = new WsProvider('ws://127.0.0.1:9944');
    -const api = new Rpc(provider);
    -
    -api.chain
    -  .newHead((error, header) => {
    -    if (error) {
    -      console.error('error:', error);
    -    }
    -
    -    console.log(`best #${header.blockNumber.toString()}`);
    -  })
    -  .then((subscriptionId) => {
    -    console.log(`subscriptionId: ${subscriptionId}`);
    -    // id for the subscription, can unsubscribe via
    -    // api.chain.newHead.unsubscribe(subscriptionId);
    -  })
    -  .catch((error) => {
    -    console.error('error subscribing:', error);
    -  });
    -
    - - -
    - -
    -
    -
    - -

    results matching ""

    -
      - -
      -
      - -

      No results matching ""

      - -
      -
      -
      - -
      -
      - -
      - - - - - - - - - - - - - - -
      - - -
      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/examples/deprecated-rpc/02_listen_to_blocks/index.js b/docs/examples/deprecated-rpc/02_listen_to_blocks/index.js deleted file mode 100755 index e27fa66a53..0000000000 --- a/docs/examples/deprecated-rpc/02_listen_to_blocks/index.js +++ /dev/null @@ -1,21 +0,0 @@ -const Rpc = require('@polkadot/rpc-core').default; -const WsProvider = require('@polkadot/rpc-provider/ws').default; -const provider = new WsProvider('ws://127.0.0.1:9944'); -const api = new Rpc(provider); - -api.chain - .newHead((error, header) => { - if (error) { - console.error('error:', error); - } - - console.log(`best #${header.blockNumber.toString()}`); - }) - .then((subscriptionId) => { - console.log(`subscriptionId: ${subscriptionId}`); - // id for the subscription, can unsubscribe via - // api.chain.newHead.unsubscribe(subscriptionId); - }) - .catch((error) => { - console.error('error subscribing:', error); - }); diff --git a/docs/examples/deprecated-rpc/03_listen_to_balance_change/README.md b/docs/examples/deprecated-rpc/03_listen_to_balance_change/README.md deleted file mode 100644 index 0f071fe9aa..0000000000 --- a/docs/examples/deprecated-rpc/03_listen_to_balance_change/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Listen to balance changes - -This example shows how to instantiate a Polkadot API object and use it to connect to a node. - -[include](index.js) diff --git a/docs/examples/deprecated-rpc/03_listen_to_balance_change/index.html b/docs/examples/deprecated-rpc/03_listen_to_balance_change/index.html deleted file mode 100644 index 3f2bb8dc97..0000000000 --- a/docs/examples/deprecated-rpc/03_listen_to_balance_change/index.html +++ /dev/null @@ -1,474 +0,0 @@ - - - - - - - Listen to balance change · Polkadot API Book - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      -
      - - - - - - - - -
      - -
      - -
      - - - - - - - - -
      -
      - -
      -
      - -
      - -

      Listen to balance changes

      -

      This example shows how to instantiate a Polkadot API object and use it to connect to a node.

      -
      const BN = require('bn.js');
      -const Rpc = require('@polkadot/rpc-core').default;
      -const WsProvider = require('@polkadot/rpc-provider/ws').default;
      -const storage = require('@polkadot/storage').default;
      -const provider = new WsProvider('ws://127.0.0.1:9944');
      -const api = new Rpc(provider);
      -
      -const Alice = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ';
      -
      -console.log('You may leave this example running and start example 06 or send DOTs to ' + Alice);
      -
      -api.state
      -  .storage([[storage.staking.public.freeBalanceOf, Alice]], (_, values) => {
      -    console.log(`Balance of ${Alice}: ${new BN(values[0]).toString(10)} DOTs`);
      -  })
      -  .then((subscriptionId) => {
      -    console.log('Balance changes subscription id:', subscriptionId);
      -  });
      -
      - - -
      - -
      -
      -
      - -

      results matching ""

      -
        - -
        -
        - -

        No results matching ""

        - -
        -
        -
        - -
        -
        - -
        - - - - - - - - - - - - - - -
        - - -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/examples/deprecated-rpc/03_listen_to_balance_change/index.js b/docs/examples/deprecated-rpc/03_listen_to_balance_change/index.js deleted file mode 100755 index 7ac81fc77b..0000000000 --- a/docs/examples/deprecated-rpc/03_listen_to_balance_change/index.js +++ /dev/null @@ -1,18 +0,0 @@ -const BN = require('bn.js'); -const Rpc = require('@polkadot/rpc-core').default; -const WsProvider = require('@polkadot/rpc-provider/ws').default; -const storage = require('@polkadot/storage').default; -const provider = new WsProvider('ws://127.0.0.1:9944'); -const api = new Rpc(provider); - -const Alice = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ'; - -console.log('You may leave this example running and start example 06 or send DOTs to ' + Alice); - -api.state - .storage([[storage.staking.public.freeBalanceOf, Alice]], (_, values) => { - console.log(`Balance of ${Alice}: ${new BN(values[0]).toString(10)} DOTs`); - }) - .then((subscriptionId) => { - console.log('Balance changes subscription id:', subscriptionId); - }); diff --git a/docs/examples/deprecated-rpc/03_listen_to_balance_change/package.json b/docs/examples/deprecated-rpc/03_listen_to_balance_change/package.json deleted file mode 100644 index a298c02816..0000000000 --- a/docs/examples/deprecated-rpc/03_listen_to_balance_change/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "03_listen_to_balance_change", - "version": "0.1.0", - "description": "Example showing how to subscribe to balance change", - "main": "index.js", - "author": "chevdor", - "license": "MIT", - "scripts": { - "clean": "rimraf node_modules", - "start": "node index.js" - }, - "dependencies": { - "@polkadot/rpc-core": "^0.31.1", - "bn.js": "^4.11.8" - }, - "devDependencies": { - "rimraf": "^2.6.2" - } -} diff --git a/docs/examples/deprecated-rpc/04_generate_account/README.md b/docs/examples/deprecated-rpc/04_generate_account/README.md deleted file mode 100644 index 29e72fd50a..0000000000 --- a/docs/examples/deprecated-rpc/04_generate_account/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Generate accounts - -If you want to develop a wallet or a program that will accept payments in DOTs, you likely will need to generate addresses. This sample shows you how to generate accounts in several ways. - -[include](index.js) diff --git a/docs/examples/deprecated-rpc/04_generate_account/index.html b/docs/examples/deprecated-rpc/04_generate_account/index.html deleted file mode 100644 index ac9c87e5d0..0000000000 --- a/docs/examples/deprecated-rpc/04_generate_account/index.html +++ /dev/null @@ -1,488 +0,0 @@ - - - - - - - Generate Accounts · Polkadot API Book - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        -
        - - - - - - - - -
        - -
        - -
        - - - - - - - - -
        -
        - -
        -
        - -
        - -

        Generate accounts

        -

        If you want to develop a wallet or a program that will accept payments in DOTs, you likely will need to generate addresses. This sample shows you how to generate accounts in several ways.

        -
        const crypto = require('crypto');
        -const Keyring = require('@polkadot/util-keyring').default;
        -const u8aToHex = require('@polkadot/util/u8a/toHex').default;
        -const Encoder = new TextEncoder(); // always utf-8
        -
        -// A fixed seed from an array
        -const SEED1 = new Uint8Array([
        -  1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
        -  22, 23, 24, 25, 26, 27, 28, 29, 30, 0, 0
        -]);
        -
        -// A fixed seed from a 32 chars string
        -const SEED2 = Encoder.encode('correct horse battery and staple');
        -
        -const keyring = new Keyring();
        -const pair1 = keyring.addFromSeed(SEED1);
        -const pair2 = keyring.addFromSeed(SEED2);
        -
        -console.log('Deterministic addresses (same for each run):');
        -console.log(`Address 1\t ${pair1.address()}\t Seed: ${u8aToHex(SEED1)}`);
        -console.log(`Address 2\t ${pair2.address()}\t Seed: ${u8aToHex(SEED2)}`);
        -
        -// A random seed
        -const SEED = new Uint8Array(32);
        -
        -console.log('Random Addresses (random for each run):');
        -
        -for (var i = 3; i < 13; i++) {
        -  Buffer.from(crypto.randomFillSync(SEED));
        -  const pair3 = keyring.addFromSeed(SEED);
        -  console.log(`Address ${i}\t ${pair3.address()}\t Seed: ${u8aToHex(SEED)}`);
        -}
        -
        - - -
        - -
        -
        -
        - -

        results matching ""

        -
          - -
          -
          - -

          No results matching ""

          - -
          -
          -
          - -
          -
          - -
          - - - - - - - - - - - - - - -
          - - -
          - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/examples/deprecated-rpc/04_generate_account/index.js b/docs/examples/deprecated-rpc/04_generate_account/index.js deleted file mode 100755 index a95389f8ef..0000000000 --- a/docs/examples/deprecated-rpc/04_generate_account/index.js +++ /dev/null @@ -1,32 +0,0 @@ -const crypto = require('crypto'); -const Keyring = require('@polkadot/keyring').default; -const u8aToHex = require('@polkadot/util/u8a/toHex').default; -const Encoder = new TextEncoder(); // always utf-8 - -// A fixed seed from an array -const SEED1 = new Uint8Array([ - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 0, 0 -]); - -// A fixed seed from a 32 chars string -const SEED2 = Encoder.encode('correct horse battery and staple'); - -const keyring = new Keyring(); -const pair1 = keyring.addFromSeed(SEED1); -const pair2 = keyring.addFromSeed(SEED2); - -console.log('Deterministic addresses (same for each run):'); -console.log(`Address 1\t ${pair1.address()}\t Seed: ${u8aToHex(SEED1)}`); -console.log(`Address 2\t ${pair2.address()}\t Seed: ${u8aToHex(SEED2)}`); - -// A random seed -const SEED = new Uint8Array(32); - -console.log('Random Addresses (random for each run):'); - -for (var i = 3; i < 13; i++) { - Buffer.from(crypto.randomFillSync(SEED)); - const pair3 = keyring.addFromSeed(SEED); - console.log(`Address ${i}\t ${pair3.address()}\t Seed: ${u8aToHex(SEED)}`); -} diff --git a/docs/examples/deprecated-rpc/04_generate_account/package.json b/docs/examples/deprecated-rpc/04_generate_account/package.json deleted file mode 100644 index 0ad14999b5..0000000000 --- a/docs/examples/deprecated-rpc/04_generate_account/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "04_generate_account", - "version": "0.1.0", - "description": "Example showing how to connect using a WebSocket", - "main": "index.js", - "author": "chevdor", - "license": "MIT", - "scripts": { - "clean": "rimraf node_modules", - "start": "node index.js" - }, - "dependencies": { - "@polkadot/rpc-core": "^0.31.1", - "@polkadot/util": "0.30.3", - "@polkadot/keyring": "0.30.3" - }, - "devDependencies": { - "rimraf": "2.6.2" - } -} diff --git a/docs/examples/deprecated-rpc/05_read_storage/README.md b/docs/examples/deprecated-rpc/05_read_storage/README.md deleted file mode 100644 index 91e8164e41..0000000000 --- a/docs/examples/deprecated-rpc/05_read_storage/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Read storage - -Many important variables are available through the storage API. This example shows how to call a few of those APIs. - -[include](index.js) diff --git a/docs/examples/deprecated-rpc/05_read_storage/index.html b/docs/examples/deprecated-rpc/05_read_storage/index.html deleted file mode 100644 index 7f54576f22..0000000000 --- a/docs/examples/deprecated-rpc/05_read_storage/index.html +++ /dev/null @@ -1,488 +0,0 @@ - - - - - - - Read Storage · Polkadot API Book - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          -
          - - - - - - - - -
          - -
          - -
          - - - - - - - - -
          -
          - -
          -
          - -
          - -

          Read storage

          -

          Many important variables are available through the storage API. This example shows how to call a few of those APIs.

          -
          const BN = require('bn.js');
          -const Rpc = require('@polkadot/rpc-core').default;
          -const WsProvider = require('@polkadot/rpc-provider/ws').default;
          -const storage = require('@polkadot/storage').default;
          -
          -const provider = new WsProvider('ws://127.0.0.1:9944');
          -const api = new Rpc(provider);
          -
          -async function getAccountIndex (address) {
          -  return api.state.getStorage([storage.system.public.accountIndexOf, address]);
          -}
          -
          -async function getValidators () {
          -  return api.state.getStorage([storage.session.public.validators]);
          -}
          -
          -async function getBlockPeriod () {
          -  return api.state.getStorage([storage.timestamp.public.blockPeriod]);
          -}
          -
          -async function main () {
          -  const address = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ';
          -  const validators = await getValidators();
          -  const index = await getAccountIndex(address);
          -  const blockPeriod = await getBlockPeriod();
          -
          -  console.log(`BlockPeriod: ${new BN(blockPeriod).toString(10)} seconds`);
          -  console.log(`Account Index of ${address}: ${index.toString(10)}`);
          -  console.log('Current validators', validators);
          -}
          -
          -main().finally(_ => process.exit());
          -
          - - -
          - -
          -
          -
          - -

          results matching ""

          -
            - -
            -
            - -

            No results matching ""

            - -
            -
            -
            - -
            -
            - -
            - - - - - - - - - - - - - - -
            - - -
            - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/examples/deprecated-rpc/05_read_storage/index.js b/docs/examples/deprecated-rpc/05_read_storage/index.js deleted file mode 100755 index 23e3250ea1..0000000000 --- a/docs/examples/deprecated-rpc/05_read_storage/index.js +++ /dev/null @@ -1,32 +0,0 @@ -const BN = require('bn.js'); -const Rpc = require('@polkadot/rpc-core').default; -const WsProvider = require('@polkadot/rpc-provider/ws').default; -const storage = require('@polkadot/storage').default; - -const provider = new WsProvider('ws://127.0.0.1:9944'); -const api = new Rpc(provider); - -async function getAccountIndex (address) { - return api.state.getStorage([storage.system.public.accountIndexOf, address]); -} - -async function getValidators () { - return api.state.getStorage([storage.session.public.validators]); -} - -async function getBlockPeriod () { - return api.state.getStorage([storage.timestamp.public.blockPeriod]); -} - -async function main () { - const address = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ'; - const validators = await getValidators(); - const index = await getAccountIndex(address); - const blockPeriod = await getBlockPeriod(); - - console.log(`BlockPeriod: ${new BN(blockPeriod).toString(10)} seconds`); - console.log(`Account Index of ${address}: ${index.toString(10)}`); - console.log('Current validators', validators); -} - -main().finally(_ => process.exit()); diff --git a/docs/examples/deprecated-rpc/05_read_storage/package.json b/docs/examples/deprecated-rpc/05_read_storage/package.json deleted file mode 100644 index abb7ca6b75..0000000000 --- a/docs/examples/deprecated-rpc/05_read_storage/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "04_read_storage", - "version": "0.1.0", - "description": "Example showing how to transfer DOTs", - "main": "index.js", - "author": "chevdor", - "license": "MIT", - "scripts": { - "clean": "rimraf node_modules", - "start": "node index.js" - }, - "dependencies": { - "@polkadot/rpc-core": "^0.31.1", - "bn.js": "^4.11.8" - }, - "devDependencies": { - "rimraf": "2.6.2" - } -} diff --git a/docs/examples/deprecated-rpc/06_craft_extrinsic/README.md b/docs/examples/deprecated-rpc/06_craft_extrinsic/README.md deleted file mode 100644 index 0d7c09194b..0000000000 --- a/docs/examples/deprecated-rpc/06_craft_extrinsic/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Craft Extrinsic - -In the current version, crafting an extrinsic is a rather cumbersome process. This sample guides you through it and shows how to tranfer DOTs from one an account to another. - -[include](index.js) diff --git a/docs/examples/deprecated-rpc/06_craft_extrinsic/index.html b/docs/examples/deprecated-rpc/06_craft_extrinsic/index.html deleted file mode 100644 index d6f6240a2b..0000000000 --- a/docs/examples/deprecated-rpc/06_craft_extrinsic/index.html +++ /dev/null @@ -1,512 +0,0 @@ - - - - - - - Craft Extrinsic · Polkadot API Book - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            -
            - - - - - - - - -
            - -
            - -
            - - - - - - - - -
            -
            - -
            -
            - -
            - -

            Craft Extrinsic

            -

            In the current version, crafting an extrinsic is a rather cumbersome process. This sample guides you through it and shows how to tranfer DOTs from one an account to another.

            -
            const BN = require('bn.js');
            -const Rpc = require('@polkadot/rpc-core').default;
            -const WsProvider = require('@polkadot/rpc-provider/ws').default;
            -const extrinsics = require('@polkadot/extrinsics').default;
            -const encodeExtrinsic = require('@polkadot/extrinsics/codec/encode').default;
            -const encodeLength = require('@polkadot/extrinsics/codec/encode/length').default;
            -const Keyring = require('@polkadot/util-keyring').default;
            -const storage = require('@polkadot/storage').default;
            -
            -const Encoder = new TextEncoder();
            -const keyring = new Keyring();
            -const provider = new WsProvider('ws://127.0.0.1:9944');
            -const api = new Rpc(provider);
            -
            -async function getAccountIndex (address) {
            -  return api.state.getStorage([storage.system.public.accountIndexOf, address]);
            -}
            -
            -async function transfer (keyRingFrom, addressTo, amount) {
            -  const accountIndex = await getAccountIndex(keyRingFrom.address());
            -
            -  console.log(`Current accountIndex: ${accountIndex}`);
            -
            -  // encode the call for signing
            -  const message = encodeExtrinsic(
            -    keyRingFrom.publicKey(),
            -    accountIndex,
            -    extrinsics.staking.public.transfer,
            -    [addressTo, amount]
            -  );
            -
            -  // get the signature
            -  const signature = keyRingFrom.sign(message);
            -
            -  // encode the extrinsic for submission, adding the length (prefix) and the
            -  // signature (postfix)Rödl
            -  const encoded = encodeLength(
            -    // When working with publicKeys, the prefix is 0xff for poc-2+
            -    new Uint8Array([0xff]),
            -    message,
            -    signature
            -  );
            -
            -  return api.author.submitExtrinsic(encoded);
            -}
            -
            -const Alice = keyring.addFromSeed(Encoder.encode('Alice                           '));
            -const addressBob = '5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE';
            -const amount = new BN(999); // on dev chain, the fee is 1, that makes it a round 1000
            -
            -console.log(`Crafting and sending an extrinsic for Alice to send Bob ${amount} DOTs`);
            -
            -transfer(Alice, addressBob, amount)
            -  .then(() => console.log('Sent'))
            -  .catch((error) => console.log('HINT: Make sure you wait for the storage to update before sending the next extrinsic', error))
            -  .finally(_ => process.exit(0));
            -
            - - -
            - -
            -
            -
            - -

            results matching ""

            -
              - -
              -
              - -

              No results matching ""

              - -
              -
              -
              - -
              -
              - -
              - - - - - - - - - - - - - - -
              - - -
              - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/examples/deprecated-rpc/06_craft_extrinsic/index.js b/docs/examples/deprecated-rpc/06_craft_extrinsic/index.js deleted file mode 100755 index 38f2a8014a..0000000000 --- a/docs/examples/deprecated-rpc/06_craft_extrinsic/index.js +++ /dev/null @@ -1,56 +0,0 @@ -const BN = require('bn.js'); -const Rpc = require('@polkadot/rpc-core').default; -const WsProvider = require('@polkadot/rpc-provider/ws').default; -const extrinsics = require('@polkadot/extrinsics').default; -const encodeExtrinsic = require('@polkadot/extrinsics/codec/encode').default; -const encodeLength = require('@polkadot/extrinsics/codec/encode/length').default; -const Keyring = require('@polkadot/keyring').default; -const storage = require('@polkadot/storage').default; - -const Encoder = new TextEncoder(); -const keyring = new Keyring(); -const provider = new WsProvider('ws://127.0.0.1:9944'); -const api = new Rpc(provider); - -async function getAccountIndex (address) { - return api.state.getStorage([storage.system.public.accountIndexOf, address]); -} - -async function transfer (keyRingFrom, addressTo, amount) { - const accountIndex = await getAccountIndex(keyRingFrom.address()); - - console.log(`Current accountIndex: ${accountIndex}`); - - // encode the call for signing - const message = encodeExtrinsic( - keyRingFrom.publicKey(), - accountIndex, - extrinsics.staking.public.transfer, - [addressTo, amount] - ); - - // get the signature - const signature = keyRingFrom.sign(message); - - // encode the extrinsic for submission, adding the length (prefix) and the - // signature (postfix)Rödl - const encoded = encodeLength( - // When working with publicKeys, the prefix is 0xff for poc-2+ - new Uint8Array([0xff]), - message, - signature - ); - - return api.author.submitExtrinsic(encoded); -} - -const Alice = keyring.addFromSeed(Encoder.encode('Alice ')); -const addressBob = '5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE'; -const amount = new BN(999); // on dev chain, the fee is 1, that makes it a round 1000 - -console.log(`Crafting and sending an extrinsic for Alice to send Bob ${amount} DOTs`); - -transfer(Alice, addressBob, amount) - .then(() => console.log('Sent')) - .catch((error) => console.log('HINT: Make sure you wait for the storage to update before sending the next extrinsic', error)) - .finally(_ => process.exit(0)); diff --git a/docs/examples/deprecated-rpc/06_craft_extrinsic/package.json b/docs/examples/deprecated-rpc/06_craft_extrinsic/package.json deleted file mode 100644 index 211b10fdda..0000000000 --- a/docs/examples/deprecated-rpc/06_craft_extrinsic/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "06_craft_extrinsic", - "version": "0.1.0", - "description": "Example showing how to transfer DOTs", - "main": "index.js", - "author": "chevdor", - "license": "MIT", - "scripts": { - "clean": "rimraf node_modules", - "start": "node index.js" - }, - "dependencies": { - "@polkadot/rpc-core": "^0.31.1", - "bn.js": "^4.11.8" - }, - "devDependencies": { - "rimraf": "2.6.2" - } -} diff --git a/docs/examples/deprecated-rpc/07_transfer_dots/README.md b/docs/examples/deprecated-rpc/07_transfer_dots/README.md deleted file mode 100644 index a77fc940f0..0000000000 --- a/docs/examples/deprecated-rpc/07_transfer_dots/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Tranfer DOTs - -This sample is more 'straight to the point' and shows the easiest way to transfer DOTs from one an account to another. - -[include](index.js) diff --git a/docs/examples/deprecated-rpc/07_transfer_dots/index.html b/docs/examples/deprecated-rpc/07_transfer_dots/index.html deleted file mode 100644 index 355af1408c..0000000000 --- a/docs/examples/deprecated-rpc/07_transfer_dots/index.html +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - Transfer DOTs · Polkadot API Book - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
              -
              - - - - - - - - -
              - -
              - -
              - - - - - - - - -
              -
              - -
              -
              - -
              - -

              Tranfer DOTs

              -

              This sample is more 'straight to the point' and shows the easiest way to transfer DOTs from one an account to another.

              -
              const BN = require('bn.js');
              -const Rpc = require('@polkadot/rpc-core').default;
              -const WsProvider = require('@polkadot/rpc-provider/ws').default;
              -const extrinsics = require('@polkadot/extrinsics').default;
              -const encodeExtrinsic = require('@polkadot/extrinsics/codec/encode/uncheckedLength').default;
              -const Keyring = require('@polkadot/util-keyring').default;
              -const storage = require('@polkadot/storage').default;
              -
              -const Encoder = new TextEncoder();
              -const keyring = new Keyring();
              -const provider = new WsProvider('ws://127.0.0.1:9944');
              -const api = new Rpc(provider);
              -
              -async function getAccountIndex (address) {
              -  return api.state.getStorage([storage.system.public.accountIndexOf, address]);
              -}
              -
              -async function transfer (keyRingFrom, addressTo, amount) {
              -  const nextAccountIndex = await getAccountIndex(keyRingFrom.address());
              -
              -  // encode the call for signing
              -  const encoded = encodeExtrinsic(
              -    keyRingFrom,
              -    nextAccountIndex,
              -    extrinsics.staking.public.transfer,
              -    [addressTo, amount]
              -  );
              -
              -  await api.author.submitExtrinsic(encoded)
              -    .catch(e => console.log);
              -}
              -
              -const Alice = keyring.addFromSeed(Encoder.encode('Alice                           '));
              -const addressBob = '5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE';
              -const amount = new BN(999); // on dev chain, the fee is 1, that makes it a round 1000
              -
              -console.log(`Crafting and sending an extrinsic for Alice to send Bob ${amount} DOTs`);
              -
              -transfer(Alice, addressBob, amount)
              -  .then(() => console.log('Done'))
              -  .catch((error) => console.log(error))
              -  .finally(_ => process.exit(0));
              -
              - - -
              - -
              -
              -
              - -

              results matching ""

              -
                - -
                -
                - -

                No results matching ""

                - -
                -
                -
                - -
                -
                - -
                - - - - - - - - - - -
                - - -
                - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/examples/deprecated-rpc/07_transfer_dots/index.js b/docs/examples/deprecated-rpc/07_transfer_dots/index.js deleted file mode 100755 index d771a609b0..0000000000 --- a/docs/examples/deprecated-rpc/07_transfer_dots/index.js +++ /dev/null @@ -1,42 +0,0 @@ -const BN = require('bn.js'); -const Rpc = require('@polkadot/rpc-core').default; -const WsProvider = require('@polkadot/rpc-provider/ws').default; -const extrinsics = require('@polkadot/extrinsics').default; -const encodeExtrinsic = require('@polkadot/extrinsics/codec/encode/uncheckedLength').default; -const Keyring = require('@polkadot/keyring').default; -const storage = require('@polkadot/storage').default; - -const Encoder = new TextEncoder(); -const keyring = new Keyring(); -const provider = new WsProvider('ws://127.0.0.1:9944'); -const api = new Rpc(provider); - -async function getAccountIndex (address) { - return api.state.getStorage([storage.system.public.accountIndexOf, address]); -} - -async function transfer (keyRingFrom, addressTo, amount) { - const nextAccountIndex = await getAccountIndex(keyRingFrom.address()); - - // encode the call for signing - const encoded = encodeExtrinsic( - keyRingFrom, - nextAccountIndex, - extrinsics.staking.public.transfer, - [addressTo, amount] - ); - - await api.author.submitExtrinsic(encoded) - .catch(e => console.log); -} - -const Alice = keyring.addFromSeed(Encoder.encode('Alice ')); -const addressBob = '5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE'; -const amount = new BN(999); // on dev chain, the fee is 1, that makes it a round 1000 - -console.log(`Crafting and sending an extrinsic for Alice to send Bob ${amount} DOTs`); - -transfer(Alice, addressBob, amount) - .then(() => console.log('Done')) - .catch((error) => console.log(error)) - .finally(_ => process.exit(0)); diff --git a/docs/examples/deprecated-rpc/07_transfer_dots/package.json b/docs/examples/deprecated-rpc/07_transfer_dots/package.json deleted file mode 100644 index d59657541e..0000000000 --- a/docs/examples/deprecated-rpc/07_transfer_dots/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "07_transfer_dots", - "version": "0.1.0", - "description": "Example showing how to transfer DOTs", - "main": "index.js", - "author": "chevdor", - "license": "MIT", - "scripts": { - "clean": "rimraf node_modules", - "start": "node index.js" - }, - "dependencies": { - "@polkadot/rpc-core": "^0.31.1", - "bn.js": "^4.11.8" - }, - "devDependencies": { - "rimraf": "2.6.2" - } -} diff --git a/docs/examples/deprecated-rpc/README.md b/docs/examples/deprecated-rpc/README.md deleted file mode 100644 index 1a8ec256eb..0000000000 --- a/docs/examples/deprecated-rpc/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Examples - -For the following examples, you need a local node. It is usually convenient testing with: - -``` -polkadot --dev -``` - -Some of the examples use the following accounts: - -- Alice: `5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ` -- Bob: `5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE` - -Those accounts are easy to add if you don't have/see them. The seed of Alice's account is `Alice␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣` and the seed of Bob is... well you guess... - -NOTE: Note the spaces padding Alice's key up to 32 chars. - -## Install - -From each folder, run `yarn` to install the required dependencies - -## Running the examples - -From each folder, run: -``` -yarn start -``` diff --git a/docs/examples/deprecated-rpc/index.html b/docs/examples/deprecated-rpc/index.html deleted file mode 100644 index c55df07fae..0000000000 --- a/docs/examples/deprecated-rpc/index.html +++ /dev/null @@ -1,468 +0,0 @@ - - - - - - - RPC · Polkadot API Book - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                -
                - - - - - - - - -
                - -
                - -
                - - - - - - - - -
                -
                - -
                -
                - -
                - -

                Examples

                -

                For the following examples, you need a local node. It is usually convenient testing with:

                -
                polkadot --dev
                -

                Some of the examples use the following accounts:

                -
                  -
                • Alice: 5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ
                • -
                • Bob: 5Gw3s7q4QLkSWwknsiPtjujPv3XM4Trxi5d4PgKMMk3gfGTE
                • -
                -

                Those accounts are easy to add if you don't have/see them. The seed of Alice's account is Alice␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣ and the seed of Bob is... well you guess...

                -

                NOTE: Note the spaces padding Alice's key up to 32 chars.

                -

                Install

                -

                From each folder, run yarn to install the required dependencies

                -

                Running the examples

                -

                From each folder, run:

                -
                yarn start
                -
                - -
                - -
                -
                -
                - -

                results matching ""

                -
                  - -
                  -
                  - -

                  No results matching ""

                  - -
                  -
                  -
                  - -
                  -
                  - -
                  - - - - - - - - - - - - - - -
                  - - -
                  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/examples/promise/01_simple_connect/package.json b/docs/examples/promise/01_simple_connect/package.json index bb028b90ad..5694a21d42 100644 --- a/docs/examples/promise/01_simple_connect/package.json +++ b/docs/examples/promise/01_simple_connect/package.json @@ -11,8 +11,8 @@ }, "dependencies": { - "@polkadot/api": "^0.33.17", - "@polkadot/rpc-provider": "^0.33.17" + "@polkadot/api": "^0.37.6", + "@polkadot/rpc-provider": "^0.37.6" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/promise/02_listen_to_blocks/package.json b/docs/examples/promise/02_listen_to_blocks/package.json index e63518de7a..88319b921f 100644 --- a/docs/examples/promise/02_listen_to_blocks/package.json +++ b/docs/examples/promise/02_listen_to_blocks/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.33.17" + "@polkadot/api": "^0.37.6" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/promise/03_listen_to_balance_change/package.json b/docs/examples/promise/03_listen_to_balance_change/package.json index 5baf28f5f9..7d765c3bfc 100644 --- a/docs/examples/promise/03_listen_to_balance_change/package.json +++ b/docs/examples/promise/03_listen_to_balance_change/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.33.17" + "@polkadot/api": "^0.37.6" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/promise/05_read_storage/package.json b/docs/examples/promise/05_read_storage/package.json index 7604f0d191..a4de014356 100644 --- a/docs/examples/promise/05_read_storage/package.json +++ b/docs/examples/promise/05_read_storage/package.json @@ -1,5 +1,5 @@ { - "name": "04_read_storage", + "name": "05_read_storage", "version": "0.2.0", "description": "Example showing how to query storage", "main": "index.js", @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.33.17" + "@polkadot/api": "^0.37.6" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/promise/07_transfer_dots/package.json b/docs/examples/promise/07_transfer_dots/package.json index fd4589e7f5..31de2f80b9 100644 --- a/docs/examples/promise/07_transfer_dots/package.json +++ b/docs/examples/promise/07_transfer_dots/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.33.17" + "@polkadot/api": "^0.37.6" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/promise/08_system_events/package.json b/docs/examples/promise/08_system_events/package.json index ae9a77a630..ef53706206 100644 --- a/docs/examples/promise/08_system_events/package.json +++ b/docs/examples/promise/08_system_events/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.33.17" + "@polkadot/api": "^0.37.6" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/promise/09_transfer_events/README.md b/docs/examples/promise/09_transfer_events/README.md new file mode 100644 index 0000000000..a62a5be125 --- /dev/null +++ b/docs/examples/promise/09_transfer_events/README.md @@ -0,0 +1,5 @@ +# Transfer events + +Display the events that occur during a transfer by sending a value to a random account + +[include](index.js) diff --git a/docs/examples/promise/09_transfer_events/index.js b/docs/examples/promise/09_transfer_events/index.js new file mode 100755 index 0000000000..d8db4df61a --- /dev/null +++ b/docs/examples/promise/09_transfer_events/index.js @@ -0,0 +1,52 @@ +// Import the API & Provider and some utility functions +const { ApiPromise } = require('@polkadot/api'); + +// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie) +const testKeyring = require('@polkadot/keyring/testing'); + +// utility function for random values +const { randomAsU8a } = require('@polkadot/util-crypto'); + +// some constants we are using in this sample +const ALICE = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ'; +const AMOUNT = 10000; + +async function main () { + // create an instance of our testign keyring + const keyring = testKeyring.default(); + + // Create the API and wait until ready + const api = await ApiPromise.create(); + + // get the nonce for the admin key + const aliceNonce = await api.query.system.accountNonce(ALICE); + + // find the actual keypair in the keyring + const alicePair = keyring.getPair(ALICE); + + // create a new random recipient + const recipient = keyring.addFromSeed(randomAsU8a(32)).address(); + + console.log('Sending', AMOUNT, 'from', alicePair.address(), 'to', recipient, 'with nonce', aliceNonce.toString()); + + // Do the transfer and track the actual status + api.tx.balances + .transfer(recipient, AMOUNT) + .sign(alicePair, aliceNonce) + .send(({ events = [], status, type }) => { + console.log('Transaction status:', type); + + if (type === 'Finalised') { + console.log('Completed at block hash', status.value.toHex()); + console.log('Events:'); + + events.forEach(({ phase, event: { data, method, section } }) => { + console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString()); + }); + + process.exit(0); + } + }); +} + +main().catch(console.error); diff --git a/docs/examples/deprecated-rpc/02_listen_to_blocks/package.json b/docs/examples/promise/09_transfer_events/package.json similarity index 55% rename from docs/examples/deprecated-rpc/02_listen_to_blocks/package.json rename to docs/examples/promise/09_transfer_events/package.json index 06ef3515ff..02850758c7 100644 --- a/docs/examples/deprecated-rpc/02_listen_to_blocks/package.json +++ b/docs/examples/promise/09_transfer_events/package.json @@ -1,17 +1,16 @@ { - "name": "02_listen_to_blocks", + "name": "09_transfer_events", "version": "0.1.0", - "description": "Example showing how to use subscriptions", + "description": "Example showing how to transfer DOTs (with events)", "main": "index.js", - "author": "chevdor", + "author": "Jaco Greeff ", "license": "MIT", "scripts": { "clean": "rimraf node_modules", "start": "node index.js" }, "dependencies": { - "@polkadot/rpc-core": "^0.31.1", - "bn.js": "^4.11.8" + "@polkadot/api": "^0.37.6" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/promise/10_upgrade_chain/README.md b/docs/examples/promise/10_upgrade_chain/README.md new file mode 100644 index 0000000000..6d69f2624b --- /dev/null +++ b/docs/examples/promise/10_upgrade_chain/README.md @@ -0,0 +1,5 @@ +# Chain upgrade + +Performs a chain upgrade using the `upgradeKey` module. This will brick your chain, so us it as an educational sample. (use `substrate --dev purge-chain` to remove DB and recover) + +[include](index.js) diff --git a/docs/examples/promise/10_upgrade_chain/index.js b/docs/examples/promise/10_upgrade_chain/index.js new file mode 100755 index 0000000000..c54c4fdc4c --- /dev/null +++ b/docs/examples/promise/10_upgrade_chain/index.js @@ -0,0 +1,52 @@ +// Import the API & Provider and some utility functions +const { ApiPromise } = require('@polkadot/api'); +const { WsProvider } = require('@polkadot/rpc-provider'); + +// import the test keyring (already has dev keys for Alice, Bob, Charlie, Eve & Ferdie) +const testKeyring = require('@polkadot/keyring/testing'); + +async function main () { + // Initialise the provider to connect to the local node + const provider = new WsProvider('ws://127.0.0.1:9944'); + + // Create the API and wait until ready (optional provider passed through) + const api = await ApiPromise.create(provider); + + // retrieve the upgrade key from the chain state + const adminId = await api.query.upgradeKey.key(); + + // get the nonce for the admin key + const adminNonce = await api.query.system.accountNonce(adminId); + + // find the actual keypair in the keyring (if this is an changed value, the key + // needs to be added to the keyring before - this assumes we have defaults, i.e. + // Alice as the key - and this exists on the test keyring) + const keyring = testKeyring.default(); + const adminPair = keyring.getPair(adminId.toString()); + + console.log('Upgrading from', adminId.toString(), 'with nonce', adminNonce.toString()); + + // preform a chain upgrade, effectively bricking the chain, passing through + // a hex value, although a valid Uint8Array will also work here + api.tx.upgradeKey + .upgrade('0xdeadbeef') + .sign(adminPair, adminNonce) + .send(({ events = [], type }) => { + console.log('Transaction status:', type); + + if (type === 'Finalised') { + console.error('You have just upgraded and bricked your chain'); + + console.log('Completed at block hash', status.value.toHex()); + console.log('Events:'); + + events.forEach(({ phase, event: { data, method, section } }) => { + console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString()); + }); + + process.exit(0); + } + }); +} + +main().catch(console.error); diff --git a/docs/examples/promise/10_upgrade_chain/package.json b/docs/examples/promise/10_upgrade_chain/package.json new file mode 100644 index 0000000000..19acc97782 --- /dev/null +++ b/docs/examples/promise/10_upgrade_chain/package.json @@ -0,0 +1,18 @@ +{ + "name": "10_upgrade_chain", + "version": "0.2.0", + "description": "Example showing how to upgrade via upgradeKey", + "main": "index.js", + "author": "Jaco Greeff ", + "license": "MIT", + "scripts": { + "clean": "rimraf node_modules", + "start": "node index.js" + }, + "dependencies": { + "@polkadot/api": "^0.37.6" + }, + "devDependencies": { + "rimraf": "^2.6.2" + } +}