diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e5dc9335d..3ad2989749 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # 0.53.1 -- Change spelling to US English as per substrate master (1.0-rc1), potential breaking +- Change spelling to US English as per substrate master (1.0-rc1). Breaking changes as a result: - For extrinsic status results, if you have checked the type returns, i.e. `result.type === 'Finalised` now check on the status for `result.status.isFinalized` or `result.status.isBoadcast`, ... (the `type` property is now accessible only on `result.status.type`) - - If using `subscribeFinalisedHeads` update to `subscribeFinalizedHeads` (likewise `'getFinalisedHead` should be updated to `getFinalizedHead` and `derive.bestNumberFinalized`) -- All examples have been updated with sr25519 addesses + - If using `subscribeFinalisedHeads` update this to `subscribeFinalizedHeads` (likewise `'getFinalisedHead` should be updated to `getFinalizedHead` and `derive.bestNumberFinalized`) +- The underlying ss58 addess checksums have changed in the keyring along with the latest specs +- All examples have been updated with sr25519 addresses (with the new checksums) # 0.52.1 diff --git a/docs/examples/promise/01_simple_connect/package.json b/docs/examples/promise/01_simple_connect/package.json index f3881045b2..2f7b8db0cd 100644 --- a/docs/examples/promise/01_simple_connect/package.json +++ b/docs/examples/promise/01_simple_connect/package.json @@ -11,7 +11,7 @@ }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/promise/03_listen_to_balance_change/index.js b/docs/examples/promise/03_listen_to_balance_change/index.js index 959c612087..0b09b35542 100755 --- a/docs/examples/promise/03_listen_to_balance_change/index.js +++ b/docs/examples/promise/03_listen_to_balance_change/index.js @@ -3,7 +3,7 @@ const { ApiPromise } = require('@polkadot/api'); // Known account we want to use (available on dev chain, with funds) -const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKv3gB'; +const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; async function main () { // Create an await for the API 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 421e9b5111..765b280f12 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.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/promise/05_read_storage/index.js b/docs/examples/promise/05_read_storage/index.js index 52d0aec72f..5376c92d21 100755 --- a/docs/examples/promise/05_read_storage/index.js +++ b/docs/examples/promise/05_read_storage/index.js @@ -3,7 +3,7 @@ const { ApiPromise } = require('@polkadot/api'); // Our address for Alice on the dev chain -const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKv3gB'; +const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; async function main () { // Create our API with a default connection to the local node diff --git a/docs/examples/promise/05_read_storage/package.json b/docs/examples/promise/05_read_storage/package.json index d116fd051e..2efd30c680 100644 --- a/docs/examples/promise/05_read_storage/package.json +++ b/docs/examples/promise/05_read_storage/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/promise/06_make_transfer/index.js b/docs/examples/promise/06_make_transfer/index.js index 1995c44042..bf527ee4a1 100755 --- a/docs/examples/promise/06_make_transfer/index.js +++ b/docs/examples/promise/06_make_transfer/index.js @@ -3,7 +3,7 @@ const { ApiPromise } = require('@polkadot/api'); const { Keyring } = require('@polkadot/keyring'); -const BOB_ADDR = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM696e4'; +const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty'; async function main () { // Instantiate the API @@ -16,7 +16,7 @@ async function main () { const alice = keyring.addFromUri('//Alice'); // Create a extrinsic, transferring 12345 units to Bob - const transfer = api.tx.balances.transfer(BOB_ADDR, 12345); + const transfer = api.tx.balances.transfer(BOB, 12345); // Sign and send the transaction using our account const hash = await transfer.signAndSend(alice); diff --git a/docs/examples/promise/06_make_transfer/package.json b/docs/examples/promise/06_make_transfer/package.json index 367178962a..5187710806 100644 --- a/docs/examples/promise/06_make_transfer/package.json +++ b/docs/examples/promise/06_make_transfer/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "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 fdb013ebdf..3735c3b41e 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.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/promise/09_transfer_events/index.js b/docs/examples/promise/09_transfer_events/index.js index a0d3d59118..49e3698a93 100755 --- a/docs/examples/promise/09_transfer_events/index.js +++ b/docs/examples/promise/09_transfer_events/index.js @@ -9,7 +9,7 @@ const testKeyring = require('@polkadot/keyring/testing'); const { randomAsU8a } = require('@polkadot/util-crypto'); // some constants we are using in this sample -const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKv3gB'; +const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; const AMOUNT = 10000; async function main () { diff --git a/docs/examples/promise/09_transfer_events/package.json b/docs/examples/promise/09_transfer_events/package.json index 9b5e968d94..0129e60076 100644 --- a/docs/examples/promise/09_transfer_events/package.json +++ b/docs/examples/promise/09_transfer_events/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/promise/10_upgrade_chain/package.json b/docs/examples/promise/10_upgrade_chain/package.json index 2f1f06883f..08faab3fab 100644 --- a/docs/examples/promise/10_upgrade_chain/package.json +++ b/docs/examples/promise/10_upgrade_chain/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/rx/01_simple_connect/package.json b/docs/examples/rx/01_simple_connect/package.json index 3bbfe9c362..e1f346d9fa 100644 --- a/docs/examples/rx/01_simple_connect/package.json +++ b/docs/examples/rx/01_simple_connect/package.json @@ -11,7 +11,7 @@ }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/rx/02_listen_to_blocks/package.json b/docs/examples/rx/02_listen_to_blocks/package.json index 2063c451fb..8d0a32a737 100644 --- a/docs/examples/rx/02_listen_to_blocks/package.json +++ b/docs/examples/rx/02_listen_to_blocks/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/rx/03_listen_to_balance_change/index.js b/docs/examples/rx/03_listen_to_balance_change/index.js index 8693625211..234b0d54c5 100644 --- a/docs/examples/rx/03_listen_to_balance_change/index.js +++ b/docs/examples/rx/03_listen_to_balance_change/index.js @@ -3,7 +3,7 @@ const { ApiRx } = require('@polkadot/api'); const { pairwise, startWith } = require('rxjs/operators'); // Known account we want to use (available on dev chain, with funds) -const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKv3gB'; +const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; async function main () { // Create an await for the API diff --git a/docs/examples/rx/03_listen_to_balance_change/package.json b/docs/examples/rx/03_listen_to_balance_change/package.json index 55cf72927e..09c562a86e 100644 --- a/docs/examples/rx/03_listen_to_balance_change/package.json +++ b/docs/examples/rx/03_listen_to_balance_change/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/rx/04_unsubscribe/package.json b/docs/examples/rx/04_unsubscribe/package.json index 195f6a2ac2..5f4035ef53 100644 --- a/docs/examples/rx/04_unsubscribe/package.json +++ b/docs/examples/rx/04_unsubscribe/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/rx/05_read_storage/index.js b/docs/examples/rx/05_read_storage/index.js index 129057eb53..8ad9d89f20 100644 --- a/docs/examples/rx/05_read_storage/index.js +++ b/docs/examples/rx/05_read_storage/index.js @@ -5,7 +5,7 @@ const { combineLatest, of } = require('rxjs'); const { first, switchMap } = require('rxjs/operators'); // Our address for Alice on the dev chain -const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKv3gB'; +const Alice = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; function main () { // Create our API with a default connection to the local node diff --git a/docs/examples/rx/05_read_storage/package.json b/docs/examples/rx/05_read_storage/package.json index 47a0f436f6..835c40bbf6 100644 --- a/docs/examples/rx/05_read_storage/package.json +++ b/docs/examples/rx/05_read_storage/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/rx/06_make_transfer/index.js b/docs/examples/rx/06_make_transfer/index.js index 225000aaae..300e0b3659 100644 --- a/docs/examples/rx/06_make_transfer/index.js +++ b/docs/examples/rx/06_make_transfer/index.js @@ -2,7 +2,7 @@ const { ApiRx } = require('@polkadot/api'); const { Keyring } = require('@polkadot/keyring'); -const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM696e4'; +const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty'; async function main () { // Instantiate the API diff --git a/docs/examples/rx/06_make_transfer/package.json b/docs/examples/rx/06_make_transfer/package.json index fa45b1aaf4..b1f440a1c2 100644 --- a/docs/examples/rx/06_make_transfer/package.json +++ b/docs/examples/rx/06_make_transfer/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/rx/08_system_events/package.json b/docs/examples/rx/08_system_events/package.json index 4ab0361e94..e8361a17d7 100644 --- a/docs/examples/rx/08_system_events/package.json +++ b/docs/examples/rx/08_system_events/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/rx/09_transfer_events/index.js b/docs/examples/rx/09_transfer_events/index.js index 22dc3a12af..4df8a1cdf0 100644 --- a/docs/examples/rx/09_transfer_events/index.js +++ b/docs/examples/rx/09_transfer_events/index.js @@ -8,7 +8,7 @@ const testKeyring = require('@polkadot/keyring/testing'); const { randomAsU8a } = require('@polkadot/util-crypto'); // some constants we are using in this sample -const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKv3gB'; +const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; const AMOUNT = 10000; async function main () { diff --git a/docs/examples/rx/09_transfer_events/package.json b/docs/examples/rx/09_transfer_events/package.json index dae0152db5..a6dbd4f749 100644 --- a/docs/examples/rx/09_transfer_events/package.json +++ b/docs/examples/rx/09_transfer_events/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/docs/examples/rx/10_upgrade_chain/package.json b/docs/examples/rx/10_upgrade_chain/package.json index 26bd7c1ba9..4dd662356c 100644 --- a/docs/examples/rx/10_upgrade_chain/package.json +++ b/docs/examples/rx/10_upgrade_chain/package.json @@ -10,7 +10,7 @@ "start": "node index.js" }, "dependencies": { - "@polkadot/api": "^0.52.1" + "@polkadot/api": "^0.53.1" }, "devDependencies": { "rimraf": "^2.6.2" diff --git a/packages/api-derive/test/e2e/rx.spec.ts b/packages/api-derive/test/e2e/rx.spec.ts index a725957449..8c0e9f745c 100644 --- a/packages/api-derive/test/e2e/rx.spec.ts +++ b/packages/api-derive/test/e2e/rx.spec.ts @@ -48,7 +48,7 @@ describe.skip('derive e2e', () => { // these only work on localhost, not the poc-3 URL // (and it is assuming it sent at least 1 tx) describe('accounts', () => { - const ID = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ'; + const ID = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; const IX = 'F7Gh'; it('looks up id & index from id', async (done) => { diff --git a/packages/api/package.json b/packages/api/package.json index b9b0f776fa..a7fd6824db 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -36,6 +36,6 @@ "@polkadot/rpc-rx": "^0.53.0-beta.1", "@polkadot/storage": "^0.53.0-beta.1", "@polkadot/types": "^0.53.0-beta.1", - "@polkadot/util-crypto": "^0.42.1" + "@polkadot/util-crypto": "^0.43.0-beta.0" } } diff --git a/packages/rpc-core/package.json b/packages/rpc-core/package.json index db44e3ec13..22909a47ed 100644 --- a/packages/rpc-core/package.json +++ b/packages/rpc-core/package.json @@ -33,6 +33,6 @@ "@polkadot/jsonrpc": "^0.53.0-beta.1", "@polkadot/rpc-provider": "^0.53.0-beta.1", "@polkadot/types": "^0.53.0-beta.1", - "@polkadot/util": "^0.42.1" + "@polkadot/util": "^0.43.0-beta.0" } } diff --git a/packages/rpc-core/src/formatting.spec.ts b/packages/rpc-core/src/formatting.spec.ts index 49deefed69..3e35e511ad 100644 --- a/packages/rpc-core/src/formatting.spec.ts +++ b/packages/rpc-core/src/formatting.spec.ts @@ -7,11 +7,11 @@ import storage from '@polkadot/storage/static'; import Api from '.'; -const ADDR_ONE = '5EhmTa7fL6SdjgKXo9g6hetR6nHnRAmrtisoGFWEESjzECtY'; -const ADDR_TWO = '5FjbQAHSptRU4Q7Py6zDsRnE7UkpZikJVg5nm1tmu3WuZXKd'; +const ADDR_ONE = '5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo'; +const ADDR_TWO = '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'; -const ENC_ONE = '0x24988a82b3bbaae58680bc9de5dea5aa'; -const ENC_TWO = '0xdb190750267d8849c35316ec9d342111'; +const ENC_ONE = '0x4af2c53fce3ec33c6ccccf22e926f1a7'; +const ENC_TWO = '0x3e62f7ed6e788e1337bce2a97b68a12a'; describe('formatting', () => { let api: Api; diff --git a/packages/rpc-core/test/e2e/state.test.js b/packages/rpc-core/test/e2e/state.test.js index 6dcbfb10b6..4699540c3e 100644 --- a/packages/rpc-core/test/e2e/state.test.js +++ b/packages/rpc-core/test/e2e/state.test.js @@ -7,7 +7,7 @@ import storage from '@polkadot/storage/static'; import Rpc from '../../src'; -const ALICE = '5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ'; +const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; describe.skip('e2e state', () => { let api; diff --git a/packages/rpc-provider/package.json b/packages/rpc-provider/package.json index 6047f87443..da21bd6506 100644 --- a/packages/rpc-provider/package.json +++ b/packages/rpc-provider/package.json @@ -30,10 +30,10 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme", "dependencies": { "@babel/runtime": "^7.4.0", - "@polkadot/keyring": "^0.42.1", + "@polkadot/keyring": "^0.43.0-beta.0", "@polkadot/storage": "^0.53.0-beta.1", - "@polkadot/util": "^0.42.1", - "@polkadot/util-crypto": "^0.42.1", + "@polkadot/util": "^0.43.0-beta.0", + "@polkadot/util-crypto": "^0.43.0-beta.0", "@types/nock": "^9.3.1", "eventemitter3": "^3.1.0", "isomorphic-fetch": "^2.2.1", diff --git a/packages/type-extrinsics/package.json b/packages/type-extrinsics/package.json index b234a6f44c..684181d61e 100644 --- a/packages/type-extrinsics/package.json +++ b/packages/type-extrinsics/package.json @@ -12,6 +12,6 @@ "dependencies": { "@babel/runtime": "^7.4.0", "@polkadot/types": "^0.53.0-beta.1", - "@polkadot/util": "^0.42.1" + "@polkadot/util": "^0.43.0-beta.0" } } diff --git a/packages/type-extrinsics/src/fromMetadata.spec.ts b/packages/type-extrinsics/src/fromMetadata.spec.ts index b7f324ef3f..e9c6633280 100644 --- a/packages/type-extrinsics/src/fromMetadata.spec.ts +++ b/packages/type-extrinsics/src/fromMetadata.spec.ts @@ -17,7 +17,7 @@ describe('fromMetadata', () => { }); it('should return a value if the storage function does not expect an argument', () => { - expect(() => newExtrinsics.balances.setBalance('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s', 2, 3)).not.toThrow(); + expect(() => newExtrinsics.balances.setBalance('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF', 2, 3)).not.toThrow(); }); it('should return properly-encoded transactions', () => { diff --git a/packages/type-storage/package.json b/packages/type-storage/package.json index 0e76b6e8a1..1c5b36ce94 100644 --- a/packages/type-storage/package.json +++ b/packages/type-storage/package.json @@ -30,9 +30,9 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-storage#readme", "dependencies": { "@babel/runtime": "^7.4.0", - "@polkadot/keyring": "^0.42.1", + "@polkadot/keyring": "^0.43.0-beta.0", "@polkadot/types": "^0.53.0-beta.1", - "@polkadot/util": "^0.42.1", - "@polkadot/util-crypto": "^0.42.1" + "@polkadot/util": "^0.43.0-beta.0", + "@polkadot/util-crypto": "^0.43.0-beta.0" } } diff --git a/packages/type-storage/src/fromMetadata.spec.ts b/packages/type-storage/src/fromMetadata.spec.ts index 2614d4d201..da1b7d0e8f 100644 --- a/packages/type-storage/src/fromMetadata.spec.ts +++ b/packages/type-storage/src/fromMetadata.spec.ts @@ -2,6 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { u8aToHex } from '@polkadot/util'; import { Metadata } from '@polkadot/types'; import json from '@polkadot/types/Metadata/v0/static'; @@ -20,11 +21,13 @@ describe('fromMetadata', () => { expect(() => newStorage.timestamp.now()).not.toThrow(); }); - // FIXME check again when we have a valid chain/UI it('should return the correct length-prefixed storage key', () => { - expect(newStorage.balances.freeBalance('5GwPuAgYgP6q58uWTXp4uSg6FwfzQv9HfFZwAFEREUrQjCvy')).toEqual( - // U8a is length-prefixed - Uint8Array.from([64, 52, 103, 23, 10, 157, 95, 244, 9, 70, 215, 120, 149, 1, 238, 109, 69]) + expect( + u8aToHex( + newStorage.balances.freeBalance('5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo') + ) + ).toEqual( + '0x404af2c53fce3ec33c6ccccf22e926f1a7' ); }); }); diff --git a/packages/types/package.json b/packages/types/package.json index 7c7a1a8ee9..4cc161ddf9 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -30,7 +30,7 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme", "dependencies": { "@babel/runtime": "^7.4.0", - "@polkadot/keyring": "^0.42.1", - "@polkadot/util": "^0.42.1" + "@polkadot/keyring": "^0.43.0-beta.0", + "@polkadot/util": "^0.43.0-beta.0" } } diff --git a/packages/types/src/codec/Vector.spec.ts b/packages/types/src/codec/Vector.spec.ts index f9e78c2cf1..b0acf3b502 100644 --- a/packages/types/src/codec/Vector.spec.ts +++ b/packages/types/src/codec/Vector.spec.ts @@ -129,12 +129,12 @@ describe('Vector', () => { }); it('finds the index of an value', () => { - const myId = '5GfWeNe33QeyzVMV2uENuvSXLVfVXCiuLvfEP6WCDHADZhen'; + const myId = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'; const vec = new Vector(AccountId, [ - '5H4787dXL43BaA6PvTwUTyA38JBbfC9r8QyK3ay8Nozc2Ta3', '5GeJHN5EcUGPoa5pUwYkXjymoDVN1DJHsBR4UGX4XRAwKBVk', '5Dn8F1SUX6SoLt1BTfKEPL5VY9wMvG1A6tEJTSCHpLsinThm', '5DPW1n4q2THUjKGj3QKkcqdh6oxY1bmLsSQ7t8FuiuNtRoUc', '5E8k3u7iRysqPPYsBK1UgetCquZznwRZxryTzynkDTzg3vNy', '5DteAmjoppNJ8rrBugKctCXM82UVWZSCHeU8pqFwQBbyAWyB', '5GfWeNe33QeyzVMV2uENuvSXLVfVXCiuLvfEP6WCDHADZhen' + '5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw', '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty', '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY' ]); - expect(vec.indexOf(myId)).toEqual(6); + expect(vec.indexOf(myId)).toEqual(2); }); }); }); diff --git a/packages/types/src/primitive/StorageKey.spec.ts b/packages/types/src/primitive/StorageKey.spec.ts index 85d6fc1b73..5acb296965 100644 --- a/packages/types/src/primitive/StorageKey.spec.ts +++ b/packages/types/src/primitive/StorageKey.spec.ts @@ -2,6 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. +import { hexToU8a } from '@polkadot/util'; import storage from '@polkadot/storage/static'; import StorageKey from './StorageKey'; @@ -12,10 +13,10 @@ describe('StorageKey', () => { new StorageKey( storage .balances - .freeBalance('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ') + .freeBalance('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY') ) .toHex() - ).toBe('0xce3f3d8f09e3411403f5ca59d042a40e'); // FIXME OK this should be length-prefixed in reality + ).toBe('0xc99f5446efa57788f39ab529311f4550'); // FIXME OK this should be length-prefixed in reality }); it(`should correctly get Alice's freeBalance storage key (u8a)`, () => { @@ -23,11 +24,12 @@ describe('StorageKey', () => { new StorageKey( storage .balances - .freeBalance('5GoKvZWG5ZPYL1WUovuHW3zJBWBP5eT8CbqjdRY4Q6iMaDtZ') + .freeBalance('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY') ) .toU8a() ).toEqual( - Uint8Array.from([64, 206, 63, 61, 143, 9, 227, 65, 20, 3, 245, 202, 89, 208, 66, 164, 14]) // Length-prefixed + // length prefix attached + hexToU8a('0x40c99f5446efa57788f39ab529311f4550') ); }); }); diff --git a/packages/types/src/type/AccountId.spec.ts b/packages/types/src/type/AccountId.spec.ts index f94f99db6b..8829725b4b 100644 --- a/packages/types/src/type/AccountId.spec.ts +++ b/packages/types/src/type/AccountId.spec.ts @@ -22,7 +22,7 @@ describe('AccountId', () => { }); it('equals the empty address', () => { - expect(id.eq('5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUppTZ')).toBe(true); + expect(id.eq('5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM')).toBe(true); }); }); @@ -36,17 +36,17 @@ describe('AccountId', () => { testDecode( 'AccountId', new AccountId('0x0102030405060708010203040506070801020304050607080102030405060708'), - '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s' + '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF' ); - testDecode('hex', '0x0102030405060708010203040506070801020304050607080102030405060708', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'); - testDecode('string', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'); + testDecode('hex', '0x0102030405060708010203040506070801020304050607080102030405060708', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'); + testDecode('string', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'); testDecode( 'U8a', new U8a([ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8 ]), - '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s' + '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF' ); testDecode( 'Uint8Array', @@ -54,12 +54,12 @@ describe('AccountId', () => { 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8 ]), - '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s' + '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF' ); }); describe('encoding', () => { - const testEncode = (to: 'toHex' | 'toJSON' | 'toString' | 'toU8a', expected: Uint8Array | string, input: string = '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s') => + const testEncode = (to: 'toHex' | 'toJSON' | 'toString' | 'toU8a', expected: Uint8Array | string, input: string = '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF') => it(`can encode ${to}`, () => { const a = new AccountId(input); @@ -67,16 +67,16 @@ describe('AccountId', () => { }); testEncode('toHex', '0x0102030405060708010203040506070801020304050607080102030405060708'); - testEncode('toJSON', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'); - testEncode('toString', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'); - testEncode('toString', '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUppTZ', '0x00'); + testEncode('toJSON', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'); + testEncode('toString', '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'); + testEncode('toString', '5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM', '0x00'); testEncode('toU8a', Uint8Array.from([ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8 ])); it('decodes to a non-empty value', () => { - expect(new AccountId('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s').isEmpty).toBe(false); + expect(new AccountId('7qT1BvpawNbqb3BZaBTMFMMAKrpJKLPf1LmEHR1JyarWJdMX').isEmpty).toBe(false); }); }); @@ -88,14 +88,14 @@ describe('AccountId', () => { const list = new Vector(AccountId, data).map((accountId) => accountId.toString()); expect(list).toEqual([ - '7qVJujLF3EDbZt5WfQXWvueFedMS4Vfk2Hb4GyR8jwksTZQ5', - '7pHyqeYaJjJPgxQgCXoS2EZMhBhtpm6BLCqQ4jJZTQB2kEDM', - '7pYLWV6PTUmLTMQfHmmuBwBNLkhcKhRAnkM36CSJtjat9Cxe', - '7qT1BvpawNbqb3BZaBTMFMMAKrpJKLPf1LmEHR1JyarWJpvA', - '7rADc9JW5EUGFPWLjPMipH4c3bJ2GyAUedmqQHiaGucWVifb', - '7oK5KRH6jt4p8auipnru9ptqeuRwbLMHA2tgCViZzhmW4Mo2', - '7ndAVsHvonnzTg4AvRhpraNCKj9g4CGQXKoLrgkTZ91NaLgJ', - '7oL7VfXgLA8L3pJJwi11v3sBYc1b5R3tLrweHwzMNxgEpWuv' + '7qVJujLF3EDbZt5WfQXWvueFedMS4Vfk2Hb4GyR8jwksTLup', + '7pHyqeYaJjJPgxQgCXoS2EZMhBhtpm6BLCqQ4jJZTQB2kMhw', + '7pYLWV6PTUmLTMQfHmmuBwBNLkhcKhRAnkM36CSJtjat9ACb', + '7qT1BvpawNbqb3BZaBTMFMMAKrpJKLPf1LmEHR1JyarWJdMX', + '7rADc9JW5EUGFPWLjPMipH4c3bJ2GyAUedmqQHiaGucWVrsT', + '7oK5KRH6jt4p8auipnru9ptqeuRwbLMHA2tgCViZzhmW4Lox', + '7ndAVsHvonnzTg4AvRhpraNCKj9g4CGQXKoLrgkTZ91Na6PE', + '7oL7VfXgLA8L3pJJwi11v3sBYc1b5R3tLrweHwzMNxgEpjxP' ]); }); }); diff --git a/packages/types/src/type/AccountIndex.spec.ts b/packages/types/src/type/AccountIndex.spec.ts index 95d894586d..fc9f074499 100644 --- a/packages/types/src/type/AccountIndex.spec.ts +++ b/packages/types/src/type/AccountIndex.spec.ts @@ -14,28 +14,28 @@ describe('AccountIndex', () => { it('creates a BN representation (from ss-58)', () => { expect( - new AccountIndex('Mwz15xN8').toNumber() + new AccountIndex('Mwz15xP2').toNumber() ).toEqual(336794129); }); it('constructs 2-byte from number', () => { expect( new AccountIndex(256 * 1).toString() - ).toEqual('25GUyk'); + ).toEqual('25GUyv'); }); it('constructs from number', () => { expect( new AccountIndex(new BN(336794129)).toString() - ).toEqual('Mwz15xN8'); + ).toEqual('Mwz15xP2'); }); it('compares ss-58 values', () => { - expect(new AccountIndex(256 * 1).eq('25GUyk')).toBe(true); + expect(new AccountIndex(256 * 1).eq('25GUyv')).toBe(true); }); it('compares numbers', () => { - expect(new AccountIndex('25GUyk').eq(256 * 1)).toBe(true); + expect(new AccountIndex('2jpAFn').eq(256 * 1)).toBe(true); }); describe('calcLength', () => { diff --git a/packages/types/src/type/Address.spec.ts b/packages/types/src/type/Address.spec.ts index 45b72af0ab..18e4f43629 100644 --- a/packages/types/src/type/Address.spec.ts +++ b/packages/types/src/type/Address.spec.ts @@ -15,38 +15,38 @@ describe('Address', () => { describe('utility', () => { it('equals on AccountId', () => { - const addr = '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'; + const addr = '5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo'; expect(new Address(addr).eq(addr)).toBe(true); }); it('equals on AccountIndex', () => { // see the test below - these are equivalent (with different prefix encoding) - expect(new Address('PrF3').eq('F7ih')).toBe(true); + expect(new Address('2jpAFn').eq('25GUyv')).toBe(true); }); }); describe('decoding', () => { testDecode( 'Address', - new Address('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'), - '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s' + new Address('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'), + '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF' ); testDecode( 'AccountId', - new AccountId('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'), - '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s' + new AccountId('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'), + '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF' ); testDecode( 'AccountIndex (mixed prefixes)', - new Address('PrF3'), + new Address('2jpAFn'), // NOTE Expected adress here is encoded with prefix 42, input above with 68 - 'F7ih' + '25GUyv' ); testDecode( 'AccountIndex (hex)', new AccountIndex('0x0100'), - '25GUyk' + '25GUyv' ); testDecode( 'Array', @@ -55,7 +55,7 @@ describe('Address', () => { 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8 ], - '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s' + '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF' ); testDecode( 'Uint8Array (with prefix 255)', @@ -64,22 +64,22 @@ describe('Address', () => { 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8 ]), - '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s' + '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF' ); testDecode( 'Uint8Array (with prefix 1 byte)', Uint8Array.from([1]), - 'F7L6' + 'F7NZ' ); testDecode( 'Uint8Array (with prefix 2 bytes)', Uint8Array.from([0xfc, 0, 1]), - '25GUyk' + '25GUyv' ); testDecode( 'Uint8Array (with prefix 4 bytes)', Uint8Array.from([0xfd, 17, 18, 19, 20]), - 'Mwz15xN8' + 'Mwz15xP2' ); // FIXME The specification allows for 8 byte addresses, however since AccountIndex is u32 internally // (and defined that way in thd efault Substrate),this does not actually work since it is 8 bytes, @@ -94,7 +94,7 @@ describe('Address', () => { describe('encoding', () => { const testEncode = (to: 'toHex' | 'toString' | 'toU8a', expected: string | Uint8Array) => it(`can encode ${to}`, () => { - const a = new Address('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s'); + const a = new Address('5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF'); expect(a[to]()).toEqual(expected); }); @@ -104,7 +104,7 @@ describe('Address', () => { ); testEncode( 'toString', - '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCt72s' + '5C62W7ELLAAfix9LYrcx5smtcffbhvThkM5x7xfMeYXCtGwF' ); testEncode( 'toU8a', diff --git a/packages/types/src/type/Extrinsic.spec.ts b/packages/types/src/type/Extrinsic.spec.ts index 4c1d05540e..ece450767f 100644 --- a/packages/types/src/type/Extrinsic.spec.ts +++ b/packages/types/src/type/Extrinsic.spec.ts @@ -29,7 +29,7 @@ describe('Extrinsic', () => { expect(extrinsic.signature.nonce.toNumber()).toEqual(3); expect(extrinsic.signature.era.toU8a()).toEqual(new Uint8Array([0])); expect(extrinsic.callIndex).toEqual(new Uint8Array([3, 0])); - expect(extrinsic.args[0].toString()).toEqual('5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5nni'); + expect(extrinsic.args[0].toString()).toEqual('5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo'); }); it('decodes an actual transaction (old format)', () => { @@ -43,6 +43,6 @@ describe('Extrinsic', () => { expect(extrinsic.signature.nonce.toNumber()).toEqual(3); expect(extrinsic.signature.era.toU8a()).toEqual(new Uint8Array([0])); expect(extrinsic.callIndex).toEqual(new Uint8Array([3, 0])); - expect(extrinsic.args[0].toString()).toEqual('5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5nni'); + expect(extrinsic.args[0].toString()).toEqual('5DkQbYAExs3M2sZgT1Ec3mKfZnAQCL4Dt9beTCknkCUn5jzo'); }); }); diff --git a/yarn.lock b/yarn.lock index a56685489b..5cd07826e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1579,14 +1579,14 @@ typescript "^3.3.4000" vuepress "^1.0.0-alpha.44" -"@polkadot/keyring@^0.42.1": - version "0.42.1" - resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.42.1.tgz#96b36543b7633d9aba3f9fe0ab5e69bafd73abae" - integrity sha512-xY2e1FU6UDVO/OcMvz2Up7x27QexOQMOh9hy9dqIDfdwCGZrbsPRxiXTHFKUglAi5vUZhiSlGR/L0ealZaKD2Q== +"@polkadot/keyring@^0.43.0-beta.0": + version "0.43.0-beta.0" + resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.43.0-beta.0.tgz#d1f6edb24d9b9a817d48d6b180da8d0efb7c6121" + integrity sha512-izJw9KxXpmewQw9aKIjmNpKiLnVNdvSY6fA55aXGLlCDLjkkufW1OXoZmhsGi3jWzto6wWWAFfnzBxvimzuPBQ== dependencies: "@babel/runtime" "^7.4.0" - "@polkadot/util" "^0.42.1" - "@polkadot/util-crypto" "^0.42.1" + "@polkadot/util" "^0.43.0-beta.0" + "@polkadot/util-crypto" "^0.43.0-beta.0" "@types/bs58" "^4.0.0" bs58 "^4.0.1" @@ -1595,13 +1595,13 @@ resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.56.tgz#ffd6e9c95704a7fb90b918193b9dc5c440114b27" integrity sha512-wnt4zXxZXyz6WaubTO/I+nUElwV2DogFzdl6CrKfVn2PTWp8uHN06W9s40FH57ORtmQfDr9rLRP8Nq+oIyElbg== -"@polkadot/util-crypto@^0.42.1": - version "0.42.1" - resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.42.1.tgz#c19b1a8013ad40196a0384f82b92d18c3a63cfdf" - integrity sha512-NmHUrR/ysxhLx/PpL/exF9X7pNEx4znOwNvXQ+ZCI1U2TGBXj0T8IomSkyVNuDUv0R+OYzmcJAFB0igTdiEqMw== +"@polkadot/util-crypto@^0.43.0-beta.0": + version "0.43.0-beta.0" + resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.43.0-beta.0.tgz#73440c789c83e7ff19d6ac7347a1573cd97b0da5" + integrity sha512-840A3Dl+j6RHMeaQDwINM79VaVtBZdOSw2m7EuTkQXE1+705pLrwqpwUcXHNEo9fCz6Io6MkavJUm9nKZotjww== dependencies: "@babel/runtime" "^7.4.0" - "@polkadot/util" "^0.42.1" + "@polkadot/util" "^0.43.0-beta.0" "@polkadot/wasm-crypto" "^0.6.1" "@polkadot/wasm-dalek-ed25519" "^0.6.1" "@polkadot/wasm-schnorrkel" "^0.6.1" @@ -1617,10 +1617,10 @@ tweetnacl "^1.0.1" xxhashjs "^0.2.2" -"@polkadot/util@^0.42.1": - version "0.42.1" - resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.42.1.tgz#270f87c5370ab38e17d7aa77804686dc309328f7" - integrity sha512-9Nd5VLl7SQjwjdWTWQZ978+7dc9AcXF5IfDe8JiS65i76YB7HPPS6bF4mYmbmrRXEWXi/DMx+A7FKHyz0BHgRg== +"@polkadot/util@^0.43.0-beta.0": + version "0.43.0-beta.0" + resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.43.0-beta.0.tgz#ec621344b690d49fec473c2a9b0d215b13d4decd" + integrity sha512-XTHb3fowTO4fPTE+72xh1Cdy+/gdmi5ytsHuZtlNC1DH09TZ6R3GBi9NzX4mQZsH8dSUOzQkGHiHzCPRULE9fQ== dependencies: "@babel/runtime" "^7.4.0" "@types/bn.js" "^4.11.4"