Encode mock results as string (#69)
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@polkadot/primitives-json": "^0.10.1",
|
"@polkadot/primitives-json": "^0.10.1",
|
||||||
"@polkadot/util": "^0.18.5",
|
"@polkadot/util": "^0.18.6",
|
||||||
"babel-runtime": "^6.26.0"
|
"babel-runtime": "^6.26.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,9 +34,9 @@
|
|||||||
"nock": "^9.1.0"
|
"nock": "^9.1.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@polkadot/util": "^0.18.5",
|
"@polkadot/util": "^0.18.6",
|
||||||
"@polkadot/util-crypto": "^0.18.5",
|
"@polkadot/util-crypto": "^0.18.6",
|
||||||
"@polkadot/util-keyring": "^0.18.5",
|
"@polkadot/util-keyring": "^0.18.6",
|
||||||
"babel-runtime": "^6.26.0",
|
"babel-runtime": "^6.26.0",
|
||||||
"isomorphic-fetch": "^2.2.1",
|
"isomorphic-fetch": "^2.2.1",
|
||||||
"websocket": "^1.0.25"
|
"websocket": "^1.0.25"
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
import type { MockState, MockState$Storage } from './types';
|
import type { MockState, MockState$Storage } from './types';
|
||||||
|
|
||||||
const interfaces = require('@polkadot/api-jsonrpc');
|
const interfaces = require('@polkadot/api-jsonrpc');
|
||||||
|
const u8aToHex = require('@polkadot/util/u8a/toHex');
|
||||||
const l = require('@polkadot/util/logger')('api-mock');
|
const l = require('@polkadot/util/logger')('api-mock');
|
||||||
|
|
||||||
const SUBSCRIPTIONS = Array.prototype.concat.apply(
|
const SUBSCRIPTIONS = Array.prototype.concat.apply(
|
||||||
@@ -18,9 +19,11 @@ const SUBSCRIPTIONS = Array.prototype.concat.apply(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const REQUESTS = {
|
const REQUESTS = {
|
||||||
'state_getStorage': (storage: MockState$Storage, params: Array<mixed>): Uint8Array => {
|
'state_getStorage': (storage: MockState$Storage, params: Array<mixed>): string => {
|
||||||
// flowlint-next-line unclear-type:off
|
return u8aToHex(
|
||||||
return storage[((params[0]: any): string)];
|
// flowlint-next-line unclear-type:off
|
||||||
|
storage[((params[0]: any): string)]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export type MockState$Storage = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type MockState$Requests = {
|
export type MockState$Requests = {
|
||||||
[string]: (storage: MockState$Storage, params: Array<mixed>) => mixed
|
[string]: (storage: MockState$Storage, params: Array<mixed>) => string
|
||||||
};
|
};
|
||||||
|
|
||||||
export type MockState = {
|
export type MockState = {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"@polkadot/api-format": "^0.8.13",
|
"@polkadot/api-format": "^0.8.13",
|
||||||
"@polkadot/api-jsonrpc": "^0.8.13",
|
"@polkadot/api-jsonrpc": "^0.8.13",
|
||||||
"@polkadot/api-provider": "^0.8.13",
|
"@polkadot/api-provider": "^0.8.13",
|
||||||
"@polkadot/util": "^0.18.5",
|
"@polkadot/util": "^0.18.6",
|
||||||
"babel-runtime": "^6.26.0"
|
"babel-runtime": "^6.26.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,9 +176,9 @@
|
|||||||
tweetnacl "^1.0.0"
|
tweetnacl "^1.0.0"
|
||||||
xxhashjs "^0.2.2"
|
xxhashjs "^0.2.2"
|
||||||
|
|
||||||
"@polkadot/util-crypto@^0.18.5":
|
"@polkadot/util-crypto@^0.18.6":
|
||||||
version "0.18.5"
|
version "0.18.6"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.18.5.tgz#59574ff59a488ee5640ecf1862638f3b9647ffa7"
|
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-0.18.6.tgz#57735d2056d178a3e741ca402ea1ae43267d81f8"
|
||||||
dependencies:
|
dependencies:
|
||||||
babel-runtime "^6.26.0"
|
babel-runtime "^6.26.0"
|
||||||
blakejs "^1.1.0"
|
blakejs "^1.1.0"
|
||||||
@@ -194,12 +194,12 @@
|
|||||||
"@polkadot/util-crypto" "^0.18.4"
|
"@polkadot/util-crypto" "^0.18.4"
|
||||||
babel-runtime "^6.26.0"
|
babel-runtime "^6.26.0"
|
||||||
|
|
||||||
"@polkadot/util-keyring@^0.18.5":
|
"@polkadot/util-keyring@^0.18.6":
|
||||||
version "0.18.5"
|
version "0.18.6"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/util-keyring/-/util-keyring-0.18.5.tgz#019eb52870974b3fd596ba68347b6c1e09290589"
|
resolved "https://registry.yarnpkg.com/@polkadot/util-keyring/-/util-keyring-0.18.6.tgz#983b58ac371a5866adcc0469d8c03a24a7a77f06"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@polkadot/util" "^0.18.5"
|
"@polkadot/util" "^0.18.6"
|
||||||
"@polkadot/util-crypto" "^0.18.5"
|
"@polkadot/util-crypto" "^0.18.6"
|
||||||
babel-runtime "^6.26.0"
|
babel-runtime "^6.26.0"
|
||||||
|
|
||||||
"@polkadot/util-rlp@^0.18.4":
|
"@polkadot/util-rlp@^0.18.4":
|
||||||
@@ -227,9 +227,9 @@
|
|||||||
deasync "^0.1.12"
|
deasync "^0.1.12"
|
||||||
ip-regex "^2.1.0"
|
ip-regex "^2.1.0"
|
||||||
|
|
||||||
"@polkadot/util@^0.18.5":
|
"@polkadot/util@^0.18.6":
|
||||||
version "0.18.5"
|
version "0.18.6"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.18.5.tgz#98c04608fceadaaace765eb44253912edc007651"
|
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-0.18.6.tgz#dd3ea07d67d31de02a154dd54665ce9779a73211"
|
||||||
dependencies:
|
dependencies:
|
||||||
babel-runtime "^6.26.0"
|
babel-runtime "^6.26.0"
|
||||||
bn.js "^4.11.8"
|
bn.js "^4.11.8"
|
||||||
|
|||||||
Reference in New Issue
Block a user