IndicesLookupSource (#2867)

This commit is contained in:
Jaco Greeff
2020-11-22 14:51:22 +01:00
committed by GitHub
parent 683c37b171
commit 2906b02e41
10 changed files with 32 additions and 14 deletions
@@ -1,10 +1,15 @@
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
// substrate
Address: 'LookupSource',
LookupSource: 'IndicesLookupSource',
AnchorData: {
anchoredBlock: 'u64',
docRoot: 'H256',
+5
View File
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
@@ -23,6 +25,7 @@ const versioned: OverrideVersionedType[] = [
DispatchError: 'DispatchErrorTo198',
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'IndicesLookupSource',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259',
@@ -42,6 +45,7 @@ const versioned: OverrideVersionedType[] = [
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'IndicesLookupSource',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259',
@@ -62,6 +66,7 @@ const versioned: OverrideVersionedType[] = [
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'IndicesLookupSource',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259',
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import { OverrideVersionedType } from '@polkadot/types/types';
const versioned: OverrideVersionedType[] = [
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
+2
View File
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import { OverrideVersionedType } from '@polkadot/types/types';
// structs need to be in order
+2
View File
@@ -1,6 +1,8 @@
// Copyright 2017-2020 @polkadot/types-known authors & contributors
// SPDX-License-Identifier: Apache-2.0
/* eslint-disable sort-keys */
import { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
+4 -4
View File
@@ -35,7 +35,7 @@ import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/ty
import type { AccountStatus, AccountValidity } from '@polkadot/types/interfaces/purchase';
import type { ActiveRecovery, RecoveryConfig } from '@polkadot/types/interfaces/recovery';
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
import type { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, CallHash, CallHashOf, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, GenericAddress, H160, H256, H512, Hash, Header, I32F32, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, OpaqueCall, Origin, OriginCaller, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, TransactionPriority, U32F32, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import type { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, CallHash, CallHashOf, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, ExtrinsicsWeight, Fixed128, Fixed64, FixedI128, FixedI64, FixedU128, FixedU64, H160, H256, H512, Hash, Header, I32F32, Index, IndicesLookupSource, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, ModuleId, Moment, MultiAddress, OpaqueCall, Origin, OriginCaller, PalletVersion, PalletsOrigin, Pays, PerU16, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Releases, RuntimeDbWeight, Seal, SealV0, SignedBlock, StorageData, TransactionPriority, U32F32, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
import type { SiField, SiLookupTypeId, SiPath, SiType, SiTypeDef, SiTypeDefArray, SiTypeDefComposite, SiTypeDefPrimitive, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiVariant } from '@polkadot/types/interfaces/scaleInfo';
import type { Period, Priority, SchedulePeriod, SchedulePriority, Scheduled, ScheduledTo254, TaskAddress } from '@polkadot/types/interfaces/scheduler';
import type { FullIdentification, IdentificationTuple, Keys, MembershipProof, SessionIndex, SessionKeys1, SessionKeys2, SessionKeys3, SessionKeys4, SessionKeys5, SessionKeys6, ValidatorCount } from '@polkadot/types/interfaces/session';
@@ -283,9 +283,6 @@ declare module '@polkadot/types/types/registry' {
ExtrinsicsWeight: ExtrinsicsWeight;
'Option<ExtrinsicsWeight>': Option<ExtrinsicsWeight>;
'Vec<ExtrinsicsWeight>': Vec<ExtrinsicsWeight>;
GenericAddress: GenericAddress;
'Option<GenericAddress>': Option<GenericAddress>;
'Vec<GenericAddress>': Vec<GenericAddress>;
H160: H160;
'Option<H160>': Option<H160>;
'Vec<H160>': Vec<H160>;
@@ -301,6 +298,9 @@ declare module '@polkadot/types/types/registry' {
Header: Header;
'Option<Header>': Option<Header>;
'Vec<Header>': Vec<Header>;
IndicesLookupSource: IndicesLookupSource;
'Option<IndicesLookupSource>': Option<IndicesLookupSource>;
'Vec<IndicesLookupSource>': Vec<IndicesLookupSource>;
Index: Index;
'Compact<Index>': Compact<Index>;
'Option<Index>': Option<Index>;
@@ -2,12 +2,12 @@
// SPDX-License-Identifier: Apache-2.0
import { TypeRegistry } from '../create';
import { GenericAccountId as AccountId, GenericAccountIndex as AccountIndex, GenericLookupSource as LookuoSource } from '.';
import { GenericAccountId as AccountId, GenericAccountIndex as AccountIndex, GenericLookupSource as LookupSource } from '.';
describe('LookupSource', (): void => {
const registry = new TypeRegistry();
const testDecode = (type: string, input: LookuoSource | AccountId | AccountIndex | number[] | Uint8Array, expected: string): void =>
const testDecode = (type: string, input: LookupSource | AccountId | AccountIndex | number[] | Uint8Array, expected: string): void =>
it(`can decode from ${type}`, (): void => {
const a = registry.createType('Address', input);
@@ -29,7 +29,7 @@ export default {
AccountId: 'GenericAccountId',
AccountIdOf: 'AccountId',
AccountIndex: 'GenericAccountIndex',
Address: 'GenericAddress',
Address: 'LookupSource',
AssetId: 'u32',
Balance: 'UInt<128, Balance>',
BalanceOf: 'Balance',
@@ -61,7 +61,6 @@ export default {
normal: 'Weight',
operational: 'Weight'
},
GenericAddress: 'LookupSource',
H160: '[u8; 20; H160]',
H256: '[u8; 32; H256]',
H512: '[u8; 64; H512]',
@@ -73,12 +72,13 @@ export default {
extrinsicsRoot: 'Hash',
digest: 'Digest'
},
IndicesLookupSource: 'GenericLookupSource',
Index: 'u32',
Justification: 'Bytes',
KeyValue: '(StorageKey, StorageData)',
KeyTypeId: 'u32',
LockIdentifier: '[u8; 8]',
LookupSource: 'GenericLookupSource',
LookupSource: 'IndicesLookupSource',
LookupTarget: 'AccountId',
ModuleId: 'LockIdentifier',
MultiAddress: 'GenericMultiAddress',
@@ -17,7 +17,7 @@ export interface AccountIdOf extends AccountId {}
export interface AccountIndex extends GenericAccountIndex {}
/** @name Address */
export interface Address extends GenericAddress {}
export interface Address extends LookupSource {}
/** @name AssetId */
export interface AssetId extends u32 {}
@@ -102,9 +102,6 @@ export interface FixedU128 extends UInt {}
/** @name FixedU64 */
export interface FixedU64 extends UInt {}
/** @name GenericAddress */
export interface GenericAddress extends LookupSource {}
/** @name H160 */
export interface H160 extends U8aFixed {}
@@ -132,6 +129,9 @@ export interface I32F32 extends Int {}
/** @name Index */
export interface Index extends u32 {}
/** @name IndicesLookupSource */
export interface IndicesLookupSource extends GenericLookupSource {}
/** @name Justification */
export interface Justification extends Bytes {}
@@ -145,7 +145,7 @@ export interface KeyValue extends ITuple<[StorageKey, StorageData]> {}
export interface LockIdentifier extends U8aFixed {}
/** @name LookupSource */
export interface LookupSource extends GenericLookupSource {}
export interface LookupSource extends IndicesLookupSource {}
/** @name LookupTarget */
export interface LookupTarget extends AccountId {}