Remove ::generic:: from names & namespaces (#4189)
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
# CHANGELOG
|
||||
|
||||
## master
|
||||
|
||||
Changes:
|
||||
|
||||
- Remove `::generic::` from names & namespaces under metadata v14
|
||||
|
||||
|
||||
## 6.7.2 Nov 9, 2021
|
||||
|
||||
Upgrade priority: Low. Recommended for chains on metadata v14 with non-default `Address` implementations.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { ApiTypes } from '@polkadot/api/types';
|
||||
import type { BTreeMap, Bytes, Data, Null, Option, U8aFixed, Vec, WrapperOpaque, bool, u128, u32, u64, u8 } from '@polkadot/types';
|
||||
import type { AccountId32, Call, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
|
||||
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetBalance, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmPrefabWasmModule, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerReleases, PalletSchedulerScheduledV2, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpRuntimeGenericDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
|
||||
import type { FrameSupportWeightsPerDispatchClassU64, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, NodeRuntimeSessionKeys, PalletAssetsApproval, PalletAssetsAssetBalance, PalletAssetsAssetDetails, PalletAssetsAssetMetadata, PalletAuthorshipUncleEntryItem, PalletBagsListListBag, PalletBagsListListNode, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesReleases, PalletBalancesReserveData, PalletBountiesBounty, PalletCollectiveVotes, PalletContractsStorageDeletedContract, PalletContractsStorageRawContractInfo, PalletContractsWasmPrefabWasmModule, PalletDemocracyPreimageStatus, PalletDemocracyReferendumInfo, PalletDemocracyReleases, PalletDemocracyVoteThreshold, PalletDemocracyVoteVoting, PalletElectionProviderMultiPhasePhase, PalletElectionProviderMultiPhaseReadySolution, PalletElectionProviderMultiPhaseRoundSnapshot, PalletElectionProviderMultiPhaseSignedSignedSubmission, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenSeatHolder, PalletElectionsPhragmenVoter, PalletGiltActiveGilt, PalletGiltActiveGiltsTotal, PalletGiltGiltBid, PalletGrandpaStoredPendingChange, PalletGrandpaStoredState, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletImOnlineBoundedOpaqueNetworkState, PalletImOnlineSr25519AppSr25519Public, PalletLotteryLotteryConfig, PalletMultisigMultisig, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletRecoveryActiveRecovery, PalletRecoveryRecoveryConfig, PalletSchedulerReleases, PalletSchedulerScheduledV2, PalletSocietyBid, PalletSocietyBidKind, PalletSocietyVote, PalletSocietyVouchingStatus, PalletStakingActiveEraInfo, PalletStakingEraRewardPoints, PalletStakingExposure, PalletStakingForcing, PalletStakingNominations, PalletStakingReleases, PalletStakingRewardDestination, PalletStakingSlashingSlashingSpans, PalletStakingSlashingSpanRecord, PalletStakingStakingLedger, PalletStakingUnappliedSlash, PalletStakingValidatorPrefs, PalletTipsOpenTip, PalletTransactionPaymentReleases, PalletTransactionStorageTransactionInfo, PalletTreasuryProposal, PalletUniquesClassDetails, PalletUniquesClassMetadata, PalletUniquesInstanceDetails, PalletUniquesInstanceMetadata, PalletVestingReleases, PalletVestingVestingInfo, SpAuthorityDiscoveryAppPublic, SpConsensusBabeAppPublic, SpConsensusBabeBabeEpochConfiguration, SpConsensusBabeDigestsNextConfigDescriptor, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpStakingOffenceOffenceDetails } from '@polkadot/types/lookup';
|
||||
import type { AnyNumber, ITuple, Observable } from '@polkadot/types/types';
|
||||
|
||||
declare module '@polkadot/api/types/storage' {
|
||||
@@ -1163,7 +1163,7 @@ declare module '@polkadot/api/types/storage' {
|
||||
/**
|
||||
* Digest of the current block, also part of the block header.
|
||||
**/
|
||||
digest: AugmentedQuery<ApiType, () => Observable<SpRuntimeGenericDigest>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
digest: AugmentedQuery<ApiType, () => Observable<SpRuntimeDigest>, []> & QueryableStorageEntry<ApiType, []>;
|
||||
/**
|
||||
* The number of events in the `Events<T>` list.
|
||||
**/
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { ApiTypes, SubmittableExtrinsic } from '@polkadot/api/types';
|
||||
import type { Bytes, Compact, Data, Option, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
|
||||
import type { Extrinsic } from '@polkadot/types/interfaces/extrinsics';
|
||||
import type { AccountId32, Call, H256, MultiAddress, Perbill, Percent, Perquintill } from '@polkadot/types/interfaces/runtime';
|
||||
import type { NodeRuntimeOriginCaller, NodeRuntimeProxyType, NodeRuntimeSessionKeys, PalletAssetsDestroyWitness, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletSocietyJudgement, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletUniquesDestroyWitness, PalletVestingVestingInfo, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpCoreChangesTrieChangesTrieConfiguration, SpFinalityGrandpaEquivocationProof, SpNposElectionsSupport, SpRuntimeGenericHeader, SpSessionMembershipProof, SpTransactionStorageProofTransactionStorageProof } from '@polkadot/types/lookup';
|
||||
import type { NodeRuntimeOriginCaller, NodeRuntimeProxyType, NodeRuntimeSessionKeys, PalletAssetsDestroyWitness, PalletDemocracyConviction, PalletDemocracyVoteAccountVote, PalletElectionProviderMultiPhaseRawSolution, PalletElectionProviderMultiPhaseSolutionOrSnapshotSize, PalletElectionsPhragmenRenouncing, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletImOnlineHeartbeat, PalletImOnlineSr25519AppSr25519Signature, PalletMultisigTimepoint, PalletSocietyJudgement, PalletStakingRewardDestination, PalletStakingValidatorPrefs, PalletUniquesDestroyWitness, PalletVestingVestingInfo, SpConsensusBabeDigestsNextConfigDescriptor, SpConsensusSlotsEquivocationProof, SpCoreChangesTrieChangesTrieConfiguration, SpFinalityGrandpaEquivocationProof, SpNposElectionsSupport, SpRuntimeHeader, SpSessionMembershipProof, SpTransactionStorageProofTransactionStorageProof } from '@polkadot/types/lookup';
|
||||
import type { AnyNumber, ITuple } from '@polkadot/types/types';
|
||||
|
||||
declare module '@polkadot/api/types/submittable' {
|
||||
@@ -425,7 +425,7 @@ declare module '@polkadot/api/types/submittable' {
|
||||
/**
|
||||
* Provide a set of uncles.
|
||||
**/
|
||||
setUncles: AugmentedSubmittable<(newUncles: Vec<SpRuntimeGenericHeader> | (SpRuntimeGenericHeader | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<SpRuntimeGenericHeader>]>;
|
||||
setUncles: AugmentedSubmittable<(newUncles: Vec<SpRuntimeHeader> | (SpRuntimeHeader | { parentHash?: any; number?: any; stateRoot?: any; extrinsicsRoot?: any; digest?: any } | string | Uint8Array)[]) => SubmittableExtrinsic<ApiType>, [Vec<SpRuntimeHeader>]>;
|
||||
/**
|
||||
* Generic tx
|
||||
**/
|
||||
|
||||
@@ -214,7 +214,7 @@ export default {
|
||||
bitfields: 'Vec<PolkadotPrimitivesV1SignedUncheckedSigned>',
|
||||
backedCandidates: 'Vec<PolkadotPrimitivesV1BackedCandidate>',
|
||||
disputes: 'Vec<PolkadotPrimitivesV1DisputeStatementSet>',
|
||||
parentHeader: 'SpRuntimeGenericHeader'
|
||||
parentHeader: 'SpRuntimeHeader'
|
||||
},
|
||||
/**
|
||||
* Lookup325: polkadot_primitives::v1::signed::UncheckedSigned<polkadot_primitives::v1::AvailabilityBitfield, polkadot_primitives::v1::AvailabilityBitfield>
|
||||
|
||||
@@ -36,13 +36,13 @@ export default {
|
||||
/**
|
||||
* Lookup11: sp_runtime::generic::digest::Digest<primitive_types::H256>
|
||||
**/
|
||||
SpRuntimeGenericDigest: {
|
||||
logs: 'Vec<SpRuntimeGenericDigestDigestItem>'
|
||||
SpRuntimeDigest: {
|
||||
logs: 'Vec<SpRuntimeDigestDigestItem>'
|
||||
},
|
||||
/**
|
||||
* Lookup13: sp_runtime::generic::digest::DigestItem<primitive_types::H256>
|
||||
**/
|
||||
SpRuntimeGenericDigestDigestItem: {
|
||||
SpRuntimeDigestDigestItem: {
|
||||
_enum: {
|
||||
Other: 'Bytes',
|
||||
__Unused1: 'Null',
|
||||
@@ -51,14 +51,14 @@ export default {
|
||||
Consensus: '([u8;4],Bytes)',
|
||||
Seal: '([u8;4],Bytes)',
|
||||
PreRuntime: '([u8;4],Bytes)',
|
||||
ChangesTrieSignal: 'SpRuntimeGenericDigestChangesTrieSignal',
|
||||
ChangesTrieSignal: 'SpRuntimeDigestChangesTrieSignal',
|
||||
RuntimeEnvironmentUpdated: 'Null'
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Lookup15: sp_runtime::generic::digest::ChangesTrieSignal
|
||||
**/
|
||||
SpRuntimeGenericDigestChangesTrieSignal: {
|
||||
SpRuntimeDigestChangesTrieSignal: {
|
||||
_enum: {
|
||||
NewConfiguration: 'Option<SpCoreChangesTrieChangesTrieConfiguration>'
|
||||
}
|
||||
@@ -271,18 +271,18 @@ export default {
|
||||
SpConsensusSlotsEquivocationProof: {
|
||||
offender: 'SpConsensusBabeAppPublic',
|
||||
slot: 'u64',
|
||||
firstHeader: 'SpRuntimeGenericHeader',
|
||||
secondHeader: 'SpRuntimeGenericHeader'
|
||||
firstHeader: 'SpRuntimeHeader',
|
||||
secondHeader: 'SpRuntimeHeader'
|
||||
},
|
||||
/**
|
||||
* Lookup123: sp_runtime::generic::header::Header<Number, sp_runtime::traits::BlakeTwo256>
|
||||
**/
|
||||
SpRuntimeGenericHeader: {
|
||||
SpRuntimeHeader: {
|
||||
parentHash: 'H256',
|
||||
number: 'Compact<u32>',
|
||||
stateRoot: 'H256',
|
||||
extrinsicsRoot: 'H256',
|
||||
digest: 'SpRuntimeGenericDigest'
|
||||
digest: 'SpRuntimeDigest'
|
||||
},
|
||||
/**
|
||||
* Lookup124: sp_runtime::traits::BlakeTwo256
|
||||
|
||||
@@ -160,7 +160,7 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly bitfields: Vec<PolkadotPrimitivesV1SignedUncheckedSigned>;
|
||||
readonly backedCandidates: Vec<PolkadotPrimitivesV1BackedCandidate>;
|
||||
readonly disputes: Vec<PolkadotPrimitivesV1DisputeStatementSet>;
|
||||
readonly parentHeader: SpRuntimeGenericHeader;
|
||||
readonly parentHeader: SpRuntimeHeader;
|
||||
}
|
||||
|
||||
/** @name PolkadotPrimitivesV1SignedUncheckedSigned (325) */
|
||||
|
||||
@@ -33,13 +33,13 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly mandatory: u64;
|
||||
}
|
||||
|
||||
/** @name SpRuntimeGenericDigest (11) */
|
||||
export interface SpRuntimeGenericDigest extends Struct {
|
||||
readonly logs: Vec<SpRuntimeGenericDigestDigestItem>;
|
||||
/** @name SpRuntimeDigest (11) */
|
||||
export interface SpRuntimeDigest extends Struct {
|
||||
readonly logs: Vec<SpRuntimeDigestDigestItem>;
|
||||
}
|
||||
|
||||
/** @name SpRuntimeGenericDigestDigestItem (13) */
|
||||
export interface SpRuntimeGenericDigestDigestItem extends Enum {
|
||||
/** @name SpRuntimeDigestDigestItem (13) */
|
||||
export interface SpRuntimeDigestDigestItem extends Enum {
|
||||
readonly isOther: boolean;
|
||||
readonly asOther: Bytes;
|
||||
readonly isChangesTrieRoot: boolean;
|
||||
@@ -51,12 +51,12 @@ declare module '@polkadot/types/lookup' {
|
||||
readonly isPreRuntime: boolean;
|
||||
readonly asPreRuntime: ITuple<[U8aFixed, Bytes]>;
|
||||
readonly isChangesTrieSignal: boolean;
|
||||
readonly asChangesTrieSignal: SpRuntimeGenericDigestChangesTrieSignal;
|
||||
readonly asChangesTrieSignal: SpRuntimeDigestChangesTrieSignal;
|
||||
readonly isRuntimeEnvironmentUpdated: boolean;
|
||||
}
|
||||
|
||||
/** @name SpRuntimeGenericDigestChangesTrieSignal (15) */
|
||||
export interface SpRuntimeGenericDigestChangesTrieSignal extends Enum {
|
||||
/** @name SpRuntimeDigestChangesTrieSignal (15) */
|
||||
export interface SpRuntimeDigestChangesTrieSignal extends Enum {
|
||||
readonly isNewConfiguration: boolean;
|
||||
readonly asNewConfiguration: Option<SpCoreChangesTrieChangesTrieConfiguration>;
|
||||
}
|
||||
@@ -260,17 +260,17 @@ declare module '@polkadot/types/lookup' {
|
||||
export interface SpConsensusSlotsEquivocationProof extends Struct {
|
||||
readonly offender: SpConsensusBabeAppPublic;
|
||||
readonly slot: u64;
|
||||
readonly firstHeader: SpRuntimeGenericHeader;
|
||||
readonly secondHeader: SpRuntimeGenericHeader;
|
||||
readonly firstHeader: SpRuntimeHeader;
|
||||
readonly secondHeader: SpRuntimeHeader;
|
||||
}
|
||||
|
||||
/** @name SpRuntimeGenericHeader (123) */
|
||||
export interface SpRuntimeGenericHeader extends Struct {
|
||||
/** @name SpRuntimeHeader (123) */
|
||||
export interface SpRuntimeHeader extends Struct {
|
||||
readonly parentHash: H256;
|
||||
readonly number: Compact<u32>;
|
||||
readonly stateRoot: H256;
|
||||
readonly extrinsicsRoot: H256;
|
||||
readonly digest: SpRuntimeGenericDigest;
|
||||
readonly digest: SpRuntimeDigest;
|
||||
}
|
||||
|
||||
/** @name SpRuntimeBlakeTwo256 (124) */
|
||||
|
||||
@@ -201,9 +201,9 @@ function extractName (types: PortableType[], { id, type: { params, path } }: Por
|
||||
.map((p) => stringUpperFirst(stringCamelCase(p)))
|
||||
.filter((p, index) =>
|
||||
(
|
||||
// Remove ::{misc, pallet, traits, types}::
|
||||
// Remove ::{generic, misc, pallet, traits, types}::
|
||||
index !== 1 ||
|
||||
!['Misc', 'Pallet', 'Traits', 'Types'].includes(p.toString())
|
||||
!['Generic', 'Misc', 'Pallet', 'Traits', 'Types'].includes(p.toString())
|
||||
) &&
|
||||
(
|
||||
// sp_runtime::generic::digest::Digest -> sp_runtime::generic::Digest
|
||||
@@ -226,7 +226,45 @@ function extractName (types: PortableType[], { id, type: { params, path } }: Por
|
||||
return [lookupIndex, typeName, params];
|
||||
}
|
||||
|
||||
function extractNames (lookup: PortableRegistry, types: PortableType[]): [Record<number, string>, Record<string, SiTypeParameter[]>] {
|
||||
function registerTypes (lookup: PortableRegistry, lookups: Record<string, string>, names: Record<number, string>, params: Record<string, SiTypeParameter[]>): void {
|
||||
// Register the types we extracted
|
||||
lookup.registry.register(lookups);
|
||||
|
||||
// Try and extract the AccountId/Address/Signature type from UncheckedExtrinsic
|
||||
if (params.SpRuntimeUncheckedExtrinsic) {
|
||||
// Address, Call, Signature, Extra
|
||||
const [addrParam,, sigParam] = params.SpRuntimeUncheckedExtrinsic;
|
||||
const siAddress = lookup.getSiType(addrParam.type.unwrap());
|
||||
const siSignature = lookup.getSiType(sigParam.type.unwrap());
|
||||
const nsSignature = createNamespace(siSignature);
|
||||
let nsAccountId = createNamespace(siAddress);
|
||||
const isMultiAddress = nsAccountId === 'sp_runtime::multiaddress::MultiAddress';
|
||||
|
||||
// With multiaddress, we check the first type param again
|
||||
if (isMultiAddress) {
|
||||
// AccountId, AccountIndex
|
||||
const [idParam] = siAddress.params;
|
||||
|
||||
nsAccountId = createNamespace(lookup.getSiType(idParam.type.unwrap()));
|
||||
}
|
||||
|
||||
lookup.registry.register({
|
||||
AccountId: ['sp_core::crypto::AccountId32'].includes(nsAccountId)
|
||||
? 'AccountId32'
|
||||
: ['account::AccountId20', 'primitive_types::H160'].includes(nsAccountId)
|
||||
? 'AccountId20'
|
||||
: 'AccountId32', // other, default to AccountId32
|
||||
Address: isMultiAddress
|
||||
? 'MultiAddress'
|
||||
: 'AccountId',
|
||||
ExtrinsicSignature: ['sp_runtime::MultiSignature'].includes(nsSignature)
|
||||
? 'MultiSignature'
|
||||
: names[sigParam.type.unwrap().toNumber()] || 'MultiSignature'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function extractNames (lookup: PortableRegistry, types: PortableType[]): Record<number, string> {
|
||||
const dedup = removeDuplicateNames(lookup, types.map((t) =>
|
||||
extractName(types, t)
|
||||
));
|
||||
@@ -243,9 +281,9 @@ function extractNames (lookup: PortableRegistry, types: PortableType[]): [Record
|
||||
params[name] = p;
|
||||
}
|
||||
|
||||
lookup.registry.register(lookups);
|
||||
registerTypes(lookup, lookups, names, params);
|
||||
|
||||
return [names, params];
|
||||
return names;
|
||||
}
|
||||
|
||||
// types have an id, which means they are to be named by
|
||||
@@ -274,44 +312,9 @@ export class PortableRegistry extends Struct {
|
||||
types: 'Vec<PortableType>'
|
||||
}, value);
|
||||
|
||||
const [names, params] = extractNames(this, this.types);
|
||||
|
||||
this.#names = names;
|
||||
this.#names = extractNames(this, this.types);
|
||||
this.#types = extractTypeMap(this.types);
|
||||
|
||||
// Try and extract the AccountId/Address/Signature type from UncheckedExtrinsic
|
||||
if (params.SpRuntimeGenericUncheckedExtrinsic) {
|
||||
// Address, Call, Signature, Extra
|
||||
const [addrParam,, sigParam] = params.SpRuntimeGenericUncheckedExtrinsic;
|
||||
const siAddress = this.getSiType(addrParam.type.unwrap());
|
||||
const siSignature = this.getSiType(sigParam.type.unwrap());
|
||||
const nsSignature = createNamespace(siSignature);
|
||||
let nsAccountId = createNamespace(siAddress);
|
||||
const isMultiAddress = nsAccountId === 'sp_runtime::multiaddress::MultiAddress';
|
||||
|
||||
// With multiaddress, we check the first type param again
|
||||
if (isMultiAddress) {
|
||||
// AccountId, AccountIndex
|
||||
const [idParam] = siAddress.params;
|
||||
|
||||
nsAccountId = createNamespace(this.getSiType(idParam.type.unwrap()));
|
||||
}
|
||||
|
||||
this.registry.register({
|
||||
AccountId: ['sp_core::crypto::AccountId32'].includes(nsAccountId)
|
||||
? 'AccountId32'
|
||||
: ['account::AccountId20', 'primitive_types::H160'].includes(nsAccountId)
|
||||
? 'AccountId20'
|
||||
: 'AccountId32', // other, default to AccountId32
|
||||
Address: isMultiAddress
|
||||
? 'MultiAddress'
|
||||
: 'AccountId',
|
||||
ExtrinsicSignature: ['sp_runtime::MultiSignature'].includes(nsSignature)
|
||||
? 'MultiSignature'
|
||||
: names[sigParam.type.unwrap().toNumber()] || 'MultiSignature'
|
||||
});
|
||||
}
|
||||
|
||||
// console.timeEnd('PortableRegistry')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user