Fix StorageKey args throw
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@
|
||||
"@babel/core": "^7.8.4",
|
||||
"@babel/register": "^7.8.3",
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/dev": "^0.50.27",
|
||||
"@polkadot/dev": "^0.50.28",
|
||||
"@polkadot/ts": "^0.3.7",
|
||||
"@polkadot/typegen": "workspace:packages/typegen",
|
||||
"copyfiles": "^2.2.0"
|
||||
|
||||
@@ -27,12 +27,12 @@ export function member (api: ApiInterfaceRx): (accountId: AccountId) => Observab
|
||||
[api.query.society.suspendedMembers, accountId],
|
||||
[api.query.society.vouching, accountId]
|
||||
]).pipe(
|
||||
map(([payouts, strikes, defenderVote, suspended, vouching]: Result): DeriveSocietyMember => ({
|
||||
map(([payouts, strikes, defenderVotes, suspended, vouching]: Result): DeriveSocietyMember => ({
|
||||
accountId,
|
||||
payouts,
|
||||
isSuspended: suspended.isTrue,
|
||||
strikes,
|
||||
vote: defenderVote.unwrapOr(undefined),
|
||||
vote: defenderVotes.unwrapOr(undefined),
|
||||
vouching: vouching.unwrapOr(undefined)
|
||||
}))
|
||||
)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright 2017-2020 @polkadot/api authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ApiPromise, WsProvider } from '@polkadot/api';
|
||||
|
||||
describe.skip('misc quick tests', (): void => {
|
||||
it.skip('does something in society', async (): Promise<void> => {
|
||||
const provider = new WsProvider('wss://kusama-rpc.polkadot.io');
|
||||
const api = await new ApiPromise({ provider }).isReady;
|
||||
|
||||
console.error(api.query.society.defenderVotes.creator.meta.toHuman());
|
||||
|
||||
await api.query.society.defenderVotes('Dab4bfYTZRUDMWjYAUQuFbDreQ9mt7nULWu3Dw7jodbzVe9');
|
||||
});
|
||||
});
|
||||
@@ -235,6 +235,8 @@ describe('StorageKey', (): void => {
|
||||
describe('with MetadataV11', (): void => {
|
||||
const metadata = new Metadata(registry, rpcDataV11);
|
||||
|
||||
// 0x426e15054d267946093858132eb537f191ca57b0c4b20b29ae7e99d6201d680cc906f7710aa165d62c709012f807af8fc3f0d2abb0c51ca9a88d4ef24d1a092bf89dacf5ce63ea1d
|
||||
|
||||
it('should allow decoding of a key', (): void => {
|
||||
const key = new StorageKey(registry, '0x5f3e4907f716ac89b6347d15ececedca8bde0a0ea8864605e3b68ed9cb2da01b66ccada06515787c10000000e535263148daaf49be5ddb1579b72e84524fc29e78609e3caf42e85aa118ebfe0b0ad404b5bdd25f');
|
||||
|
||||
|
||||
@@ -246,7 +246,11 @@ export default class StorageKey extends Bytes {
|
||||
* @description Decode the args embedded in the key (assuming we have decodable hashers)
|
||||
*/
|
||||
public decodeArgsFromMeta (meta?: StorageEntryMetadataLatest): this {
|
||||
this._args = decodeArgsFromMeta(this.registry, this.toU8a(true), meta || this.meta);
|
||||
try {
|
||||
this._args = decodeArgsFromMeta(this.registry, this.toU8a(true), meta || this.meta);
|
||||
} catch (error) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -2802,9 +2802,9 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@polkadot/dev@npm:^0.50.27":
|
||||
version: 0.50.27
|
||||
resolution: "@polkadot/dev@npm:0.50.27"
|
||||
"@polkadot/dev@npm:^0.50.28":
|
||||
version: 0.50.28
|
||||
resolution: "@polkadot/dev@npm:0.50.28"
|
||||
dependencies:
|
||||
"@babel/cli": ^7.8.4
|
||||
"@babel/core": ^7.8.6
|
||||
@@ -2886,7 +2886,7 @@ __metadata:
|
||||
polkadot-exec-typedoc: scripts/polkadot-exec-typedoc.js
|
||||
polkadot-exec-vuepress: scripts/polkadot-exec-vuepress.js
|
||||
polkadot-exec-webpack: scripts/polkadot-exec-webpack.js
|
||||
checksum: 2/6198f095e351835d0491d0a9ea881add1e2eacb9b4ea342cf954d476ec11ef97faf54dac032b57f011d7074af2e891806b2c7ed21953e9208781450ae103faba
|
||||
checksum: 2/2195c3ed43115d4aa3ea56eb8991f8126ced4b98bd8190e7b46465cbf3b249e59d5c916e886fb121205f80ba2c97650bc830d69d2ff93d39b0951af2771ca1fe
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -15591,7 +15591,7 @@ resolve@1.1.7:
|
||||
"@babel/core": ^7.8.4
|
||||
"@babel/register": ^7.8.3
|
||||
"@babel/runtime": ^7.8.4
|
||||
"@polkadot/dev": ^0.50.27
|
||||
"@polkadot/dev": ^0.50.28
|
||||
"@polkadot/ts": ^0.3.7
|
||||
"@polkadot/typegen": "workspace:packages/typegen"
|
||||
copyfiles: ^2.2.0
|
||||
|
||||
Reference in New Issue
Block a user