Decode poc-2 & poc-1 extrinsics from JSON (#138)
This commit is contained in:
@@ -5,11 +5,12 @@
|
||||
import { EncodingVersions, Param$Decoded, Param$Type } from '../../types';
|
||||
import { Decoder } from '../types';
|
||||
|
||||
import sizes from '@polkadot/primitives/sizes';
|
||||
import defaultSizes from '@polkadot/primitives/sizes';
|
||||
import toU8a from '@polkadot/util/u8a/toU8a';
|
||||
import isNull from '@polkadot/util/is/null';
|
||||
import isUndefined from '@polkadot/util/is/undefined';
|
||||
|
||||
import sizes from '../../sizes';
|
||||
import accountId from './accountId';
|
||||
import bool from './bool';
|
||||
import bn from './bn';
|
||||
@@ -37,8 +38,11 @@ export default function decodeValue (decode: Decoder, type: Param$Type, _input:
|
||||
case 'AccountId':
|
||||
return accountId(input, version, isStorage);
|
||||
|
||||
case 'AccountIndex':
|
||||
return bn(input, sizes.AccountIndex.get(version) || defaultSizes.AccountIndex);
|
||||
|
||||
case 'Balance':
|
||||
return bn(input, sizes.Balance);
|
||||
return bn(input, sizes.Balance.get(version) || defaultSizes.Balance);
|
||||
|
||||
case 'BlockNumber':
|
||||
case 'Gas':
|
||||
@@ -72,9 +76,6 @@ export default function decodeValue (decode: Decoder, type: Param$Type, _input:
|
||||
case 'Hash':
|
||||
return u8a(input, 256, 0);
|
||||
|
||||
case 'AccountIndex':
|
||||
return bn(input, sizes.AccountIndex);
|
||||
|
||||
case 'KeyValue':
|
||||
case 'StorageKeyValue':
|
||||
return keyValue(input);
|
||||
|
||||
Vendored
+1
-1
@@ -27,7 +27,7 @@ export type ExtrinsicDecoded = {
|
||||
|
||||
export type BlockExtrinsicDecoded = {
|
||||
address: string,
|
||||
nonce: BN,
|
||||
accountIndex: BN,
|
||||
extrinsic: SectionItem<Extrinsics>,
|
||||
params: Array<any>,
|
||||
signature: Uint8Array
|
||||
|
||||
Reference in New Issue
Block a user