0.75
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,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": {
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user