@pezkuwi/types 16.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/build/bundle.d.ts +11 -0
- package/build/codec/index.d.ts +1 -0
- package/build/codec/types.d.ts +1 -0
- package/build/create/createClass.d.ts +3 -0
- package/build/create/createType.d.ts +9 -0
- package/build/create/index.d.ts +5 -0
- package/build/create/lazy.d.ts +7 -0
- package/build/create/registry.d.ts +74 -0
- package/build/create/types.d.ts +3 -0
- package/build/ethereum/AccountId.d.ts +36 -0
- package/build/ethereum/LookupSource.d.ts +41 -0
- package/build/ethereum/index.d.ts +2 -0
- package/build/extrinsic/Extrinsic.d.ts +166 -0
- package/build/extrinsic/ExtrinsicEra.d.ts +97 -0
- package/build/extrinsic/ExtrinsicPayload.d.ts +117 -0
- package/build/extrinsic/ExtrinsicPayloadUnknown.d.ts +11 -0
- package/build/extrinsic/ExtrinsicUnknown.d.ts +11 -0
- package/build/extrinsic/SignerPayload.d.ts +54 -0
- package/build/extrinsic/constants.d.ts +12 -0
- package/build/extrinsic/index.d.ts +8 -0
- package/build/extrinsic/signedExtensions/emptyCheck.d.ts +2 -0
- package/build/extrinsic/signedExtensions/index.d.ts +5 -0
- package/build/extrinsic/signedExtensions/polkadot.d.ts +2 -0
- package/build/extrinsic/signedExtensions/shell.d.ts +2 -0
- package/build/extrinsic/signedExtensions/statemint.d.ts +2 -0
- package/build/extrinsic/signedExtensions/substrate.d.ts +2 -0
- package/build/extrinsic/signedExtensions/types.d.ts +6 -0
- package/build/extrinsic/types.d.ts +17 -0
- package/build/extrinsic/util.d.ts +5 -0
- package/build/extrinsic/v4/Extrinsic.d.ts +49 -0
- package/build/extrinsic/v4/ExtrinsicPayload.d.ts +66 -0
- package/build/extrinsic/v4/ExtrinsicSignature.d.ts +85 -0
- package/build/extrinsic/v4/index.d.ts +3 -0
- package/build/extrinsic/v5/Extrinsic.d.ts +59 -0
- package/build/extrinsic/v5/ExtrinsicPayload.d.ts +67 -0
- package/build/extrinsic/v5/ExtrinsicSignature.d.ts +98 -0
- package/build/extrinsic/v5/GeneralExtrinsic.d.ts +85 -0
- package/build/extrinsic/v5/index.d.ts +4 -0
- package/build/generic/AccountId.d.ts +45 -0
- package/build/generic/AccountIndex.d.ts +39 -0
- package/build/generic/Block.d.ts +42 -0
- package/build/generic/Call.d.ts +69 -0
- package/build/generic/ChainProperties.d.ts +22 -0
- package/build/generic/ConsensusEngineId.d.ts +53 -0
- package/build/generic/Event.d.ts +76 -0
- package/build/generic/LookupSource.d.ts +45 -0
- package/build/generic/MultiAddress.d.ts +13 -0
- package/build/generic/Vote.d.ts +44 -0
- package/build/generic/index.d.ts +11 -0
- package/build/index.d.ts +2 -0
- package/build/index.types.d.ts +3 -0
- package/build/interfaces/alias.d.ts +5 -0
- package/build/interfaces/assetConversion/definitions.d.ts +3 -0
- package/build/interfaces/assetConversion/index.d.ts +1 -0
- package/build/interfaces/assetConversion/runtime.d.ts +2 -0
- package/build/interfaces/assetConversion/types.d.ts +6 -0
- package/build/interfaces/assets/definitions.d.ts +3 -0
- package/build/interfaces/assets/index.d.ts +1 -0
- package/build/interfaces/assets/runtime.d.ts +2 -0
- package/build/interfaces/assets/types.d.ts +54 -0
- package/build/interfaces/attestations/definitions.d.ts +3 -0
- package/build/interfaces/attestations/index.d.ts +1 -0
- package/build/interfaces/attestations/types.d.ts +22 -0
- package/build/interfaces/aura/definitions.d.ts +3 -0
- package/build/interfaces/aura/index.d.ts +1 -0
- package/build/interfaces/aura/runtime.d.ts +2 -0
- package/build/interfaces/aura/types.d.ts +6 -0
- package/build/interfaces/author/definitions.d.ts +3 -0
- package/build/interfaces/author/index.d.ts +1 -0
- package/build/interfaces/author/rpc.d.ts +2 -0
- package/build/interfaces/author/types.d.ts +31 -0
- package/build/interfaces/authorship/definitions.d.ts +3 -0
- package/build/interfaces/authorship/index.d.ts +1 -0
- package/build/interfaces/authorship/types.d.ts +12 -0
- package/build/interfaces/babe/definitions.d.ts +3 -0
- package/build/interfaces/babe/index.d.ts +1 -0
- package/build/interfaces/babe/rpc.d.ts +2 -0
- package/build/interfaces/babe/runtime.d.ts +2 -0
- package/build/interfaces/babe/types.d.ts +166 -0
- package/build/interfaces/balances/definitions.d.ts +3 -0
- package/build/interfaces/balances/index.d.ts +1 -0
- package/build/interfaces/balances/types.d.ts +58 -0
- package/build/interfaces/beefy/definitions.d.ts +3 -0
- package/build/interfaces/beefy/index.d.ts +1 -0
- package/build/interfaces/beefy/rpc.d.ts +2 -0
- package/build/interfaces/beefy/runtime.d.ts +2 -0
- package/build/interfaces/beefy/types.d.ts +74 -0
- package/build/interfaces/benchmark/definitions.d.ts +3 -0
- package/build/interfaces/benchmark/index.d.ts +1 -0
- package/build/interfaces/benchmark/runtime.d.ts +2 -0
- package/build/interfaces/benchmark/types.d.ts +71 -0
- package/build/interfaces/blockbuilder/definitions.d.ts +3 -0
- package/build/interfaces/blockbuilder/index.d.ts +1 -0
- package/build/interfaces/blockbuilder/runtime.d.ts +2 -0
- package/build/interfaces/blockbuilder/types.d.ts +15 -0
- package/build/interfaces/bridges/definitions.d.ts +3 -0
- package/build/interfaces/bridges/index.d.ts +1 -0
- package/build/interfaces/bridges/types.d.ts +129 -0
- package/build/interfaces/chain/definitions.d.ts +3 -0
- package/build/interfaces/chain/index.d.ts +1 -0
- package/build/interfaces/chain/rpc.d.ts +2 -0
- package/build/interfaces/chain/types.d.ts +5 -0
- package/build/interfaces/childstate/definitions.d.ts +3 -0
- package/build/interfaces/childstate/index.d.ts +1 -0
- package/build/interfaces/childstate/rpc.d.ts +2 -0
- package/build/interfaces/childstate/types.d.ts +5 -0
- package/build/interfaces/claims/definitions.d.ts +3 -0
- package/build/interfaces/claims/index.d.ts +1 -0
- package/build/interfaces/claims/types.d.ts +8 -0
- package/build/interfaces/collective/definitions.d.ts +3 -0
- package/build/interfaces/collective/index.d.ts +1 -0
- package/build/interfaces/collective/types.d.ts +33 -0
- package/build/interfaces/consensus/definitions.d.ts +3 -0
- package/build/interfaces/consensus/index.d.ts +1 -0
- package/build/interfaces/consensus/types.d.ts +9 -0
- package/build/interfaces/contracts/definitions.d.ts +3 -0
- package/build/interfaces/contracts/index.d.ts +1 -0
- package/build/interfaces/contracts/rpc.d.ts +2 -0
- package/build/interfaces/contracts/runtime.d.ts +2 -0
- package/build/interfaces/contracts/types.d.ts +490 -0
- package/build/interfaces/contractsAbi/definitions.d.ts +3 -0
- package/build/interfaces/contractsAbi/index.d.ts +1 -0
- package/build/interfaces/contractsAbi/types.d.ts +393 -0
- package/build/interfaces/crowdloan/definitions.d.ts +3 -0
- package/build/interfaces/crowdloan/index.d.ts +1 -0
- package/build/interfaces/crowdloan/types.d.ts +32 -0
- package/build/interfaces/cumulus/definitions.d.ts +3 -0
- package/build/interfaces/cumulus/index.d.ts +1 -0
- package/build/interfaces/cumulus/runtime.d.ts +2 -0
- package/build/interfaces/cumulus/types.d.ts +40 -0
- package/build/interfaces/definitions.d.ts +75 -0
- package/build/interfaces/democracy/definitions.d.ts +4 -0
- package/build/interfaces/democracy/index.d.ts +1 -0
- package/build/interfaces/democracy/types.d.ts +134 -0
- package/build/interfaces/dev/definitions.d.ts +3 -0
- package/build/interfaces/dev/index.d.ts +1 -0
- package/build/interfaces/dev/rpc.d.ts +2 -0
- package/build/interfaces/dev/types.d.ts +9 -0
- package/build/interfaces/discovery/definitions.d.ts +3 -0
- package/build/interfaces/discovery/index.d.ts +1 -0
- package/build/interfaces/discovery/runtime.d.ts +2 -0
- package/build/interfaces/discovery/types.d.ts +1 -0
- package/build/interfaces/dryRunApi/definitions.d.ts +3 -0
- package/build/interfaces/dryRunApi/index.d.ts +1 -0
- package/build/interfaces/dryRunApi/runtime.d.ts +2 -0
- package/build/interfaces/dryRunApi/types.d.ts +37 -0
- package/build/interfaces/elections/definitions.d.ts +3 -0
- package/build/interfaces/elections/index.d.ts +1 -0
- package/build/interfaces/elections/types.d.ts +44 -0
- package/build/interfaces/engine/definitions.d.ts +3 -0
- package/build/interfaces/engine/index.d.ts +1 -0
- package/build/interfaces/engine/rpc.d.ts +2 -0
- package/build/interfaces/engine/types.d.ts +17 -0
- package/build/interfaces/essentials.d.ts +3 -0
- package/build/interfaces/eth/definitions.d.ts +7 -0
- package/build/interfaces/eth/index.d.ts +1 -0
- package/build/interfaces/eth/rpc.d.ts +2 -0
- package/build/interfaces/eth/runtime.d.ts +2 -0
- package/build/interfaces/eth/types.d.ts +459 -0
- package/build/interfaces/evm/definitions.d.ts +3 -0
- package/build/interfaces/evm/index.d.ts +1 -0
- package/build/interfaces/evm/types.d.ts +109 -0
- package/build/interfaces/extrinsics/definitions.d.ts +3 -0
- package/build/interfaces/extrinsics/index.d.ts +1 -0
- package/build/interfaces/extrinsics/types.d.ts +77 -0
- package/build/interfaces/finality/definitions.d.ts +3 -0
- package/build/interfaces/finality/index.d.ts +1 -0
- package/build/interfaces/finality/runtime.d.ts +2 -0
- package/build/interfaces/finality/types.d.ts +1 -0
- package/build/interfaces/fungibles/definitions.d.ts +3 -0
- package/build/interfaces/fungibles/index.d.ts +1 -0
- package/build/interfaces/fungibles/runtime.d.ts +2 -0
- package/build/interfaces/fungibles/types.d.ts +8 -0
- package/build/interfaces/genericAsset/definitions.d.ts +3 -0
- package/build/interfaces/genericAsset/index.d.ts +1 -0
- package/build/interfaces/genericAsset/types.d.ts +30 -0
- package/build/interfaces/genesisBuilder/definitions.d.ts +3 -0
- package/build/interfaces/genesisBuilder/index.d.ts +1 -0
- package/build/interfaces/genesisBuilder/runtime.d.ts +2 -0
- package/build/interfaces/genesisBuilder/types.d.ts +5 -0
- package/build/interfaces/gilt/definitions.d.ts +3 -0
- package/build/interfaces/gilt/index.d.ts +1 -0
- package/build/interfaces/gilt/types.d.ts +25 -0
- package/build/interfaces/grandpa/definitions.d.ts +3 -0
- package/build/interfaces/grandpa/index.d.ts +1 -0
- package/build/interfaces/grandpa/rpc.d.ts +2 -0
- package/build/interfaces/grandpa/runtime.d.ts +2 -0
- package/build/interfaces/grandpa/types.d.ts +175 -0
- package/build/interfaces/identity/definitions.d.ts +3 -0
- package/build/interfaces/identity/index.d.ts +1 -0
- package/build/interfaces/identity/types.d.ts +78 -0
- package/build/interfaces/imOnline/definitions.d.ts +3 -0
- package/build/interfaces/imOnline/index.d.ts +1 -0
- package/build/interfaces/imOnline/types.d.ts +37 -0
- package/build/interfaces/index.d.ts +1 -0
- package/build/interfaces/jsonrpc.d.ts +3 -0
- package/build/interfaces/lottery/definitions.d.ts +3 -0
- package/build/interfaces/lottery/index.d.ts +1 -0
- package/build/interfaces/lottery/types.d.ts +15 -0
- package/build/interfaces/metadata/definitions.d.ts +5 -0
- package/build/interfaces/metadata/hashers.d.ts +9 -0
- package/build/interfaces/metadata/index.d.ts +1 -0
- package/build/interfaces/metadata/runtime.d.ts +2 -0
- package/build/interfaces/metadata/types.d.ts +771 -0
- package/build/interfaces/metadata/v10.d.ts +2 -0
- package/build/interfaces/metadata/v11.d.ts +2 -0
- package/build/interfaces/metadata/v12.d.ts +2 -0
- package/build/interfaces/metadata/v13.d.ts +2 -0
- package/build/interfaces/metadata/v14.d.ts +2 -0
- package/build/interfaces/metadata/v15.d.ts +2 -0
- package/build/interfaces/metadata/v16.d.ts +2 -0
- package/build/interfaces/metadata/v9.d.ts +2 -0
- package/build/interfaces/mixnet/definitions.d.ts +3 -0
- package/build/interfaces/mixnet/index.d.ts +1 -0
- package/build/interfaces/mixnet/runtime.d.ts +2 -0
- package/build/interfaces/mixnet/types.d.ts +30 -0
- package/build/interfaces/mmr/definitions.d.ts +3 -0
- package/build/interfaces/mmr/index.d.ts +1 -0
- package/build/interfaces/mmr/rpc.d.ts +2 -0
- package/build/interfaces/mmr/runtime.d.ts +2 -0
- package/build/interfaces/mmr/types.d.ts +54 -0
- package/build/interfaces/nfts/definitions.d.ts +3 -0
- package/build/interfaces/nfts/index.d.ts +1 -0
- package/build/interfaces/nfts/runtime.d.ts +2 -0
- package/build/interfaces/nfts/types.d.ts +8 -0
- package/build/interfaces/nimbus/definitions.d.ts +3 -0
- package/build/interfaces/nimbus/index.d.ts +1 -0
- package/build/interfaces/nimbus/runtime.d.ts +2 -0
- package/build/interfaces/nimbus/types.d.ts +1 -0
- package/build/interfaces/nompools/definitions.d.ts +3 -0
- package/build/interfaces/nompools/index.d.ts +1 -0
- package/build/interfaces/nompools/runtime.d.ts +2 -0
- package/build/interfaces/nompools/types.d.ts +11 -0
- package/build/interfaces/offchain/definitions.d.ts +3 -0
- package/build/interfaces/offchain/index.d.ts +1 -0
- package/build/interfaces/offchain/rpc.d.ts +2 -0
- package/build/interfaces/offchain/runtime.d.ts +2 -0
- package/build/interfaces/offchain/types.d.ts +8 -0
- package/build/interfaces/offences/definitions.d.ts +3 -0
- package/build/interfaces/offences/index.d.ts +1 -0
- package/build/interfaces/offences/types.d.ts +28 -0
- package/build/interfaces/ormlOracle/definitions.d.ts +3 -0
- package/build/interfaces/ormlOracle/index.d.ts +1 -0
- package/build/interfaces/ormlOracle/runtime.d.ts +2 -0
- package/build/interfaces/ormlOracle/types.d.ts +1 -0
- package/build/interfaces/ormlTokens/definitions.d.ts +3 -0
- package/build/interfaces/ormlTokens/index.d.ts +1 -0
- package/build/interfaces/ormlTokens/runtime.d.ts +2 -0
- package/build/interfaces/ormlTokens/types.d.ts +1 -0
- package/build/interfaces/parachains/definitions.d.ts +3 -0
- package/build/interfaces/parachains/hrmp.d.ts +25 -0
- package/build/interfaces/parachains/index.d.ts +1 -0
- package/build/interfaces/parachains/runtime.d.ts +2 -0
- package/build/interfaces/parachains/slots.d.ts +46 -0
- package/build/interfaces/parachains/types.d.ts +885 -0
- package/build/interfaces/payment/definitions.d.ts +3 -0
- package/build/interfaces/payment/index.d.ts +1 -0
- package/build/interfaces/payment/rpc.d.ts +2 -0
- package/build/interfaces/payment/runtime.d.ts +2 -0
- package/build/interfaces/payment/types.d.ts +32 -0
- package/build/interfaces/poll/definitions.d.ts +3 -0
- package/build/interfaces/poll/index.d.ts +1 -0
- package/build/interfaces/poll/types.d.ts +5 -0
- package/build/interfaces/pow/definitions.d.ts +3 -0
- package/build/interfaces/pow/index.d.ts +1 -0
- package/build/interfaces/pow/runtime.d.ts +2 -0
- package/build/interfaces/pow/types.d.ts +1 -0
- package/build/interfaces/proxy/definitions.d.ts +3 -0
- package/build/interfaces/proxy/index.d.ts +1 -0
- package/build/interfaces/proxy/types.d.ts +23 -0
- package/build/interfaces/purchase/definitions.d.ts +3 -0
- package/build/interfaces/purchase/index.d.ts +1 -0
- package/build/interfaces/purchase/types.d.ts +21 -0
- package/build/interfaces/recovery/definitions.d.ts +3 -0
- package/build/interfaces/recovery/index.d.ts +1 -0
- package/build/interfaces/recovery/types.d.ts +16 -0
- package/build/interfaces/rpc/definitions.d.ts +3 -0
- package/build/interfaces/rpc/index.d.ts +1 -0
- package/build/interfaces/rpc/rpc.d.ts +2 -0
- package/build/interfaces/rpc/types.d.ts +7 -0
- package/build/interfaces/runtime/definitions.d.ts +4 -0
- package/build/interfaces/runtime/index.d.ts +1 -0
- package/build/interfaces/runtime/runtime.d.ts +2 -0
- package/build/interfaces/runtime/types.d.ts +396 -0
- package/build/interfaces/scaleInfo/definitions.d.ts +3 -0
- package/build/interfaces/scaleInfo/index.d.ts +1 -0
- package/build/interfaces/scaleInfo/types.d.ts +238 -0
- package/build/interfaces/scaleInfo/v0.d.ts +2 -0
- package/build/interfaces/scaleInfo/v1.d.ts +8 -0
- package/build/interfaces/scheduler/definitions.d.ts +3 -0
- package/build/interfaces/scheduler/index.d.ts +1 -0
- package/build/interfaces/scheduler/types.d.ts +34 -0
- package/build/interfaces/session/definitions.d.ts +3 -0
- package/build/interfaces/session/index.d.ts +1 -0
- package/build/interfaces/session/runtime.d.ts +2 -0
- package/build/interfaces/session/types.d.ts +74 -0
- package/build/interfaces/society/definitions.d.ts +3 -0
- package/build/interfaces/society/index.d.ts +1 -0
- package/build/interfaces/society/types.d.ts +41 -0
- package/build/interfaces/staking/definitions.d.ts +3 -0
- package/build/interfaces/staking/index.d.ts +1 -0
- package/build/interfaces/staking/runtime.d.ts +2 -0
- package/build/interfaces/staking/types.d.ts +385 -0
- package/build/interfaces/state/definitions.d.ts +3 -0
- package/build/interfaces/state/index.d.ts +1 -0
- package/build/interfaces/state/rpc.d.ts +2 -0
- package/build/interfaces/state/types.d.ts +107 -0
- package/build/interfaces/statement/definitions.d.ts +3 -0
- package/build/interfaces/statement/index.d.ts +1 -0
- package/build/interfaces/statement/runtime.d.ts +2 -0
- package/build/interfaces/statement/types.d.ts +21 -0
- package/build/interfaces/support/definitions.d.ts +3 -0
- package/build/interfaces/support/index.d.ts +1 -0
- package/build/interfaces/support/types.d.ts +10 -0
- package/build/interfaces/syncstate/definitions.d.ts +3 -0
- package/build/interfaces/syncstate/index.d.ts +1 -0
- package/build/interfaces/syncstate/rpc.d.ts +2 -0
- package/build/interfaces/syncstate/types.d.ts +1 -0
- package/build/interfaces/system/definitions.d.ts +3 -0
- package/build/interfaces/system/index.d.ts +1 -0
- package/build/interfaces/system/rpc.d.ts +2 -0
- package/build/interfaces/system/runtime.d.ts +2 -0
- package/build/interfaces/system/types.d.ts +423 -0
- package/build/interfaces/treasury/definitions.d.ts +3 -0
- package/build/interfaces/treasury/index.d.ts +1 -0
- package/build/interfaces/treasury/types.d.ts +75 -0
- package/build/interfaces/txpayment/definitions.d.ts +3 -0
- package/build/interfaces/txpayment/index.d.ts +1 -0
- package/build/interfaces/txpayment/types.d.ts +5 -0
- package/build/interfaces/txqueue/definitions.d.ts +3 -0
- package/build/interfaces/txqueue/index.d.ts +1 -0
- package/build/interfaces/txqueue/runtime.d.ts +2 -0
- package/build/interfaces/txqueue/types.d.ts +26 -0
- package/build/interfaces/types.d.ts +78 -0
- package/build/interfaces/uniques/definitions.d.ts +3 -0
- package/build/interfaces/uniques/index.d.ts +1 -0
- package/build/interfaces/uniques/types.d.ts +53 -0
- package/build/interfaces/utility/definitions.d.ts +3 -0
- package/build/interfaces/utility/index.d.ts +1 -0
- package/build/interfaces/utility/types.d.ts +15 -0
- package/build/interfaces/vesting/definitions.d.ts +3 -0
- package/build/interfaces/vesting/index.d.ts +1 -0
- package/build/interfaces/vesting/types.d.ts +9 -0
- package/build/interfaces/xcm/definitions.d.ts +3 -0
- package/build/interfaces/xcm/index.d.ts +1 -0
- package/build/interfaces/xcm/types.d.ts +2436 -0
- package/build/interfaces/xcm/v0.d.ts +2 -0
- package/build/interfaces/xcm/v1.d.ts +2 -0
- package/build/interfaces/xcm/v2.d.ts +2 -0
- package/build/interfaces/xcm/v3.d.ts +2 -0
- package/build/interfaces/xcm/v4.d.ts +2 -0
- package/build/interfaces/xcm/v5.d.ts +2 -0
- package/build/interfaces/xcmPaymentApi/definitions.d.ts +3 -0
- package/build/interfaces/xcmPaymentApi/index.d.ts +1 -0
- package/build/interfaces/xcmPaymentApi/runtime.d.ts +2 -0
- package/build/interfaces/xcmPaymentApi/types.d.ts +11 -0
- package/build/interfaces/xcmRuntimeApi/definitions.d.ts +3 -0
- package/build/interfaces/xcmRuntimeApi/index.d.ts +1 -0
- package/build/interfaces/xcmRuntimeApi/runtime.d.ts +2 -0
- package/build/interfaces/xcmRuntimeApi/types.d.ts +8 -0
- package/build/lookup.d.ts +1 -0
- package/build/metadata/MagicNumber.d.ts +6 -0
- package/build/metadata/Metadata.d.ts +11 -0
- package/build/metadata/MetadataVersioned.d.ts +69 -0
- package/build/metadata/PortableRegistry/PortableRegistry.d.ts +48 -0
- package/build/metadata/PortableRegistry/index.d.ts +2 -0
- package/build/metadata/PortableRegistry/toV1.d.ts +3 -0
- package/build/metadata/decorate/constants/index.d.ts +5 -0
- package/build/metadata/decorate/errors/index.d.ts +16 -0
- package/build/metadata/decorate/events/index.d.ts +6 -0
- package/build/metadata/decorate/extrinsics/createUnchecked.d.ts +5 -0
- package/build/metadata/decorate/extrinsics/index.d.ts +9 -0
- package/build/metadata/decorate/index.d.ts +13 -0
- package/build/metadata/decorate/storage/createFunction.d.ts +31 -0
- package/build/metadata/decorate/storage/getHasher.d.ts +5 -0
- package/build/metadata/decorate/storage/getStorage.d.ts +4 -0
- package/build/metadata/decorate/storage/index.d.ts +5 -0
- package/build/metadata/decorate/storage/substrate.d.ts +5 -0
- package/build/metadata/decorate/storage/util.d.ts +14 -0
- package/build/metadata/decorate/types.d.ts +33 -0
- package/build/metadata/decorate/util.d.ts +8 -0
- package/build/metadata/index.d.ts +3 -0
- package/build/metadata/types.d.ts +5 -0
- package/build/metadata/util/extractTypes.d.ts +4 -0
- package/build/metadata/util/flattenUniq.d.ts +4 -0
- package/build/metadata/util/getSiName.d.ts +3 -0
- package/build/metadata/util/getUniqTypes.d.ts +4 -0
- package/build/metadata/util/index.d.ts +5 -0
- package/build/metadata/util/testUtil.d.ts +10 -0
- package/build/metadata/util/toCallsOnly.d.ts +4 -0
- package/build/metadata/util/types.d.ts +5 -0
- package/build/metadata/util/validateTypes.d.ts +3 -0
- package/build/metadata/v10/toV11.d.ts +4 -0
- package/build/metadata/v11/toV12.d.ts +6 -0
- package/build/metadata/v12/toV13.d.ts +6 -0
- package/build/metadata/v13/toV14.d.ts +18 -0
- package/build/metadata/v14/toV15.d.ts +7 -0
- package/build/metadata/v15/toV16.d.ts +7 -0
- package/build/metadata/v16/toLatest.d.ts +7 -0
- package/build/metadata/v9/toV10.d.ts +4 -0
- package/build/metadata/versions.d.ts +5 -0
- package/build/packageDetect.d.ts +1 -0
- package/build/packageInfo.d.ts +6 -0
- package/build/primitive/Data.d.ts +31 -0
- package/build/primitive/StorageKey.d.ts +53 -0
- package/build/primitive/index.d.ts +6 -0
- package/build/primitive/types.d.ts +17 -0
- package/build/types/augmentLookup.d.ts +15 -0
- package/build/types/augmentRegistry.d.ts +39 -0
- package/build/types/calls.d.ts +10 -0
- package/build/types/codec.d.ts +4 -0
- package/build/types/definitions.d.ts +108 -0
- package/build/types/detect.d.ts +42 -0
- package/build/types/events.d.ts +28 -0
- package/build/types/extrinsic.d.ts +220 -0
- package/build/types/index.d.ts +12 -0
- package/build/types/interfaces.d.ts +40 -0
- package/build/types/registry.d.ts +128 -0
- package/build/util/index.d.ts +1 -0
- package/build/util/storage.d.ts +7 -0
- package/package.json +37 -0
- package/src/bundle.ts +22 -0
- package/src/checkTypes.manual.ts +101 -0
- package/src/codec/index.ts +9 -0
- package/src/codec/types.ts +4 -0
- package/src/create/createClass.spec.ts +47 -0
- package/src/create/createClass.ts +11 -0
- package/src/create/createType.spec.ts +252 -0
- package/src/create/createType.ts +17 -0
- package/src/create/index.ts +11 -0
- package/src/create/lazy.ts +22 -0
- package/src/create/registry.spec.ts +186 -0
- package/src/create/registry.ts +639 -0
- package/src/create/types.ts +9 -0
- package/src/ethereum/AccountId.spec.ts +86 -0
- package/src/ethereum/AccountId.ts +76 -0
- package/src/ethereum/LookupSource.spec.ts +107 -0
- package/src/ethereum/LookupSource.ts +122 -0
- package/src/ethereum/index.ts +5 -0
- package/src/extrinsic/Extrinsic.spec.ts +111 -0
- package/src/extrinsic/Extrinsic.ts +461 -0
- package/src/extrinsic/ExtrinsicEra.spec.ts +87 -0
- package/src/extrinsic/ExtrinsicEra.ts +299 -0
- package/src/extrinsic/ExtrinsicPayload.spec.ts +116 -0
- package/src/extrinsic/ExtrinsicPayload.ts +223 -0
- package/src/extrinsic/ExtrinsicPayloadUnknown.ts +20 -0
- package/src/extrinsic/ExtrinsicUnknown.ts +22 -0
- package/src/extrinsic/SignerPayload.spec.ts +189 -0
- package/src/extrinsic/SignerPayload.ts +198 -0
- package/src/extrinsic/constants.ts +28 -0
- package/src/extrinsic/index.ts +14 -0
- package/src/extrinsic/signedExtensions/emptyCheck.ts +9 -0
- package/src/extrinsic/signedExtensions/index.ts +46 -0
- package/src/extrinsic/signedExtensions/polkadot.ts +15 -0
- package/src/extrinsic/signedExtensions/shell.ts +10 -0
- package/src/extrinsic/signedExtensions/statemint.ts +15 -0
- package/src/extrinsic/signedExtensions/substrate.ts +75 -0
- package/src/extrinsic/signedExtensions/types.ts +11 -0
- package/src/extrinsic/types.ts +25 -0
- package/src/extrinsic/util.ts +23 -0
- package/src/extrinsic/v4/Extrinsic.spec.ts +86 -0
- package/src/extrinsic/v4/Extrinsic.ts +108 -0
- package/src/extrinsic/v4/ExtrinsicPayload.spec.ts +74 -0
- package/src/extrinsic/v4/ExtrinsicPayload.ts +131 -0
- package/src/extrinsic/v4/ExtrinsicSignature.spec.ts +160 -0
- package/src/extrinsic/v4/ExtrinsicSignature.ts +229 -0
- package/src/extrinsic/v4/index.ts +6 -0
- package/src/extrinsic/v5/Extrinsic.spec.ts +74 -0
- package/src/extrinsic/v5/Extrinsic.ts +116 -0
- package/src/extrinsic/v5/ExtrinsicPayload.spec.ts +39 -0
- package/src/extrinsic/v5/ExtrinsicPayload.ts +115 -0
- package/src/extrinsic/v5/ExtrinsicSignature.spec.ts +105 -0
- package/src/extrinsic/v5/ExtrinsicSignature.ts +200 -0
- package/src/extrinsic/v5/GeneralExtrinsic.spec.ts +47 -0
- package/src/extrinsic/v5/GeneralExtrinsic.ts +208 -0
- package/src/extrinsic/v5/index.ts +7 -0
- package/src/generic/AccountId.spec.ts +179 -0
- package/src/generic/AccountId.ts +100 -0
- package/src/generic/AccountIndex.spec.ts +75 -0
- package/src/generic/AccountIndex.ts +129 -0
- package/src/generic/Block.spec.ts +49 -0
- package/src/generic/Block.ts +65 -0
- package/src/generic/Call.spec.ts +47 -0
- package/src/generic/Call.ts +244 -0
- package/src/generic/ChainProperties.spec.ts +95 -0
- package/src/generic/ChainProperties.ts +93 -0
- package/src/generic/ConsensusEngineId.spec.ts +23 -0
- package/src/generic/ConsensusEngineId.ts +131 -0
- package/src/generic/Event.ts +200 -0
- package/src/generic/LookupSource.spec.ts +123 -0
- package/src/generic/LookupSource.ts +141 -0
- package/src/generic/MultiAddress.spec.ts +52 -0
- package/src/generic/MultiAddress.ts +73 -0
- package/src/generic/Vote.spec.ts +167 -0
- package/src/generic/Vote.ts +133 -0
- package/src/generic/index.ts +17 -0
- package/src/index.spec.ts +78 -0
- package/src/index.ts +6 -0
- package/src/index.types.ts +6 -0
- package/src/interfaces/alias.spec.ts +50 -0
- package/src/interfaces/alias.ts +116 -0
- package/src/interfaces/assetConversion/definitions.ts +17 -0
- package/src/interfaces/assetConversion/index.ts +4 -0
- package/src/interfaces/assetConversion/runtime.ts +72 -0
- package/src/interfaces/assetConversion/types.ts +10 -0
- package/src/interfaces/assets/definitions.ts +57 -0
- package/src/interfaces/assets/index.ts +4 -0
- package/src/interfaces/assets/runtime.ts +24 -0
- package/src/interfaces/assets/types.ts +64 -0
- package/src/interfaces/attestations/definitions.ts +26 -0
- package/src/interfaces/attestations/index.ts +4 -0
- package/src/interfaces/attestations/types.ts +28 -0
- package/src/interfaces/aura/definitions.ts +19 -0
- package/src/interfaces/aura/index.ts +4 -0
- package/src/interfaces/aura/runtime.ts +24 -0
- package/src/interfaces/aura/types.ts +11 -0
- package/src/interfaces/author/ExtrinsicStatus.spec.ts +33 -0
- package/src/interfaces/author/definitions.ts +35 -0
- package/src/interfaces/author/index.ts +4 -0
- package/src/interfaces/author/rpc.ts +101 -0
- package/src/interfaces/author/types.ts +37 -0
- package/src/interfaces/authorship/definitions.ts +19 -0
- package/src/interfaces/authorship/index.ts +4 -0
- package/src/interfaces/authorship/types.ts +17 -0
- package/src/interfaces/babe/definitions.ts +134 -0
- package/src/interfaces/babe/index.ts +4 -0
- package/src/interfaces/babe/rpc.ts +13 -0
- package/src/interfaces/babe/runtime.ts +77 -0
- package/src/interfaces/babe/types.ts +187 -0
- package/src/interfaces/balances/definitions.ts +55 -0
- package/src/interfaces/balances/index.ts +4 -0
- package/src/interfaces/balances/types.ts +70 -0
- package/src/interfaces/beefy/definitions.ts +66 -0
- package/src/interfaces/beefy/index.ts +4 -0
- package/src/interfaces/beefy/rpc.ts +22 -0
- package/src/interfaces/beefy/runtime.ts +107 -0
- package/src/interfaces/beefy/types.ts +87 -0
- package/src/interfaces/benchmark/definitions.ts +52 -0
- package/src/interfaces/benchmark/index.ts +4 -0
- package/src/interfaces/benchmark/runtime.ts +34 -0
- package/src/interfaces/benchmark/types.ts +81 -0
- package/src/interfaces/blockbuilder/definitions.ts +25 -0
- package/src/interfaces/blockbuilder/index.ts +4 -0
- package/src/interfaces/blockbuilder/runtime.ts +124 -0
- package/src/interfaces/blockbuilder/types.ts +21 -0
- package/src/interfaces/bridges/definitions.ts +94 -0
- package/src/interfaces/bridges/index.ts +4 -0
- package/src/interfaces/bridges/types.ts +147 -0
- package/src/interfaces/chain/definitions.ts +16 -0
- package/src/interfaces/chain/index.ts +4 -0
- package/src/interfaces/chain/rpc.ts +82 -0
- package/src/interfaces/chain/types.ts +9 -0
- package/src/interfaces/childstate/definitions.ts +17 -0
- package/src/interfaces/childstate/index.ts +4 -0
- package/src/interfaces/childstate/rpc.ts +137 -0
- package/src/interfaces/childstate/types.ts +9 -0
- package/src/interfaces/claims/definitions.ts +16 -0
- package/src/interfaces/claims/index.ts +4 -0
- package/src/interfaces/claims/types.ts +13 -0
- package/src/interfaces/collective/definitions.ts +34 -0
- package/src/interfaces/collective/index.ts +4 -0
- package/src/interfaces/collective/types.ts +40 -0
- package/src/interfaces/consensus/definitions.ts +15 -0
- package/src/interfaces/consensus/index.ts +4 -0
- package/src/interfaces/consensus/types.ts +13 -0
- package/src/interfaces/contracts/definitions.ts +434 -0
- package/src/interfaces/contracts/index.ts +4 -0
- package/src/interfaces/contracts/rpc.ts +99 -0
- package/src/interfaces/contracts/runtime.ts +184 -0
- package/src/interfaces/contracts/types.ts +536 -0
- package/src/interfaces/contractsAbi/definitions.ts +351 -0
- package/src/interfaces/contractsAbi/index.ts +4 -0
- package/src/interfaces/contractsAbi/types.ts +446 -0
- package/src/interfaces/crowdloan/definitions.ts +34 -0
- package/src/interfaces/crowdloan/index.ts +4 -0
- package/src/interfaces/crowdloan/types.ts +38 -0
- package/src/interfaces/cumulus/definitions.ts +44 -0
- package/src/interfaces/cumulus/index.ts +4 -0
- package/src/interfaces/cumulus/runtime.ts +55 -0
- package/src/interfaces/cumulus/types.ts +48 -0
- package/src/interfaces/definitions.spec.ts +159 -0
- package/src/interfaces/definitions.ts +92 -0
- package/src/interfaces/democracy/definitions.ts +121 -0
- package/src/interfaces/democracy/index.ts +4 -0
- package/src/interfaces/democracy/types.ts +154 -0
- package/src/interfaces/dev/definitions.ts +21 -0
- package/src/interfaces/dev/index.ts +4 -0
- package/src/interfaces/dev/rpc.ts +19 -0
- package/src/interfaces/dev/types.ts +14 -0
- package/src/interfaces/discovery/definitions.ts +15 -0
- package/src/interfaces/discovery/index.ts +4 -0
- package/src/interfaces/discovery/runtime.ts +19 -0
- package/src/interfaces/discovery/types.ts +4 -0
- package/src/interfaces/dryRunApi/definitions.ts +38 -0
- package/src/interfaces/dryRunApi/index.ts +4 -0
- package/src/interfaces/dryRunApi/runtime.ts +79 -0
- package/src/interfaces/dryRunApi/types.ts +46 -0
- package/src/interfaces/elections/definitions.ts +42 -0
- package/src/interfaces/elections/index.ts +4 -0
- package/src/interfaces/elections/types.ts +52 -0
- package/src/interfaces/engine/definitions.ts +30 -0
- package/src/interfaces/engine/index.ts +4 -0
- package/src/interfaces/engine/rpc.ts +41 -0
- package/src/interfaces/engine/types.ts +23 -0
- package/src/interfaces/essentials.ts +6 -0
- package/src/interfaces/eth/definitions.ts +411 -0
- package/src/interfaces/eth/index.ts +4 -0
- package/src/interfaces/eth/rpc.ts +508 -0
- package/src/interfaces/eth/runtime.ts +355 -0
- package/src/interfaces/eth/types.ts +505 -0
- package/src/interfaces/evm/definitions.ts +99 -0
- package/src/interfaces/evm/index.ts +4 -0
- package/src/interfaces/evm/types.ts +126 -0
- package/src/interfaces/extrinsics/EdcsaSignature.spec.ts +35 -0
- package/src/interfaces/extrinsics/definitions.ts +45 -0
- package/src/interfaces/extrinsics/index.ts +4 -0
- package/src/interfaces/extrinsics/types.ts +82 -0
- package/src/interfaces/finality/definitions.ts +15 -0
- package/src/interfaces/finality/index.ts +4 -0
- package/src/interfaces/finality/runtime.ts +23 -0
- package/src/interfaces/finality/types.ts +4 -0
- package/src/interfaces/fungibles/definitions.ts +19 -0
- package/src/interfaces/fungibles/index.ts +4 -0
- package/src/interfaces/fungibles/runtime.ts +39 -0
- package/src/interfaces/fungibles/types.ts +13 -0
- package/src/interfaces/genericAsset/definitions.ts +34 -0
- package/src/interfaces/genericAsset/index.ts +4 -0
- package/src/interfaces/genericAsset/types.ts +38 -0
- package/src/interfaces/genesisBuilder/definitions.ts +14 -0
- package/src/interfaces/genesisBuilder/index.ts +4 -0
- package/src/interfaces/genesisBuilder/runtime.ts +29 -0
- package/src/interfaces/genesisBuilder/types.ts +9 -0
- package/src/interfaces/gilt/definitions.ts +30 -0
- package/src/interfaces/gilt/index.ts +4 -0
- package/src/interfaces/gilt/types.ts +32 -0
- package/src/interfaces/grandpa/ReportedRoundStates.spec.ts +20 -0
- package/src/interfaces/grandpa/definitions.ts +140 -0
- package/src/interfaces/grandpa/index.ts +4 -0
- package/src/interfaces/grandpa/rpc.ts +32 -0
- package/src/interfaces/grandpa/runtime.ts +60 -0
- package/src/interfaces/grandpa/types.ts +201 -0
- package/src/interfaces/identity/IdentityFields.spec.ts +34 -0
- package/src/interfaces/identity/Registration.spec.ts +36 -0
- package/src/interfaces/identity/definitions.ts +79 -0
- package/src/interfaces/identity/index.ts +4 -0
- package/src/interfaces/identity/types.ts +89 -0
- package/src/interfaces/imOnline/definitions.ts +34 -0
- package/src/interfaces/imOnline/index.ts +4 -0
- package/src/interfaces/imOnline/types.ts +44 -0
- package/src/interfaces/index.ts +4 -0
- package/src/interfaces/jsonrpc.ts +30 -0
- package/src/interfaces/lottery/definitions.ts +21 -0
- package/src/interfaces/lottery/index.ts +4 -0
- package/src/interfaces/lottery/types.ts +20 -0
- package/src/interfaces/metadata/definitions.ts +87 -0
- package/src/interfaces/metadata/hashers.ts +16 -0
- package/src/interfaces/metadata/index.ts +4 -0
- package/src/interfaces/metadata/runtime.ts +44 -0
- package/src/interfaces/metadata/types.ts +849 -0
- package/src/interfaces/metadata/v10.ts +67 -0
- package/src/interfaces/metadata/v11.ts +67 -0
- package/src/interfaces/metadata/v12.ts +35 -0
- package/src/interfaces/metadata/v13.ts +66 -0
- package/src/interfaces/metadata/v14.ts +102 -0
- package/src/interfaces/metadata/v15.ts +67 -0
- package/src/interfaces/metadata/v16.ts +168 -0
- package/src/interfaces/metadata/v9.ts +87 -0
- package/src/interfaces/mixnet/definitions.ts +33 -0
- package/src/interfaces/mixnet/index.ts +4 -0
- package/src/interfaces/mixnet/runtime.ts +43 -0
- package/src/interfaces/mixnet/types.ts +38 -0
- package/src/interfaces/mmr/definitions.ts +44 -0
- package/src/interfaces/mmr/index.ts +4 -0
- package/src/interfaces/mmr/rpc.ts +67 -0
- package/src/interfaces/mmr/runtime.ts +168 -0
- package/src/interfaces/mmr/types.ts +63 -0
- package/src/interfaces/nfts/definitions.ts +18 -0
- package/src/interfaces/nfts/index.ts +4 -0
- package/src/interfaces/nfts/runtime.ts +110 -0
- package/src/interfaces/nfts/types.ts +12 -0
- package/src/interfaces/nimbus/definitions.ts +15 -0
- package/src/interfaces/nimbus/index.ts +4 -0
- package/src/interfaces/nimbus/runtime.ts +77 -0
- package/src/interfaces/nimbus/types.ts +4 -0
- package/src/interfaces/nompools/definitions.ts +20 -0
- package/src/interfaces/nompools/index.ts +4 -0
- package/src/interfaces/nompools/runtime.ts +52 -0
- package/src/interfaces/nompools/types.ts +16 -0
- package/src/interfaces/offchain/definitions.spec.ts +21 -0
- package/src/interfaces/offchain/definitions.ts +23 -0
- package/src/interfaces/offchain/index.ts +4 -0
- package/src/interfaces/offchain/rpc.ts +56 -0
- package/src/interfaces/offchain/runtime.ts +39 -0
- package/src/interfaces/offchain/types.ts +13 -0
- package/src/interfaces/offences/definitions.ts +23 -0
- package/src/interfaces/offences/index.ts +4 -0
- package/src/interfaces/offences/types.ts +33 -0
- package/src/interfaces/ormlOracle/definitions.ts +15 -0
- package/src/interfaces/ormlOracle/index.ts +4 -0
- package/src/interfaces/ormlOracle/runtime.ts +48 -0
- package/src/interfaces/ormlOracle/types.ts +4 -0
- package/src/interfaces/ormlTokens/definitions.ts +15 -0
- package/src/interfaces/ormlTokens/index.ts +4 -0
- package/src/interfaces/ormlTokens/runtime.ts +30 -0
- package/src/interfaces/ormlTokens/types.ts +4 -0
- package/src/interfaces/parachains/SystemInherentData.spec.ts +29 -0
- package/src/interfaces/parachains/definitions.ts +571 -0
- package/src/interfaces/parachains/hrmp.ts +30 -0
- package/src/interfaces/parachains/index.ts +4 -0
- package/src/interfaces/parachains/runtime.ts +426 -0
- package/src/interfaces/parachains/slots.ts +59 -0
- package/src/interfaces/parachains/types.ts +984 -0
- package/src/interfaces/payment/definitions.ts +42 -0
- package/src/interfaces/payment/index.ts +4 -0
- package/src/interfaces/payment/rpc.ts +44 -0
- package/src/interfaces/payment/runtime.ts +186 -0
- package/src/interfaces/payment/types.ts +41 -0
- package/src/interfaces/poll/definitions.ts +14 -0
- package/src/interfaces/poll/index.ts +4 -0
- package/src/interfaces/poll/types.ts +9 -0
- package/src/interfaces/pow/definitions.ts +15 -0
- package/src/interfaces/pow/index.ts +4 -0
- package/src/interfaces/pow/runtime.ts +32 -0
- package/src/interfaces/pow/types.ts +4 -0
- package/src/interfaces/proxy/definitions.ts +26 -0
- package/src/interfaces/proxy/index.ts +4 -0
- package/src/interfaces/proxy/types.ts +30 -0
- package/src/interfaces/purchase/definitions.ts +23 -0
- package/src/interfaces/purchase/index.ts +4 -0
- package/src/interfaces/purchase/types.ts +27 -0
- package/src/interfaces/recovery/definitions.ts +24 -0
- package/src/interfaces/recovery/index.ts +4 -0
- package/src/interfaces/recovery/types.ts +22 -0
- package/src/interfaces/rpc/definitions.ts +19 -0
- package/src/interfaces/rpc/index.ts +4 -0
- package/src/interfaces/rpc/rpc.ts +12 -0
- package/src/interfaces/rpc/types.ts +12 -0
- package/src/interfaces/runtime/Digest.spec.ts +34 -0
- package/src/interfaces/runtime/Header.spec.ts +64 -0
- package/src/interfaces/runtime/KeyValue.spec.ts +41 -0
- package/src/interfaces/runtime/definitions.ts +236 -0
- package/src/interfaces/runtime/index.ts +4 -0
- package/src/interfaces/runtime/runtime.ts +117 -0
- package/src/interfaces/runtime/types.ts +422 -0
- package/src/interfaces/scaleInfo/definitions.ts +34 -0
- package/src/interfaces/scaleInfo/index.ts +4 -0
- package/src/interfaces/scaleInfo/types.ts +265 -0
- package/src/interfaces/scaleInfo/v0.ts +72 -0
- package/src/interfaces/scaleInfo/v1.ts +73 -0
- package/src/interfaces/scheduler/definitions.ts +31 -0
- package/src/interfaces/scheduler/index.ts +4 -0
- package/src/interfaces/scheduler/types.ts +40 -0
- package/src/interfaces/session/definitions.ts +55 -0
- package/src/interfaces/session/index.ts +4 -0
- package/src/interfaces/session/runtime.ts +34 -0
- package/src/interfaces/session/types.ts +79 -0
- package/src/interfaces/society/definitions.ts +36 -0
- package/src/interfaces/society/index.ts +4 -0
- package/src/interfaces/society/types.ts +50 -0
- package/src/interfaces/staking/CompactAssignments.spec.ts +207 -0
- package/src/interfaces/staking/Exposure.spec.ts +23 -0
- package/src/interfaces/staking/definitions.ts +311 -0
- package/src/interfaces/staking/index.ts +4 -0
- package/src/interfaces/staking/runtime.ts +24 -0
- package/src/interfaces/staking/types.ts +430 -0
- package/src/interfaces/state/KeyValueOption.spec.ts +19 -0
- package/src/interfaces/state/RuntimeVersion.spec.ts +42 -0
- package/src/interfaces/state/StorageChangeSet.spec.ts +49 -0
- package/src/interfaces/state/definitions.ts +95 -0
- package/src/interfaces/state/index.ts +4 -0
- package/src/interfaces/state/rpc.ts +416 -0
- package/src/interfaces/state/types.ts +124 -0
- package/src/interfaces/statement/definitions.ts +26 -0
- package/src/interfaces/statement/index.ts +4 -0
- package/src/interfaces/statement/runtime.ts +28 -0
- package/src/interfaces/statement/types.ts +28 -0
- package/src/interfaces/support/definitions.ts +19 -0
- package/src/interfaces/support/index.ts +4 -0
- package/src/interfaces/support/types.ts +15 -0
- package/src/interfaces/syncstate/definitions.ts +14 -0
- package/src/interfaces/syncstate/index.ts +4 -0
- package/src/interfaces/syncstate/rpc.ts +18 -0
- package/src/interfaces/syncstate/types.ts +4 -0
- package/src/interfaces/system/EventRecord.spec.ts +42 -0
- package/src/interfaces/system/definitions.ts +327 -0
- package/src/interfaces/system/index.ts +4 -0
- package/src/interfaces/system/rpc.ts +144 -0
- package/src/interfaces/system/runtime.ts +24 -0
- package/src/interfaces/system/types.ts +476 -0
- package/src/interfaces/treasury/definitions.ts +68 -0
- package/src/interfaces/treasury/index.ts +4 -0
- package/src/interfaces/treasury/types.ts +87 -0
- package/src/interfaces/txpayment/definitions.ts +11 -0
- package/src/interfaces/txpayment/index.ts +4 -0
- package/src/interfaces/txpayment/types.ts +9 -0
- package/src/interfaces/txqueue/definitions.ts +27 -0
- package/src/interfaces/txqueue/index.ts +4 -0
- package/src/interfaces/txqueue/runtime.ts +66 -0
- package/src/interfaces/txqueue/types.ts +33 -0
- package/src/interfaces/types.ts +82 -0
- package/src/interfaces/uniques/definitions.ts +50 -0
- package/src/interfaces/uniques/index.ts +4 -0
- package/src/interfaces/uniques/types.ts +62 -0
- package/src/interfaces/utility/definitions.ts +23 -0
- package/src/interfaces/utility/index.ts +4 -0
- package/src/interfaces/utility/types.ts +21 -0
- package/src/interfaces/vesting/definitions.ts +18 -0
- package/src/interfaces/vesting/index.ts +4 -0
- package/src/interfaces/vesting/types.ts +14 -0
- package/src/interfaces/xcm/definitions.ts +189 -0
- package/src/interfaces/xcm/index.ts +4 -0
- package/src/interfaces/xcm/types.ts +2546 -0
- package/src/interfaces/xcm/v0.ts +225 -0
- package/src/interfaces/xcm/v1.ts +224 -0
- package/src/interfaces/xcm/v2.ts +293 -0
- package/src/interfaces/xcm/v3.ts +386 -0
- package/src/interfaces/xcm/v4.ts +281 -0
- package/src/interfaces/xcm/v5.ts +314 -0
- package/src/interfaces/xcmPaymentApi/definitions.ts +25 -0
- package/src/interfaces/xcmPaymentApi/index.ts +4 -0
- package/src/interfaces/xcmPaymentApi/runtime.ts +48 -0
- package/src/interfaces/xcmPaymentApi/types.ts +16 -0
- package/src/interfaces/xcmRuntimeApi/definitions.ts +19 -0
- package/src/interfaces/xcmRuntimeApi/index.ts +4 -0
- package/src/interfaces/xcmRuntimeApi/runtime.ts +24 -0
- package/src/interfaces/xcmRuntimeApi/types.ts +13 -0
- package/src/lookup.ts +5 -0
- package/src/metadata/MagicNumber.spec.ts +29 -0
- package/src/metadata/MagicNumber.ts +18 -0
- package/src/metadata/Metadata.spec.ts +57 -0
- package/src/metadata/Metadata.ts +53 -0
- package/src/metadata/MetadataVersioned.ts +183 -0
- package/src/metadata/PortableRegistry/PortableRegistry.Range.spec.ts +58 -0
- package/src/metadata/PortableRegistry/PortableRegistry.ts +1095 -0
- package/src/metadata/PortableRegistry/index.ts +5 -0
- package/src/metadata/PortableRegistry/toV1.ts +130 -0
- package/src/metadata/README.md +10 -0
- package/src/metadata/decorate/constants/index.spec.ts +44 -0
- package/src/metadata/decorate/constants/index.ts +39 -0
- package/src/metadata/decorate/errors/index.spec.ts +47 -0
- package/src/metadata/decorate/errors/index.ts +58 -0
- package/src/metadata/decorate/events/index.spec.ts +52 -0
- package/src/metadata/decorate/events/index.ts +42 -0
- package/src/metadata/decorate/extrinsics/createUnchecked.ts +38 -0
- package/src/metadata/decorate/extrinsics/index.spec.ts +90 -0
- package/src/metadata/decorate/extrinsics/index.ts +66 -0
- package/src/metadata/decorate/index.spec.ts +57 -0
- package/src/metadata/decorate/index.ts +35 -0
- package/src/metadata/decorate/storage/createFunction.spec.ts +179 -0
- package/src/metadata/decorate/storage/createFunction.ts +258 -0
- package/src/metadata/decorate/storage/getHasher.spec.ts +30 -0
- package/src/metadata/decorate/storage/getHasher.ts +36 -0
- package/src/metadata/decorate/storage/getStorage.spec.ts +31 -0
- package/src/metadata/decorate/storage/getStorage.ts +20 -0
- package/src/metadata/decorate/storage/index.spec.ts +67 -0
- package/src/metadata/decorate/storage/index.ts +50 -0
- package/src/metadata/decorate/storage/substrate.spec.ts +36 -0
- package/src/metadata/decorate/storage/substrate.ts +56 -0
- package/src/metadata/decorate/storage/util.ts +101 -0
- package/src/metadata/decorate/types.ts +52 -0
- package/src/metadata/decorate/util.ts +20 -0
- package/src/metadata/index.ts +6 -0
- package/src/metadata/types.ts +9 -0
- package/src/metadata/util/extractTypes.ts +64 -0
- package/src/metadata/util/flattenUniq.spec.ts +20 -0
- package/src/metadata/util/flattenUniq.ts +19 -0
- package/src/metadata/util/getSiName.ts +11 -0
- package/src/metadata/util/getUniqTypes.ts +67 -0
- package/src/metadata/util/index.ts +8 -0
- package/src/metadata/util/testUtil.ts +217 -0
- package/src/metadata/util/toCallsOnly.spec.ts +46 -0
- package/src/metadata/util/toCallsOnly.ts +43 -0
- package/src/metadata/util/types.ts +9 -0
- package/src/metadata/util/validateTypes.ts +33 -0
- package/src/metadata/v10/Metadata.spec.ts +12 -0
- package/src/metadata/v10/toV11.ts +18 -0
- package/src/metadata/v11/Metadata.spec.ts +12 -0
- package/src/metadata/v11/toV12.ts +19 -0
- package/src/metadata/v12/Metadata.spec.ts +12 -0
- package/src/metadata/v12/toV13.ts +12 -0
- package/src/metadata/v13/Metadata.spec.ts +24 -0
- package/src/metadata/v13/toV14.ts +352 -0
- package/src/metadata/v14/Metadata.spec.ts +20 -0
- package/src/metadata/v14/toV15.ts +45 -0
- package/src/metadata/v15/Metadata.spec.ts +28 -0
- package/src/metadata/v15/toV16.ts +147 -0
- package/src/metadata/v16/Metadata.spec.ts +30 -0
- package/src/metadata/v16/toLatest.ts +13 -0
- package/src/metadata/v9/Metadata.spec.ts +12 -0
- package/src/metadata/v9/toV10.ts +62 -0
- package/src/metadata/versions.ts +17 -0
- package/src/mod.ts +4 -0
- package/src/packageDetect.ts +13 -0
- package/src/packageInfo.ts +6 -0
- package/src/primitive/Data.spec.ts +45 -0
- package/src/primitive/Data.ts +142 -0
- package/src/primitive/StorageKey.spec.ts +43 -0
- package/src/primitive/StorageKey.ts +251 -0
- package/src/primitive/index.ts +13 -0
- package/src/primitive/types.ts +22 -0
- package/src/types/augmentLookup.ts +23 -0
- package/src/types/augmentRegistry.ts +53 -0
- package/src/types/calls.ts +15 -0
- package/src/types/codec.ts +15 -0
- package/src/types/definitions.ts +119 -0
- package/src/types/detect.ts +148 -0
- package/src/types/events.ts +37 -0
- package/src/types/extrinsic.ts +262 -0
- package/src/types/index.ts +22 -0
- package/src/types/interfaces.ts +51 -0
- package/src/types/registry.ts +106 -0
- package/src/util/index.ts +4 -0
- package/src/util/storage.ts +24 -0
- package/tsconfig.build.json +17 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.spec.json +22 -0
|
@@ -0,0 +1,1095 @@
|
|
|
1
|
+
// Copyright 2017-2025 @polkadot/types authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { Option, Text, Type, u32, Vec } from '@pezkuwi/types-codec';
|
|
5
|
+
import type { AnyString, LookupString, Registry } from '@pezkuwi/types-codec/types';
|
|
6
|
+
import type { ILookup, TypeDef } from '@pezkuwi/types-create/types';
|
|
7
|
+
import type { PortableType } from '../../interfaces/metadata/index.js';
|
|
8
|
+
import type { SiField, SiLookupTypeId, SiType, SiTypeDefArray, SiTypeDefBitSequence, SiTypeDefCompact, SiTypeDefComposite, SiTypeDefSequence, SiTypeDefTuple, SiTypeDefVariant, SiTypeParameter, SiVariant } from '../../interfaces/scaleInfo/index.js';
|
|
9
|
+
|
|
10
|
+
import { sanitize, Struct } from '@pezkuwi/types-codec';
|
|
11
|
+
import { getTypeDef, TypeDefInfo, withTypeString } from '@pezkuwi/types-create';
|
|
12
|
+
import { assertUnreachable, isNumber, isString, logger, objectSpread, stringCamelCase, stringify, stringPascalCase } from '@pezkuwi/util';
|
|
13
|
+
|
|
14
|
+
const l = logger('PortableRegistry');
|
|
15
|
+
|
|
16
|
+
interface ExtractBase {
|
|
17
|
+
lookupIndex: number;
|
|
18
|
+
name: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface Extract extends ExtractBase {
|
|
22
|
+
lookupIndex: number;
|
|
23
|
+
name: string;
|
|
24
|
+
params: SiTypeParameter[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface TypeInfo {
|
|
28
|
+
lookups: Record<string, LookupString>;
|
|
29
|
+
names: Record<number, string>;
|
|
30
|
+
params: TypeInfoParams;
|
|
31
|
+
types: Record<number, PortableType>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface TypeInfoParams {
|
|
35
|
+
// known param definitions
|
|
36
|
+
FrameSystemEventRecord: [event: SiTypeParameter, topic: SiTypeParameter]
|
|
37
|
+
SpRuntimeUncheckedExtrinsic: [address: SiTypeParameter, call: SiTypeParameter, signature: SiTypeParameter, extra: SiTypeParameter];
|
|
38
|
+
|
|
39
|
+
// other type definitions
|
|
40
|
+
[key: string]: SiTypeParameter[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Just a placeholder for a type.unrwapOr()
|
|
44
|
+
const TYPE_UNWRAP = { toNumber: () => -1 };
|
|
45
|
+
|
|
46
|
+
// Alias the primitive enum with our known values
|
|
47
|
+
const PRIMITIVE_ALIAS: Record<string, string> = {
|
|
48
|
+
Char: 'u32', // Rust char is 4-bytes
|
|
49
|
+
Str: 'Text'
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// These are types where we have a specific decoding/encoding override + helpers
|
|
53
|
+
const PATHS_ALIAS = splitNamespace([
|
|
54
|
+
// full matching on exact names...
|
|
55
|
+
// these are well-known types with additional encoding
|
|
56
|
+
'sp_core::crypto::AccountId32',
|
|
57
|
+
'sp_runtime::generic::era::Era',
|
|
58
|
+
'sp_runtime::multiaddress::MultiAddress',
|
|
59
|
+
// ethereum overrides (Frontier, Moonbeam, Polkadot claims)
|
|
60
|
+
'fp_account::AccountId20',
|
|
61
|
+
'account::AccountId20',
|
|
62
|
+
'polkadot_runtime_common::claims::EthereumAddress',
|
|
63
|
+
// weights 2 is a structure, however for 1.5. with a single field it
|
|
64
|
+
// should be flatenned (can appear in Compact<Weight> extrinsics)
|
|
65
|
+
'frame_support::weights::weight_v2::Weight',
|
|
66
|
+
'sp_weights::weight_v2::Weight',
|
|
67
|
+
// wildcard matching in place...
|
|
68
|
+
// these have a specific encoding or logic, use a wildcard for {pallet, darwinia}_democracy
|
|
69
|
+
'*_democracy::vote::Vote',
|
|
70
|
+
'*_conviction_voting::vote::Vote',
|
|
71
|
+
'*_identity::types::Data',
|
|
72
|
+
// these are opaque Vec<u8> wrappers
|
|
73
|
+
'sp_core::OpaqueMetadata',
|
|
74
|
+
'sp_core::OpaquePeerId',
|
|
75
|
+
'sp_core::offchain::OpaqueMultiaddr',
|
|
76
|
+
// shorten some well-known types
|
|
77
|
+
'primitive_types::*',
|
|
78
|
+
'sp_arithmetic::per_things::*',
|
|
79
|
+
// runtime
|
|
80
|
+
'*_runtime::RuntimeCall',
|
|
81
|
+
'*_runtime::RuntimeEvent',
|
|
82
|
+
// ink!
|
|
83
|
+
'ink::env::types::*',
|
|
84
|
+
'ink::primitives::types::*',
|
|
85
|
+
'ink_env::types::*',
|
|
86
|
+
'ink_primitives::types::*'
|
|
87
|
+
]);
|
|
88
|
+
|
|
89
|
+
// Mappings for types that should be converted to set via BitVec
|
|
90
|
+
const PATHS_SET = splitNamespace([
|
|
91
|
+
'pallet_identity::types::BitFlags'
|
|
92
|
+
]);
|
|
93
|
+
|
|
94
|
+
// These are the set namespaces for BitVec definitions (the last 2 appear in types as well)
|
|
95
|
+
const BITVEC_NS_LSB = ['bitvec::order::Lsb0', 'BitOrderLsb0'];
|
|
96
|
+
const BITVEC_NS_MSB = ['bitvec::order::Msb0', 'BitOrderMsb0'];
|
|
97
|
+
const BITVEC_NS = [...BITVEC_NS_LSB, ...BITVEC_NS_MSB];
|
|
98
|
+
|
|
99
|
+
// These we never use these as top-level names, they are wrappers
|
|
100
|
+
const WRAPPERS = ['BoundedBTreeMap', 'BoundedBTreeSet', 'BoundedVec', 'Box', 'BTreeMap', 'BTreeSet', 'Cow', 'Option', 'Range', 'RangeInclusive', 'Result', 'WeakBoundedVec', 'WrapperKeepOpaque', 'WrapperOpaque'];
|
|
101
|
+
|
|
102
|
+
// These are reserved and/or conflicts with built-in Codec or JS definitions
|
|
103
|
+
const RESERVED = [
|
|
104
|
+
// JS reserved words
|
|
105
|
+
'entries', 'keys', 'new', 'size',
|
|
106
|
+
// exposed by all Codec objects
|
|
107
|
+
'hash', 'registry'
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
// Remove these from all paths at index 1
|
|
111
|
+
const PATH_RM_INDEX_1 = ['generic', 'misc', 'pallet', 'traits', 'types'];
|
|
112
|
+
|
|
113
|
+
/** @internal Converts a Text[] into string[] (used as part of definitions) */
|
|
114
|
+
function sanitizeDocs (docs: Text[]): string[] {
|
|
115
|
+
const count = docs.length;
|
|
116
|
+
const result = new Array<string>(count);
|
|
117
|
+
|
|
118
|
+
for (let i = 0; i < count; i++) {
|
|
119
|
+
result[i] = docs[i].toString();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** @internal Split a namespace with :: into individual parts */
|
|
126
|
+
function splitNamespace (values: string[]): string[][] {
|
|
127
|
+
const count = values.length;
|
|
128
|
+
const result = new Array<string[]>(count);
|
|
129
|
+
|
|
130
|
+
for (let i = 0; i < count; i++) {
|
|
131
|
+
result[i] = values[i].split('::');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** @internal Match a namespace based on parts (alongside wildcards) */
|
|
138
|
+
function matchParts (first: string[], second: (string | Text)[]): boolean {
|
|
139
|
+
return first.length === second.length && first.every((a, index) => {
|
|
140
|
+
const b = second[index].toString();
|
|
141
|
+
|
|
142
|
+
if ((a === '*') || (a === b)) {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (a.includes('*') && a.includes('_') && b.includes('_')) {
|
|
147
|
+
let suba = a.split('_');
|
|
148
|
+
let subb = b.split('_');
|
|
149
|
+
|
|
150
|
+
// match initial *'s to multiples if we have a match for the other
|
|
151
|
+
if (suba[0] === '*') {
|
|
152
|
+
const indexOf = subb.indexOf(suba[1]);
|
|
153
|
+
|
|
154
|
+
if (indexOf !== -1) {
|
|
155
|
+
suba = suba.slice(1);
|
|
156
|
+
subb = subb.slice(indexOf);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// check for * matches at the end, adjust accordingly
|
|
161
|
+
if ((suba.length === 2) && (suba[1] === '*') && (suba[0] === subb[0])) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return matchParts(suba, subb);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return false;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** @internal check if the path matches the PATHS_ALIAS (with wildcards) */
|
|
173
|
+
function getAliasPath ({ def, path }: SiType): string | null {
|
|
174
|
+
// specific logic for weights - we override when non-complex struct
|
|
175
|
+
// (as applied in Weight 1.5 where we also have `Compact<{ refTime: u64 }>)
|
|
176
|
+
if (['frame_support::weights::weight_v2::Weight', 'sp_weights::weight_v2::Weight'].includes(path.join('::'))) {
|
|
177
|
+
return !def.isComposite || def.asComposite.fields.length === 1
|
|
178
|
+
? 'WeightV1'
|
|
179
|
+
: null;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// TODO We need to handle ink! Balance in some way
|
|
183
|
+
return path.length && PATHS_ALIAS.some((a) => matchParts(a, path))
|
|
184
|
+
? path[path.length - 1].toString()
|
|
185
|
+
: null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** @internal Converts a type name into a JS-API compatible name */
|
|
189
|
+
function extractNameFlat (portable: PortableType[], lookupIndex: number, params: SiTypeParameter[], path: AnyString[], isInternal = false): Extract | null {
|
|
190
|
+
const count = path.length;
|
|
191
|
+
|
|
192
|
+
// if we have no path or determined as a wrapper, we just skip it
|
|
193
|
+
if (count === 0 || WRAPPERS.includes(path[count - 1].toString())) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const camels = new Array<string>(count);
|
|
198
|
+
const lowers = new Array<string>(count);
|
|
199
|
+
|
|
200
|
+
// initially just create arrays of the camelCase and lowercase path
|
|
201
|
+
// parts - we will check these to extract the final values. While
|
|
202
|
+
// we have 2 loops here, we also don't do the same operation twice
|
|
203
|
+
for (let i = 0; i < count; i++) {
|
|
204
|
+
const c = stringPascalCase(
|
|
205
|
+
isInternal
|
|
206
|
+
? path[i].replace('pallet_', '')
|
|
207
|
+
: path[i]
|
|
208
|
+
);
|
|
209
|
+
const l = c.toLowerCase();
|
|
210
|
+
|
|
211
|
+
camels[i] = c;
|
|
212
|
+
lowers[i] = l;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
let name = '';
|
|
216
|
+
|
|
217
|
+
for (let i = 0; i < count; i++) {
|
|
218
|
+
const l = lowers[i];
|
|
219
|
+
|
|
220
|
+
// Remove ::{generic, misc, pallet, traits, types}::
|
|
221
|
+
if (i !== 1 || !PATH_RM_INDEX_1.includes(l)) {
|
|
222
|
+
// sp_runtime::generic::digest::Digest -> sp_runtime::generic::Digest
|
|
223
|
+
// sp_runtime::multiaddress::MultiAddress -> sp_runtime::MultiAddress
|
|
224
|
+
if (l !== lowers[i + 1]) {
|
|
225
|
+
name += camels[i];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// do magic for RawOrigin lookup, e.g. pallet_collective::RawOrigin
|
|
231
|
+
if (camels[1] === 'RawOrigin' && count === 2 && params.length === 2 && params[1].type.isSome) {
|
|
232
|
+
const instanceType = portable[params[1].type.unwrap().toNumber()];
|
|
233
|
+
|
|
234
|
+
if (instanceType.type.path.length === 2) {
|
|
235
|
+
name = `${name}${instanceType.type.path[1].toString()}`;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return { lookupIndex, name, params };
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** @internal Alias for extractNameFlat with PortableType as a last parameter */
|
|
243
|
+
function extractName (portable: PortableType[], lookupIndex: number, { type: { params, path } }: PortableType): Extract | null {
|
|
244
|
+
return extractNameFlat(portable, lookupIndex, params, path);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** @internal Check for dupes from a specific index onwards */
|
|
248
|
+
function nextDupeMatches (name: string, startAt: number, names: Extract[]): Extract[] {
|
|
249
|
+
const result = [names[startAt]];
|
|
250
|
+
|
|
251
|
+
for (let i = startAt + 1, count = names.length; i < count; i++) {
|
|
252
|
+
const v = names[i];
|
|
253
|
+
|
|
254
|
+
if (v.name === name) {
|
|
255
|
+
result.push(v);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return result;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** @internal Checks to see if a type is a full duplicate (with all params matching) */
|
|
263
|
+
function rewriteDupes (input: ExtractBase[], rewrite: Record<number, string>): boolean {
|
|
264
|
+
const count = input.length;
|
|
265
|
+
|
|
266
|
+
for (let i = 0; i < count; i++) {
|
|
267
|
+
const a = input[i];
|
|
268
|
+
|
|
269
|
+
for (let j = i + 1; j < count; j++) {
|
|
270
|
+
const b = input[j];
|
|
271
|
+
|
|
272
|
+
// if the indexes are not the same and the names match, we have a dupe
|
|
273
|
+
if (a.lookupIndex !== b.lookupIndex && a.name === b.name) {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// add all the adjusted values to the rewite map
|
|
280
|
+
for (let i = 0; i < count; i++) {
|
|
281
|
+
const p = input[i];
|
|
282
|
+
|
|
283
|
+
rewrite[p.lookupIndex] = p.name;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** @internal Find duplicates and adjust the names based on parameters */
|
|
290
|
+
function removeDupeNames (lookup: PortableRegistry, portable: PortableType[], names: Extract[]): Extract[] {
|
|
291
|
+
const rewrite: Record<number, string> = {};
|
|
292
|
+
|
|
293
|
+
return names
|
|
294
|
+
.map((original, startAt): Extract | null => {
|
|
295
|
+
const { lookupIndex, name, params } = original;
|
|
296
|
+
|
|
297
|
+
if (!name) {
|
|
298
|
+
// the name is empty (this is not expected, but have a failsafe)
|
|
299
|
+
return null;
|
|
300
|
+
} else if (rewrite[lookupIndex]) {
|
|
301
|
+
// we have already rewritten this one, we can skip it
|
|
302
|
+
return original;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// those where the name is matching starting from this index
|
|
306
|
+
const allSame = nextDupeMatches(name, startAt, names);
|
|
307
|
+
|
|
308
|
+
// we only have one, so all ok
|
|
309
|
+
if (allSame.length === 1) {
|
|
310
|
+
return original;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// are there param differences between matching names
|
|
314
|
+
const anyDiff = allSame.some((o) =>
|
|
315
|
+
params.length !== o.params.length ||
|
|
316
|
+
params.some((p, index) =>
|
|
317
|
+
!p.name.eq(o.params[index].name) ||
|
|
318
|
+
p.type.unwrapOr(TYPE_UNWRAP).toNumber() !== o.params[index].type.unwrapOr(TYPE_UNWRAP).toNumber()
|
|
319
|
+
)
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
// everything matches, we can combine these
|
|
323
|
+
if (!anyDiff) {
|
|
324
|
+
return original;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// TODO We probably want to attach all the indexes with differences,
|
|
328
|
+
// not just the first
|
|
329
|
+
// find the first parameter that yields differences
|
|
330
|
+
const paramIdx = params.findIndex(({ type }, index) =>
|
|
331
|
+
allSame.every(({ params }, aIndex) =>
|
|
332
|
+
params[index].type.isSome && (
|
|
333
|
+
aIndex === 0 ||
|
|
334
|
+
!params[index].type.eq(type)
|
|
335
|
+
)
|
|
336
|
+
)
|
|
337
|
+
);
|
|
338
|
+
|
|
339
|
+
// No param found that is different
|
|
340
|
+
if (paramIdx === -1) {
|
|
341
|
+
return original;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// see if using the param type helps
|
|
345
|
+
const sameCount = allSame.length;
|
|
346
|
+
const adjusted = new Array<ExtractBase>(sameCount);
|
|
347
|
+
|
|
348
|
+
// loop through all, specifically checking that index where the
|
|
349
|
+
// first param yields differences
|
|
350
|
+
for (let i = 0; i < sameCount; i++) {
|
|
351
|
+
const { lookupIndex, name, params } = allSame[i];
|
|
352
|
+
const { def, path } = lookup.getSiType(params[paramIdx].type.unwrap());
|
|
353
|
+
|
|
354
|
+
// if it is not a primitive and it doesn't have a path, we really cannot
|
|
355
|
+
// do anything at this point
|
|
356
|
+
if (!def.isPrimitive && !path.length) {
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
adjusted[i] = {
|
|
361
|
+
lookupIndex,
|
|
362
|
+
name: def.isPrimitive
|
|
363
|
+
? `${name}${def.asPrimitive.toString()}`
|
|
364
|
+
: `${name}${path[path.length - 1].toString()}`
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// check to see if the adjusted names have no issues
|
|
369
|
+
if (rewriteDupes(adjusted, rewrite)) {
|
|
370
|
+
return original;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// TODO This is duplicated from the section just above...
|
|
374
|
+
// ... we certainly need a better solution here
|
|
375
|
+
//
|
|
376
|
+
// Last-ditch effort to use the full type path - ugly
|
|
377
|
+
// loop through all, specifically checking that index where the
|
|
378
|
+
// first param yields differences
|
|
379
|
+
for (let i = 0; i < sameCount; i++) {
|
|
380
|
+
const { lookupIndex, name, params } = allSame[i];
|
|
381
|
+
const { def, path } = lookup.getSiType(params[paramIdx].type.unwrap());
|
|
382
|
+
const flat = extractNameFlat(portable, lookupIndex, params, path, true);
|
|
383
|
+
|
|
384
|
+
if (def.isPrimitive || !flat) {
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
adjusted[i] = {
|
|
389
|
+
lookupIndex,
|
|
390
|
+
name: `${name}${flat.name}`
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// check to see if the adjusted names have no issues
|
|
395
|
+
if (rewriteDupes(adjusted, rewrite)) {
|
|
396
|
+
return original;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return null;
|
|
400
|
+
})
|
|
401
|
+
.filter((n): n is Extract => !!n)
|
|
402
|
+
.map(({ lookupIndex, name, params }): Extract => ({
|
|
403
|
+
lookupIndex,
|
|
404
|
+
name: rewrite[lookupIndex] || name,
|
|
405
|
+
params
|
|
406
|
+
}));
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/** @internal Detect on-chain types (AccountId/Signature) as set as the default */
|
|
410
|
+
function registerTypes (lookup: PortableRegistry, lookups: Record<string, string>, names: Record<number, string>, params: TypeInfoParams): void {
|
|
411
|
+
// Register the types we extracted
|
|
412
|
+
lookup.registry.register(lookups);
|
|
413
|
+
|
|
414
|
+
// Try and extract the AccountId/Address/Signature type from UncheckedExtrinsic
|
|
415
|
+
if (params.SpRuntimeUncheckedExtrinsic) {
|
|
416
|
+
// Address, Call, Signature, Extra
|
|
417
|
+
const [addrParam,, sigParam] = params.SpRuntimeUncheckedExtrinsic;
|
|
418
|
+
const siAddress = lookup.getSiType(addrParam.type.unwrap());
|
|
419
|
+
const siSignature = lookup.getSiType(sigParam.type.unwrap());
|
|
420
|
+
const nsSignature = siSignature.path.join('::');
|
|
421
|
+
let nsAccountId = siAddress.path.join('::');
|
|
422
|
+
const isMultiAddress = nsAccountId === 'sp_runtime::multiaddress::MultiAddress';
|
|
423
|
+
|
|
424
|
+
// With multiaddress, we check the first type param again
|
|
425
|
+
if (isMultiAddress) {
|
|
426
|
+
// AccountId, AccountIndex
|
|
427
|
+
const [idParam] = siAddress.params;
|
|
428
|
+
|
|
429
|
+
nsAccountId = lookup.getSiType(idParam.type.unwrap()).path.join('::');
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
lookup.registry.register({
|
|
433
|
+
// known: account::AccountId20, fp_account::AccountId20, primitive_types::H160
|
|
434
|
+
AccountId: nsAccountId.endsWith('::AccountId20') || nsAccountId.endsWith('::H160')
|
|
435
|
+
? 'AccountId20'
|
|
436
|
+
: 'AccountId32',
|
|
437
|
+
Address: isMultiAddress
|
|
438
|
+
? 'MultiAddress'
|
|
439
|
+
: 'AccountId',
|
|
440
|
+
ExtrinsicSignature: ['sp_runtime::MultiSignature'].includes(nsSignature)
|
|
441
|
+
? 'MultiSignature'
|
|
442
|
+
: names[sigParam.type.unwrap().toNumber()] || 'MultiSignature'
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* @internal Extracts aliases based on what we know the runtime config looks like in a
|
|
449
|
+
* Substrate chain. Specifically we want to have access to the Call and Event params
|
|
450
|
+
**/
|
|
451
|
+
function extractAliases (params: TypeInfoParams, isContract?: boolean): Record<number, string> {
|
|
452
|
+
const hasParams = Object.keys(params).some((k) => !k.startsWith('Pallet'));
|
|
453
|
+
const alias: Record<number, string> = {};
|
|
454
|
+
|
|
455
|
+
if (params.SpRuntimeUncheckedExtrinsic) {
|
|
456
|
+
// Address, Call, Signature, Extra
|
|
457
|
+
const [, { type }] = params.SpRuntimeUncheckedExtrinsic;
|
|
458
|
+
|
|
459
|
+
alias[type.unwrap().toNumber()] = 'Call';
|
|
460
|
+
} else if (hasParams && !isContract) {
|
|
461
|
+
l.warn('Unable to determine runtime Call type, cannot inspect sp_runtime::generic::unchecked_extrinsic::UncheckedExtrinsic');
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if (params.FrameSystemEventRecord) {
|
|
465
|
+
// Event, Topic
|
|
466
|
+
const [{ type }] = params.FrameSystemEventRecord;
|
|
467
|
+
|
|
468
|
+
alias[type.unwrap().toNumber()] = 'Event';
|
|
469
|
+
} else if (hasParams && !isContract) {
|
|
470
|
+
l.warn('Unable to determine runtime Event type, cannot inspect frame_system::EventRecord');
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return alias;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/** @internal Extracts all the intreresting type information for this registry */
|
|
477
|
+
function extractTypeInfo (lookup: PortableRegistry, portable: PortableType[]): TypeInfo {
|
|
478
|
+
const nameInfo: Extract[] = [];
|
|
479
|
+
const types: Record<number, PortableType> = {};
|
|
480
|
+
|
|
481
|
+
for (let i = 0, count = portable.length; i < count; i++) {
|
|
482
|
+
const type = portable[i];
|
|
483
|
+
const lookupIndex = type.id.toNumber();
|
|
484
|
+
const extracted = extractName(portable, lookupIndex, portable[i]);
|
|
485
|
+
|
|
486
|
+
if (extracted) {
|
|
487
|
+
nameInfo.push(extracted);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
types[lookupIndex] = type;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const lookups: Record<string, LookupString> = {};
|
|
494
|
+
const names: Record<number, string> = {};
|
|
495
|
+
const params = {} as TypeInfoParams;
|
|
496
|
+
const dedup = removeDupeNames(lookup, portable, nameInfo);
|
|
497
|
+
|
|
498
|
+
for (let i = 0, count = dedup.length; i < count; i++) {
|
|
499
|
+
const { lookupIndex, name, params: p } = dedup[i];
|
|
500
|
+
|
|
501
|
+
names[lookupIndex] = name;
|
|
502
|
+
lookups[name] = lookup.registry.createLookupType(lookupIndex);
|
|
503
|
+
params[name] = p;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
return { lookups, names, params, types };
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export class PortableRegistry extends Struct implements ILookup {
|
|
510
|
+
#alias: Record<number, string>;
|
|
511
|
+
#lookups: Record<string, LookupString>;
|
|
512
|
+
#names: Record<number, string>;
|
|
513
|
+
#params: TypeInfoParams;
|
|
514
|
+
#typeDefs: Record<number, TypeDef> = {};
|
|
515
|
+
#types: Record<number, PortableType>;
|
|
516
|
+
|
|
517
|
+
constructor (registry: Registry, value?: Uint8Array, isContract?: boolean) {
|
|
518
|
+
// const timeStart = performance.now()
|
|
519
|
+
|
|
520
|
+
super(registry, {
|
|
521
|
+
types: 'Vec<PortableType>'
|
|
522
|
+
}, value);
|
|
523
|
+
|
|
524
|
+
const { lookups, names, params, types } = extractTypeInfo(this, this.types);
|
|
525
|
+
|
|
526
|
+
this.#alias = extractAliases(params, isContract);
|
|
527
|
+
this.#lookups = lookups;
|
|
528
|
+
this.#names = names;
|
|
529
|
+
this.#params = params;
|
|
530
|
+
this.#types = types;
|
|
531
|
+
|
|
532
|
+
// console.log('PortableRegistry', `${(performance.now() - timeStart).toFixed(2)}ms`)
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* @description Returns all the available type names for this chain
|
|
537
|
+
**/
|
|
538
|
+
public get names (): string[] {
|
|
539
|
+
return Object.values(this.#names).sort();
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* @description Returns all the available parameterized types for this chain
|
|
544
|
+
**/
|
|
545
|
+
public get paramTypes (): TypeInfoParams {
|
|
546
|
+
return this.#params;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* @description The types of the registry
|
|
551
|
+
*/
|
|
552
|
+
public get types (): Vec<PortableType> {
|
|
553
|
+
return this.getT('types');
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* @description Register all available types into the registry (generally for internal usage)
|
|
558
|
+
*/
|
|
559
|
+
public register (): void {
|
|
560
|
+
registerTypes(this, this.#lookups, this.#names, this.#params);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* @description Returns the name for a specific lookup
|
|
565
|
+
*/
|
|
566
|
+
public getName (lookupId: SiLookupTypeId | LookupString | number): string | undefined {
|
|
567
|
+
return this.#names[this.#getLookupId(lookupId)];
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* @description Finds a specific type in the registry
|
|
572
|
+
*/
|
|
573
|
+
public getSiType (lookupId: SiLookupTypeId | LookupString | number): SiType {
|
|
574
|
+
// NOTE catch-22 - this may already be used as part of the constructor, so
|
|
575
|
+
// ensure that we have actually initialized it correctly
|
|
576
|
+
const found = (this.#types || this.types)[this.#getLookupId(lookupId)];
|
|
577
|
+
|
|
578
|
+
if (!found) {
|
|
579
|
+
throw new Error(`PortableRegistry: Unable to find type with lookupId ${lookupId.toString()}`);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
return found.type;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* @description Lookup the type definition for the index
|
|
587
|
+
*/
|
|
588
|
+
public getTypeDef (lookupId: SiLookupTypeId | LookupString | number): TypeDef {
|
|
589
|
+
const lookupIndex = this.#getLookupId(lookupId);
|
|
590
|
+
|
|
591
|
+
if (!this.#typeDefs[lookupIndex]) {
|
|
592
|
+
const lookupName = this.#names[lookupIndex];
|
|
593
|
+
const empty = {
|
|
594
|
+
info: TypeDefInfo.DoNotConstruct,
|
|
595
|
+
lookupIndex,
|
|
596
|
+
lookupName,
|
|
597
|
+
type: this.registry.createLookupType(lookupIndex)
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
// Set named items since we will get into circular lookups along the way
|
|
601
|
+
if (lookupName) {
|
|
602
|
+
this.#typeDefs[lookupIndex] = empty;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
const extracted = this.#extract(this.getSiType(lookupId), lookupIndex);
|
|
606
|
+
|
|
607
|
+
// For non-named items, we only set this right at the end
|
|
608
|
+
if (!lookupName) {
|
|
609
|
+
this.#typeDefs[lookupIndex] = empty;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
Object.keys(extracted).forEach((k): void => {
|
|
613
|
+
if (k !== 'lookupName' || extracted[k]) {
|
|
614
|
+
// these are safe since we are looking through the keys as set
|
|
615
|
+
this.#typeDefs[lookupIndex][k as 'info'] = extracted[k as 'info'];
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
// don't set lookupName on lower-level, we want to always direct to the type
|
|
620
|
+
if (extracted.info === TypeDefInfo.Plain) {
|
|
621
|
+
this.#typeDefs[lookupIndex].lookupNameRoot = this.#typeDefs[lookupIndex].lookupName;
|
|
622
|
+
delete this.#typeDefs[lookupIndex].lookupName;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
return this.#typeDefs[lookupIndex];
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* @description For a specific field, perform adjustments to not have built-in conflicts
|
|
631
|
+
*/
|
|
632
|
+
public sanitizeField (name: Option<Text>): [string | null, string | null] {
|
|
633
|
+
let nameField: string | null = null;
|
|
634
|
+
let nameOrig: string | null = null;
|
|
635
|
+
|
|
636
|
+
if (name.isSome) {
|
|
637
|
+
nameField = stringCamelCase(name.unwrap());
|
|
638
|
+
|
|
639
|
+
if (nameField.includes('#')) {
|
|
640
|
+
nameOrig = nameField;
|
|
641
|
+
nameField = nameOrig.replace(/#/g, '_');
|
|
642
|
+
} else if (RESERVED.includes(nameField)) {
|
|
643
|
+
nameOrig = nameField;
|
|
644
|
+
nameField = `${nameField}_`;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
return [nameField, nameOrig];
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/** @internal Creates a TypeDef based on an internal lookupId */
|
|
652
|
+
#createSiDef (lookupId: SiLookupTypeId): TypeDef {
|
|
653
|
+
const typeDef = this.getTypeDef(lookupId);
|
|
654
|
+
const lookupIndex = lookupId.toNumber();
|
|
655
|
+
|
|
656
|
+
// Setup for a lookup on complex types
|
|
657
|
+
return [TypeDefInfo.DoNotConstruct, TypeDefInfo.Enum, TypeDefInfo.Struct].includes(typeDef.info) && typeDef.lookupName
|
|
658
|
+
? {
|
|
659
|
+
docs: typeDef.docs,
|
|
660
|
+
info: TypeDefInfo.Si,
|
|
661
|
+
lookupIndex,
|
|
662
|
+
lookupName: this.#names[lookupIndex],
|
|
663
|
+
type: this.registry.createLookupType(lookupId)
|
|
664
|
+
}
|
|
665
|
+
: typeDef;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/** @internal Converts a lookupId input to the actual lookup index */
|
|
669
|
+
#getLookupId (lookupId: SiLookupTypeId | LookupString | number): number {
|
|
670
|
+
if (isString(lookupId)) {
|
|
671
|
+
if (!this.registry.isLookupType(lookupId)) {
|
|
672
|
+
throw new Error(`PortableRegistry: Expected a lookup string type, found ${lookupId as string}`);
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
return parseInt(lookupId.replace('Lookup', ''), 10);
|
|
676
|
+
} else if (isNumber(lookupId)) {
|
|
677
|
+
return lookupId;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
return lookupId.toNumber();
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/** @internal Converts a type into a TypeDef for Codec usage */
|
|
684
|
+
#extract (type: SiType, lookupIndex: number): TypeDef {
|
|
685
|
+
const namespace = type.path.join('::');
|
|
686
|
+
let typeDef: TypeDef;
|
|
687
|
+
const aliasType = this.#alias[lookupIndex] || getAliasPath(type);
|
|
688
|
+
|
|
689
|
+
try {
|
|
690
|
+
if (aliasType) {
|
|
691
|
+
typeDef = this.#extractAliasPath(lookupIndex, aliasType);
|
|
692
|
+
} else {
|
|
693
|
+
switch (type.def.type) {
|
|
694
|
+
case 'Array': typeDef = this.#extractArray(lookupIndex, type.def.asArray); break;
|
|
695
|
+
case 'BitSequence': typeDef = this.#extractBitSequence(lookupIndex, type.def.asBitSequence); break;
|
|
696
|
+
case 'Compact': typeDef = this.#extractCompact(lookupIndex, type.def.asCompact); break;
|
|
697
|
+
case 'Composite': typeDef = this.#extractComposite(lookupIndex, type, type.def.asComposite); break;
|
|
698
|
+
case 'HistoricMetaCompat': typeDef = this.#extractHistoric(lookupIndex, type.def.asHistoricMetaCompat); break;
|
|
699
|
+
case 'Primitive': typeDef = this.#extractPrimitive(lookupIndex, type); break;
|
|
700
|
+
case 'Sequence': typeDef = this.#extractSequence(lookupIndex, type.def.asSequence); break;
|
|
701
|
+
case 'Tuple': typeDef = this.#extractTuple(lookupIndex, type.def.asTuple); break;
|
|
702
|
+
case 'Variant': typeDef = this.#extractVariant(lookupIndex, type, type.def.asVariant); break;
|
|
703
|
+
default: assertUnreachable(type.def.type);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
} catch (error) {
|
|
707
|
+
throw new Error(`PortableRegistry: ${lookupIndex}${namespace ? ` (${namespace})` : ''}: Error extracting ${stringify(type)}: ${(error as Error).message}`);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
return objectSpread({
|
|
711
|
+
docs: sanitizeDocs(type.docs),
|
|
712
|
+
namespace
|
|
713
|
+
}, typeDef);
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/** @internal Extracts a ScaleInfo Array into TypeDef.VecFixed */
|
|
717
|
+
#extractArray (_: number, { len, type }: SiTypeDefArray): TypeDef {
|
|
718
|
+
const length = len.toNumber();
|
|
719
|
+
|
|
720
|
+
if (length > 2048) {
|
|
721
|
+
throw new Error('Only support for [Type; <length>], where length <= 2048');
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
return withTypeString(this.registry, {
|
|
725
|
+
info: TypeDefInfo.VecFixed,
|
|
726
|
+
length,
|
|
727
|
+
sub: this.#createSiDef(type)
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/** @internal Extracts a ScaleInfo BitSequence into TypeDef.Plain */
|
|
732
|
+
#extractBitSequence (_: number, { bitOrderType, bitStoreType }: SiTypeDefBitSequence): TypeDef {
|
|
733
|
+
// With the v3 of scale-info this swapped around, but obviously the decoder cannot determine
|
|
734
|
+
// the order. With that in-mind, we apply a detection for LSb0/Msb and set accordingly
|
|
735
|
+
const a = this.#createSiDef(bitOrderType);
|
|
736
|
+
const b = this.#createSiDef(bitStoreType);
|
|
737
|
+
const [bitOrder, bitStore] = BITVEC_NS.includes(a.namespace || '')
|
|
738
|
+
? [a, b]
|
|
739
|
+
: [b, a];
|
|
740
|
+
|
|
741
|
+
if (!bitOrder.namespace || !BITVEC_NS.includes(bitOrder.namespace)) {
|
|
742
|
+
throw new Error(`Unexpected bitOrder found as ${bitOrder.namespace || '<unknown>'}`);
|
|
743
|
+
} else if (bitStore.info !== TypeDefInfo.Plain || bitStore.type !== 'u8') {
|
|
744
|
+
throw new Error(`Only u8 bitStore is currently supported, found ${bitStore.type}`);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
const isLsb = BITVEC_NS_LSB.includes(bitOrder.namespace);
|
|
748
|
+
|
|
749
|
+
if (!isLsb) {
|
|
750
|
+
// TODO To remove this limitation, we need to pass an extra info flag
|
|
751
|
+
// through to the TypeDef (Here we could potentially re-use something
|
|
752
|
+
// like index (???) to indicate and ensure we use it to pass to the
|
|
753
|
+
// BitVec constructor - which does handle this type)
|
|
754
|
+
//
|
|
755
|
+
// See https://github.com/polkadot-js/api/issues/5588
|
|
756
|
+
// throw new Error(`Only LSB BitVec is currently supported, found ${bitOrder.namespace}`);
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
return {
|
|
760
|
+
info: TypeDefInfo.Plain,
|
|
761
|
+
type: 'BitVec'
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/** @internal Extracts a ScaleInfo Compact into TypeDef.Compact */
|
|
766
|
+
#extractCompact (_: number, { type }: SiTypeDefCompact): TypeDef {
|
|
767
|
+
return withTypeString(this.registry, {
|
|
768
|
+
info: TypeDefInfo.Compact,
|
|
769
|
+
sub: this.#createSiDef(type)
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/** @internal Extracts a ScaleInfo Composite into TypeDef.{BTree*, Range*, Wrapper*} */
|
|
774
|
+
#extractComposite (lookupIndex: number, { params, path }: SiType, { fields }: SiTypeDefComposite): TypeDef {
|
|
775
|
+
if (path.length) {
|
|
776
|
+
const pathFirst = path[0].toString();
|
|
777
|
+
const pathLast = path[path.length - 1].toString();
|
|
778
|
+
|
|
779
|
+
if (path.length === 1 && pathFirst === 'BTreeMap') {
|
|
780
|
+
if (params.length !== 2) {
|
|
781
|
+
throw new Error(`BTreeMap requires 2 parameters, found ${params.length}`);
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
return withTypeString(this.registry, {
|
|
785
|
+
info: TypeDefInfo.BTreeMap,
|
|
786
|
+
sub: params.map(({ type }) => this.#createSiDef(type.unwrap()))
|
|
787
|
+
});
|
|
788
|
+
} else if (path.length === 1 && pathFirst === 'BTreeSet') {
|
|
789
|
+
if (params.length !== 1) {
|
|
790
|
+
throw new Error(`BTreeSet requires 1 parameter, found ${params.length}`);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
return withTypeString(this.registry, {
|
|
794
|
+
info: TypeDefInfo.BTreeSet,
|
|
795
|
+
sub: this.#createSiDef(params[0].type.unwrap())
|
|
796
|
+
});
|
|
797
|
+
} else if (['Range', 'RangeInclusive'].includes(pathFirst)) {
|
|
798
|
+
if (params.length !== 1) {
|
|
799
|
+
throw new Error(`Range requires 1 parameter, found ${params.length}`);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
return withTypeString(this.registry, {
|
|
803
|
+
info: pathFirst === 'Range'
|
|
804
|
+
? TypeDefInfo.Range
|
|
805
|
+
: TypeDefInfo.RangeInclusive,
|
|
806
|
+
sub: this.#createSiDef(params[0].type.unwrap()),
|
|
807
|
+
type: pathFirst
|
|
808
|
+
});
|
|
809
|
+
} else if (['WrapperKeepOpaque', 'WrapperOpaque'].includes(pathLast)) {
|
|
810
|
+
if (params.length !== 1) {
|
|
811
|
+
throw new Error(`WrapperOpaque requires 1 parameter, found ${params.length}`);
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
return withTypeString(this.registry, {
|
|
815
|
+
info: pathLast === 'WrapperKeepOpaque'
|
|
816
|
+
? TypeDefInfo.WrapperKeepOpaque
|
|
817
|
+
: TypeDefInfo.WrapperOpaque,
|
|
818
|
+
sub: this.#createSiDef(params[0].type.unwrap()),
|
|
819
|
+
type: pathLast
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
return PATHS_SET.some((p) => matchParts(p, path))
|
|
825
|
+
? this.#extractCompositeSet(lookupIndex, params, fields)
|
|
826
|
+
: this.#extractFields(lookupIndex, fields);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
/** @internal Extracts a ScaleInfo CompositeSet into TypeDef.Set */
|
|
830
|
+
#extractCompositeSet (_: number, params: SiTypeParameter[], fields: SiField[]): TypeDef {
|
|
831
|
+
if (params.length !== 1 || fields.length !== 1) {
|
|
832
|
+
throw new Error('Set handling expects param/field as single entries');
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
return withTypeString(this.registry, {
|
|
836
|
+
info: TypeDefInfo.Set,
|
|
837
|
+
length: this.registry.createTypeUnsafe<u32>(this.registry.createLookupType(fields[0].type), []).bitLength(),
|
|
838
|
+
sub: this.getSiType(params[0].type.unwrap()).def.asVariant.variants.map(({ index, name }): TypeDef => ({
|
|
839
|
+
// This will be an issue > 2^53 - 1 ... don't have those (yet)
|
|
840
|
+
index: index.toNumber(),
|
|
841
|
+
info: TypeDefInfo.Plain,
|
|
842
|
+
name: name.toString(),
|
|
843
|
+
type: 'Null'
|
|
844
|
+
}))
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/** @internal Extracts ScaleInfo enum/struct fields into TypeDef.{Struct, Tuple} */
|
|
849
|
+
#extractFields (lookupIndex: number, fields: SiField[]): TypeDef {
|
|
850
|
+
let isStruct = true;
|
|
851
|
+
let isTuple = true;
|
|
852
|
+
const count = fields.length;
|
|
853
|
+
|
|
854
|
+
for (let f = 0; f < count; f++) {
|
|
855
|
+
const { name } = fields[f];
|
|
856
|
+
|
|
857
|
+
isStruct = isStruct && name.isSome;
|
|
858
|
+
isTuple = isTuple && name.isNone;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
if (!isTuple && !isStruct) {
|
|
862
|
+
throw new Error('Invalid fields type detected, expected either Tuple (all unnamed) or Struct (all named)');
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
if (count === 0) {
|
|
866
|
+
return {
|
|
867
|
+
info: TypeDefInfo.Null,
|
|
868
|
+
type: 'Null'
|
|
869
|
+
};
|
|
870
|
+
} else if (isTuple && count === 1) {
|
|
871
|
+
const typeDef = this.#createSiDef(fields[0].type);
|
|
872
|
+
|
|
873
|
+
return objectSpread(
|
|
874
|
+
{},
|
|
875
|
+
typeDef,
|
|
876
|
+
lookupIndex === -1
|
|
877
|
+
? null
|
|
878
|
+
: {
|
|
879
|
+
lookupIndex,
|
|
880
|
+
lookupName: this.#names[lookupIndex],
|
|
881
|
+
lookupNameRoot: typeDef.lookupName
|
|
882
|
+
},
|
|
883
|
+
fields[0].typeName.isSome
|
|
884
|
+
? { typeName: sanitize(fields[0].typeName.unwrap()) }
|
|
885
|
+
: null
|
|
886
|
+
);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
const [sub, alias] = this.#extractFieldsAlias(fields);
|
|
890
|
+
|
|
891
|
+
return withTypeString(this.registry, objectSpread(
|
|
892
|
+
{
|
|
893
|
+
info: isTuple // Tuple check first
|
|
894
|
+
? TypeDefInfo.Tuple
|
|
895
|
+
: TypeDefInfo.Struct,
|
|
896
|
+
sub
|
|
897
|
+
},
|
|
898
|
+
alias.size
|
|
899
|
+
? { alias }
|
|
900
|
+
: null,
|
|
901
|
+
lookupIndex === -1
|
|
902
|
+
? null
|
|
903
|
+
: {
|
|
904
|
+
lookupIndex,
|
|
905
|
+
lookupName: this.#names[lookupIndex]
|
|
906
|
+
}
|
|
907
|
+
));
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
/** @internal Apply field aliassed (with no JS conflicts) */
|
|
911
|
+
#extractFieldsAlias (fields: SiField[]): [TypeDef[], Map<string, string>] {
|
|
912
|
+
const alias = new Map<string, string>();
|
|
913
|
+
const count = fields.length;
|
|
914
|
+
const sub = new Array<TypeDef>(count);
|
|
915
|
+
|
|
916
|
+
for (let i = 0; i < count; i++) {
|
|
917
|
+
const { docs, name, type, typeName } = fields[i];
|
|
918
|
+
const typeDef = this.#createSiDef(type);
|
|
919
|
+
|
|
920
|
+
if (name.isNone) {
|
|
921
|
+
sub[i] = typeDef;
|
|
922
|
+
} else {
|
|
923
|
+
const [nameField, nameOrig] = this.sanitizeField(name);
|
|
924
|
+
|
|
925
|
+
if (nameField && nameOrig) {
|
|
926
|
+
alias.set(nameField, nameOrig);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
sub[i] = objectSpread(
|
|
930
|
+
{
|
|
931
|
+
docs: sanitizeDocs(docs),
|
|
932
|
+
name: nameField
|
|
933
|
+
},
|
|
934
|
+
typeDef,
|
|
935
|
+
typeName.isSome
|
|
936
|
+
? { typeName: sanitize(typeName.unwrap()) }
|
|
937
|
+
: null
|
|
938
|
+
);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
return [sub, alias];
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/** @internal Extracts an internal Historic (pre V14) type */
|
|
946
|
+
#extractHistoric (_: number, type: Type): TypeDef {
|
|
947
|
+
return objectSpread({
|
|
948
|
+
displayName: type.toString(),
|
|
949
|
+
isFromSi: true
|
|
950
|
+
}, getTypeDef(type));
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/** @internal Extracts a ScaleInfo Primitive into TypeDef.Plain */
|
|
954
|
+
#extractPrimitive (_: number, type: SiType): TypeDef {
|
|
955
|
+
const typeStr = type.def.asPrimitive.type.toString();
|
|
956
|
+
|
|
957
|
+
return {
|
|
958
|
+
info: TypeDefInfo.Plain,
|
|
959
|
+
type: PRIMITIVE_ALIAS[typeStr] || typeStr.toLowerCase()
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/** @internal Applies an alias path onto the TypeDef */
|
|
964
|
+
#extractAliasPath (_: number, type: string): TypeDef {
|
|
965
|
+
return {
|
|
966
|
+
info: TypeDefInfo.Plain,
|
|
967
|
+
type
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
/** @internal Extracts a ScaleInfo Sequence into TypeDef.Vec (with Bytes shortcut) */
|
|
972
|
+
#extractSequence (lookupIndex: number, { type }: SiTypeDefSequence): TypeDef {
|
|
973
|
+
const sub = this.#createSiDef(type);
|
|
974
|
+
|
|
975
|
+
if (sub.type === 'u8') {
|
|
976
|
+
return {
|
|
977
|
+
info: TypeDefInfo.Plain,
|
|
978
|
+
type: 'Bytes'
|
|
979
|
+
};
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
return withTypeString(this.registry, {
|
|
983
|
+
info: TypeDefInfo.Vec,
|
|
984
|
+
lookupIndex,
|
|
985
|
+
lookupName: this.#names[lookupIndex],
|
|
986
|
+
sub
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
/** @internal Extracts a ScaleInfo Tuple into TypeDef.Tuple */
|
|
991
|
+
#extractTuple (lookupIndex: number, ids: SiTypeDefTuple): TypeDef {
|
|
992
|
+
if (ids.length === 0) {
|
|
993
|
+
return {
|
|
994
|
+
info: TypeDefInfo.Null,
|
|
995
|
+
type: 'Null'
|
|
996
|
+
};
|
|
997
|
+
} else if (ids.length === 1) {
|
|
998
|
+
return this.getTypeDef(ids[0]);
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
const sub = ids.map((t) => this.#createSiDef(t));
|
|
1002
|
+
|
|
1003
|
+
return withTypeString(this.registry, {
|
|
1004
|
+
info: TypeDefInfo.Tuple,
|
|
1005
|
+
lookupIndex,
|
|
1006
|
+
lookupName: this.#names[lookupIndex],
|
|
1007
|
+
sub
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
/** @internal Extracts a ScaleInfo Variant into TypeDef.{Option, Result, Enum} */
|
|
1012
|
+
#extractVariant (lookupIndex: number, { params, path }: SiType, { variants }: SiTypeDefVariant): TypeDef {
|
|
1013
|
+
if (path.length) {
|
|
1014
|
+
const specialVariant = path[0].toString();
|
|
1015
|
+
|
|
1016
|
+
if (specialVariant === 'Option') {
|
|
1017
|
+
if (params.length !== 1) {
|
|
1018
|
+
throw new Error(`Option requires 1 parameter, found ${params.length}`);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
// NOTE This is opt-in (unhandled), not by default
|
|
1022
|
+
// if (sub.type === 'bool') {
|
|
1023
|
+
// return withTypeString(this.registry, {
|
|
1024
|
+
// info: TypeDefInfo.Plain,
|
|
1025
|
+
// type: 'OptionBool'
|
|
1026
|
+
// });
|
|
1027
|
+
// }
|
|
1028
|
+
|
|
1029
|
+
return withTypeString(this.registry, {
|
|
1030
|
+
info: TypeDefInfo.Option,
|
|
1031
|
+
sub: this.#createSiDef(params[0].type.unwrap())
|
|
1032
|
+
});
|
|
1033
|
+
} else if (specialVariant === 'Result') {
|
|
1034
|
+
if (params.length !== 2) {
|
|
1035
|
+
throw new Error(`Result requires 2 parameters, found ${params.length}`);
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
return withTypeString(this.registry, {
|
|
1039
|
+
info: TypeDefInfo.Result,
|
|
1040
|
+
sub: params.map(({ type }, index) =>
|
|
1041
|
+
objectSpread({
|
|
1042
|
+
name: ['Ok', 'Error'][index]
|
|
1043
|
+
}, this.#createSiDef(type.unwrap()))
|
|
1044
|
+
)
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
if (variants.length === 0) {
|
|
1050
|
+
return {
|
|
1051
|
+
info: TypeDefInfo.Null,
|
|
1052
|
+
type: 'Null'
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
return this.#extractVariantEnum(lookupIndex, variants);
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
/** @internal Extracts a ScaleInfo Variant into TypeDef.Enum */
|
|
1060
|
+
#extractVariantEnum (lookupIndex: number, variants: SiVariant[]): TypeDef {
|
|
1061
|
+
const sub: (TypeDef & { name: string })[] = [];
|
|
1062
|
+
|
|
1063
|
+
// we may get entries out of order, arrange them first before creating with gaps filled
|
|
1064
|
+
// NOTE: Since we mutate, use a copy of the array as an input
|
|
1065
|
+
variants
|
|
1066
|
+
.slice()
|
|
1067
|
+
.sort((a, b) => a.index.cmp(b.index))
|
|
1068
|
+
.forEach(({ fields, index: bnIndex, name }) => {
|
|
1069
|
+
const index = bnIndex.toNumber();
|
|
1070
|
+
|
|
1071
|
+
while (sub.length !== index) {
|
|
1072
|
+
sub.push({
|
|
1073
|
+
index: sub.length,
|
|
1074
|
+
info: TypeDefInfo.Null,
|
|
1075
|
+
name: `__Unused${sub.length}`,
|
|
1076
|
+
type: 'Null'
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
sub.push(
|
|
1081
|
+
objectSpread(this.#extractFields(-1, fields), {
|
|
1082
|
+
index,
|
|
1083
|
+
name: name.toString()
|
|
1084
|
+
})
|
|
1085
|
+
);
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
return withTypeString(this.registry, {
|
|
1089
|
+
info: TypeDefInfo.Enum,
|
|
1090
|
+
lookupIndex,
|
|
1091
|
+
lookupName: this.#names[lookupIndex],
|
|
1092
|
+
sub
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
}
|