This commit is contained in:
Jaco Greeff
2019-03-29 22:11:48 +01:00
parent 69ddf7746a
commit 6b8ecb26f2
14 changed files with 86 additions and 76 deletions
+7 -3
View File
@@ -1,15 +1,19 @@
# 0.75.1
- Start journey to 1.0
# 0.53.1
- 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 this to `subscribeFinalizedHeads` (likewise `'getFinalisedHead` should be updated to `getFinalizedHead` and `derive.bestNumberFinalized`)
- 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.isBroadcast`, ... (the `type` property is now accessible only on `result.status.type`)
- 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
- Support queries to linked mapped storage (found in new staking interfaces)
- Add derive.staking.controllers to retrieve all active staking controllers
- Add `derive.staking.controllers` to retrieve all active staking controllers
- Align types as per latest substrate master
- PeerInfo from system_peers does not have the index field anymore (dropped in substrate)
- Allow parsing of V3 metadata with DoubleMap support
+1 -1
View File
@@ -9,5 +9,5 @@
"packages": [
"packages/*"
],
"version": "0.53.1"
"version": "0.75.0"
}
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "0.53.1",
"version": "0.75.0",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
@@ -31,8 +31,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.4.0",
"@polkadot/api": "^0.53.1",
"@polkadot/types": "^0.53.1",
"@polkadot/api": "^0.75.0",
"@polkadot/types": "^0.75.0",
"@types/memoizee": "^0.4.2",
"memoizee": "^0.4.14"
}
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "0.53.1",
"version": "0.75.0",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
@@ -30,12 +30,12 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.4.0",
"@polkadot/api-derive": "^0.53.1",
"@polkadot/extrinsics": "^0.53.1",
"@polkadot/rpc-provider": "^0.53.1",
"@polkadot/rpc-rx": "^0.53.1",
"@polkadot/storage": "^0.53.1",
"@polkadot/types": "^0.53.1",
"@polkadot/util-crypto": "^0.43.1"
"@polkadot/api-derive": "^0.75.0",
"@polkadot/extrinsics": "^0.75.0",
"@polkadot/rpc-provider": "^0.75.0",
"@polkadot/rpc-rx": "^0.75.0",
"@polkadot/storage": "^0.75.0",
"@polkadot/types": "^0.75.0",
"@polkadot/util-crypto": "^0.75.1"
}
}
+15 -8
View File
@@ -33,7 +33,7 @@ describe.skip('e2e transactions', () => {
const nonce = await api.query.system.accountNonce(keyring.dave.address());
return api.tx.balances
.transfer('12ghjsRJpeJpUQaCQeHcBv9pRQA3tdcMxeL8cVk9JHWJGHjd', 12345)
.transfer(keyring.eve.address(), 12345)
.sign(keyring.dave, { nonce })
.send(({ events, status }) => {
console.log('Transaction status:', status.type);
@@ -57,7 +57,7 @@ describe.skip('e2e transactions', () => {
const nonce = await api.query.system.accountNonce(keyring.dave.address());
return api.tx.balances
.transfer('12ghjsRJpeJpUQaCQeHcBv9pRQA3tdcMxeL8cVk9JHWJGHjd', 12345)
.transfer(keyring.eve.address(), 12345)
.sign(keyring.dave, nonce)
.send(({ events, status }) => {
console.log('Transaction status:', status.type);
@@ -79,7 +79,7 @@ describe.skip('e2e transactions', () => {
it('makes a transfer (signAndSend)', async (done) => {
return api.tx.balances
.transfer('12ghjsRJpeJpUQaCQeHcBv9pRQA3tdcMxeL8cVk9JHWJGHjd', 12345)
.transfer(keyring.eve.address(), 12345)
.signAndSend(keyring.dave, ({ events, status }) => {
console.log('Transaction status:', status.type);
@@ -100,9 +100,11 @@ describe.skip('e2e transactions', () => {
it('makes a transfer (signAndSend via Signer)', async (done) => {
const signer = new SingleAccountSigner(keyring.dave);
api.setSigner(signer);
return api.tx.balances
.transfer('12ghjsRJpeJpUQaCQeHcBv9pRQA3tdcMxeL8cVk9JHWJGHjd', 12345)
.transfer(keyring.eve.address(), 12345)
.signAndSend(keyring.dave.address(), ({ events, status }) => {
console.log('Transaction status:', status.type);
@@ -124,25 +126,30 @@ describe.skip('e2e transactions', () => {
it('makes a transfer (signAndSend via Signer) - sad path', async () => {
//no signer
api.setSigner();
await expect(api.tx.balances
.transfer('12ghjsRJpeJpUQaCQeHcBv9pRQA3tdcMxeL8cVk9JHWJGHjd', 12345)
.transfer(keyring.eve.address(), 12345)
.signAndSend(keyring.alice.address())).rejects.toThrow('no signer exists');
const signer = new SingleAccountSigner(keyring.dave);
api.setSigner(signer);
//no callback
await expect(api.tx.balances
.transfer('12ghjsRJpeJpUQaCQeHcBv9pRQA3tdcMxeL8cVk9JHWJGHjd', 12345)
.transfer(keyring.eve.address(), 12345)
.signAndSend(keyring.alice.address())).rejects.toThrow('does not have the keyringPair');
//with callback
await expect(api.tx.balances
.transfer('12ghjsRJpeJpUQaCQeHcBv9pRQA3tdcMxeL8cVk9JHWJGHjd', 12345)
.transfer(keyring.eve.address(), 12345)
.signAndSend(keyring.alice.address(), ({ events, status }) => {
})).rejects.toThrow('does not have the keyringPair');
});
it('makes a transfer (no callback)', async () => {
const hash = await api.tx.balances
.transfer('12ghjsRJpeJpUQaCQeHcBv9pRQA3tdcMxeL8cVk9JHWJGHjd', 12345)
.transfer(keyring.eve.address(), 12345)
.signAndSend(keyring.dave);
expect(hash.toHex()).toHaveLength(66);
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "0.53.1",
"version": "0.75.0",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -30,9 +30,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.4.0",
"@polkadot/jsonrpc": "^0.53.1",
"@polkadot/rpc-provider": "^0.53.1",
"@polkadot/types": "^0.53.1",
"@polkadot/util": "^0.43.1"
"@polkadot/jsonrpc": "^0.75.0",
"@polkadot/rpc-provider": "^0.75.0",
"@polkadot/types": "^0.75.0",
"@polkadot/util": "^0.75.1"
}
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "0.53.1",
"version": "0.75.0",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -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.43.1",
"@polkadot/storage": "^0.53.1",
"@polkadot/util": "^0.43.1",
"@polkadot/util-crypto": "^0.43.1",
"@polkadot/keyring": "^0.75.1",
"@polkadot/storage": "^0.75.0",
"@polkadot/util": "^0.75.1",
"@polkadot/util-crypto": "^0.75.1",
"@types/nock": "^9.3.1",
"eventemitter3": "^3.1.0",
"isomorphic-fetch": "^2.2.1",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-rx",
"version": "0.53.1",
"version": "0.75.0",
"description": "An RxJs wrapper around the Polkadot JS API",
"main": "index.js",
"keywords": [
@@ -30,8 +30,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-rx#readme",
"dependencies": {
"@babel/runtime": "^7.4.0",
"@polkadot/rpc-core": "^0.53.1",
"@polkadot/rpc-provider": "^0.53.1",
"@polkadot/rpc-core": "^0.75.0",
"@polkadot/rpc-provider": "^0.75.0",
"@types/memoizee": "^0.4.2",
"@types/rx": "^4.1.1",
"memoizee": "^0.4.14",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/extrinsics",
"version": "0.53.1",
"version": "0.75.0",
"main": "index.js",
"repository": "https://github.com/polkadot-js/api.git",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -11,7 +11,7 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.4.0",
"@polkadot/types": "^0.53.1",
"@polkadot/util": "^0.43.1"
"@polkadot/types": "^0.75.0",
"@polkadot/util": "^0.75.1"
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/jsonrpc",
"version": "0.53.1",
"version": "0.75.0",
"description": "Method definitions for the Polkadot RPC layer",
"main": "index.js",
"engines": {
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/storage",
"version": "0.53.1",
"version": "0.75.0",
"description": "Generic wrapper wrapper around state storage",
"main": "index.js",
"engines": {
@@ -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.43.1",
"@polkadot/types": "^0.53.1",
"@polkadot/util": "^0.43.1",
"@polkadot/util-crypto": "^0.43.1"
"@polkadot/keyring": "^0.75.1",
"@polkadot/types": "^0.75.0",
"@polkadot/util": "^0.75.1",
"@polkadot/util-crypto": "^0.75.1"
}
}
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "0.53.1",
"version": "0.75.0",
"description": "Implementation of the Parity codec",
"main": "index.js",
"keywords": [
@@ -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.43.1",
"@polkadot/util": "^0.43.1"
"@polkadot/keyring": "^0.75.1",
"@polkadot/util": "^0.75.1"
}
}
+12 -13
View File
@@ -83,23 +83,22 @@ export default class EnumType<T> extends Base<Codec> implements Codec {
return EnumType.createValue(def, 0);
}
private static createViaJSON (def: TypesDef, aliasses: Aliasses, key: string, value?: any) {
private static createViaJSON (def: TypesDef, _aliasses: Aliasses, key: string, value?: any) {
// JSON comes in the form of { "<type (lowercased)>": "<value for type>" }, here we
// additionally force to lower to ensure forward compat
const keys = Object.keys(def).map((u) => u.toLowerCase());
const index = keys
.map((k) => {
const a = Object
.keys(aliasses)
.find((a) => aliasses[a].toLowerCase() === k);
const keys = Object.keys(def).map((k) => k.toLowerCase());
return a
? a.toLowerCase()
: k;
})
.indexOf(key.toLowerCase());
// FIXME This whole lookup process is not vey efficient
const keyLower = key.toLowerCase();
const aliasses = Object.keys(_aliasses).reduce((aliasses, a) => {
aliasses[a.toLowerCase()] = _aliasses[a].toLowerCase();
assert(index !== -1, `Unable to reliably map input on JSON, cannot find '${key}' in ${keys.join(', ')}`);
return aliasses;
}, {} as Aliasses);
const aliasKey = aliasses[keyLower] || keyLower;
const index = keys.indexOf(aliasKey);
assert(index !== -1, `Cannot map input on JSON, unable to find '${key}' in ${keys.join(', ')}`);
return EnumType.createValue(def, index, value);
}
+15 -15
View File
@@ -1579,14 +1579,14 @@
typescript "^3.3.4000"
vuepress "^1.0.0-alpha.44"
"@polkadot/keyring@^0.43.1":
version "0.43.1"
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.43.1.tgz#08a4bca4c68a45ad897878e1451353eb77b34404"
integrity sha512-PzWTQAm8cKSGjRkYWQe0XMWKL4wQnfsJWL2GIFdyNH9z9JYmFmz9kSG8VqZw2CfQe8qiUsxtq7pnZNQ5yK005Q==
"@polkadot/keyring@^0.75.1":
version "0.75.1"
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-0.75.1.tgz#9b3c32f5f403ba2b7f6aed760750111f49240cdd"
integrity sha512-TdwtrEnTG0U7Ecnduuoi3ON2K2k+DMdsKWPjZmooaXb8x2piudDzg+ouVnU17uOWTWAOeofRrLZENzMfiXfKZA==
dependencies:
"@babel/runtime" "^7.4.0"
"@polkadot/util" "^0.43.1"
"@polkadot/util-crypto" "^0.43.1"
"@polkadot/util" "^0.75.1"
"@polkadot/util-crypto" "^0.75.1"
"@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.43.1":
version "0.43.1"
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.43.1.tgz#01514f9af0e53f1115db7b547939d12b997df9ee"
integrity sha512-uf0CiagIggkXQWNO6E02Fqp8s2t10EIOhgIvScCvcv1aUrRP7BZgQoJ/cs0OvJygSB30Q1+OeL8C7lJlzuD9sw==
"@polkadot/util-crypto@^0.75.1":
version "0.75.1"
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.75.1.tgz#9f2e85c3283a53248de7ac97cb08b82d6f13ea25"
integrity sha512-8LIRUzXY96H0cv5YA4r/+GYJB4f/gM+SGz6OaEv6NKBagaQpA6MOEJIgMFQ7tsB6eDh2dwYouDrKHT+qIFNsCw==
dependencies:
"@babel/runtime" "^7.4.0"
"@polkadot/util" "^0.43.1"
"@polkadot/util" "^0.75.1"
"@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.43.1":
version "0.43.1"
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.43.1.tgz#defa098ed2030e53633e849c38c832bc23c42c5a"
integrity sha512-pxZ4O+qk7u2rgF4PkRwf3LAv2gje5fwc4454/lMYpafCap5U8WeARMEtJ2UAxK1+npTWCwgXJkFXCI2CfdbyIw==
"@polkadot/util@^0.75.1":
version "0.75.1"
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.75.1.tgz#f1719b7ac416e73d0683e443498b9693d7ac42f4"
integrity sha512-rXd8J6MR0MLFoi1duddUNL0ftKBtpuysgxUU4hGuVq335jS7xqNAV//nwwLXSLCsOkd3rlLJSz6mxbFXH/PfrQ==
dependencies:
"@babel/runtime" "^7.4.0"
"@types/bn.js" "^4.11.4"