diff --git a/packages/apps-config/src/api/index.ts b/packages/apps-config/src/api/index.ts index a6cc590a35ca..8c2ca7dab95b 100644 --- a/packages/apps-config/src/api/index.ts +++ b/packages/apps-config/src/api/index.ts @@ -1,20 +1,20 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleType } from '@polkadot/types/types'; + import typesChain from './chain'; -import typesSpec from './spec'; -import specVersioned from './specVersioned'; +import spec from './spec'; export * from './constants'; export * from './params'; -export function getChainTypes (specName: string, chainName: string): Record> { +export function getChainTypes (_specName: string, chainName: string): Record> { return { - ...(typesSpec[specName as keyof typeof typesSpec] || {}), ...(typesChain[chainName as keyof typeof typesChain] || {}) }; } -export const typesBundle = { spec: specVersioned }; +export const typesBundle: OverrideBundleType = { spec }; -export { typesChain, typesSpec }; +export { typesChain }; diff --git a/packages/apps-config/src/api/specVersioned/acala.ts b/packages/apps-config/src/api/spec/acala.ts similarity index 100% rename from packages/apps-config/src/api/specVersioned/acala.ts rename to packages/apps-config/src/api/spec/acala.ts diff --git a/packages/apps-config/src/api/spec/ares-parachain.ts b/packages/apps-config/src/api/spec/ares-parachain.ts index 2e1241dbbfe4..6553b36bb078 100644 --- a/packages/apps-config/src/api/spec/ares-parachain.ts +++ b/packages/apps-config/src/api/spec/ares-parachain.ts @@ -1,10 +1,22 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/bifrost.ts b/packages/apps-config/src/api/spec/bifrost.ts index a373e4acd81b..b463ec1e8602 100644 --- a/packages/apps-config/src/api/spec/bifrost.ts +++ b/packages/apps-config/src/api/spec/bifrost.ts @@ -1,151 +1,165 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order /* eslint-disable sort-keys */ -export default { - Token: { symbol: 'Vec', precision: 'u16', totalSupply: 'u128' }, - VersionId: 'u32', - Action: { - account: 'AccountName', - name: 'ActionName', - authorization: 'Vec', - data: 'Vec' - }, - IostAction: { contract: 'Vec', action_name: 'Vec', data: 'Vec' }, - PermissionLevel: { actor: 'AccountName', permission: 'PermissionName' }, - PermissionName: 'u64', - ActionReceipt: { - receiver: 'AccountName', - act_digest: 'Checksum256', - global_sequence: 'u64', - recv_sequence: 'u64', - auth_sequence: 'FlatMap', - code_sequence: 'UnsignedInt', - abi_sequence: 'UnsignedInt' - }, - Checksum256: '([u8;32])', - BlockchainType: { _enum: ['BIFROST', 'EOS', 'IOST'] }, - Precision: 'u32', - BridgeAssetSymbol: { - blockchain: 'BlockchainType', - symbol: 'Vec', - precision: 'Precision' - }, - ProducerSchedule: { version: 'u32', producers: 'Vec' }, - ProducerKey: { producer_name: 'AccountName', block_signing_key: 'PublicKey' }, - AccountName: 'u64', - ActionName: 'u64', - PublicKey: { type_: 'UnsignedInt', data: '[u8;33]' }, - UnsignedInt: 'u32', - Signature: { type_: 'UnsignedInt', data: '[u8;65]' }, - SignedBlockHeader: { block_header: 'BlockHeader', producer_signature: 'Signature' }, - BlockHeader: { - timestamp: 'BlockTimestamp', - producer: 'AccountName', - confirmed: 'u16', - previous: 'Checksum256', - transaction_mroot: 'Checksum256', - action_mroot: 'Checksum256', - schedule_version: 'u32', - new_producers: 'Option', - header_extensions: 'Vec' - }, - BlockTimestamp: '(u32)', - Extension: '(u16, Vec)', - IncrementalMerkle: { _node_count: 'u64', _active_nodes: 'Checksum256Array' }, - Checksum256Array: 'Vec', - FlatMap: { map: 'Vec<(ActionName, u64)>' }, - TxSig: { signature: 'Vec', author: 'AccountId' }, - MultiSig: { signatures: 'Vec', threshold: 'u8' }, - MultiSigTx: { - chain_id: 'Vec', - raw_tx: 'Vec', - multi_sig: 'MultiSig', - action: 'Action', - from: 'AccountId', - token_symbol: 'TokenSymbol' - }, - Sent: { tx_id: 'Vec', from: 'AccountId', token_symbol: 'TokenSymbol' }, - Succeeded: { tx_id: 'Vec' }, - Failed: { tx_id: 'Vec', reason: 'Vec' }, - TxOut: { - _enum: { - Initialized: 'MultiSigTx', - Created: 'MultiSigTx', - SignComplete: 'MultiSigTx', - Sent: 'Sent', - Succeeded: 'Succeeded', - Failed: 'Failed' + +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Token: { symbol: 'Vec', precision: 'u16', totalSupply: 'u128' }, + VersionId: 'u32', + Action: { + account: 'AccountName', + name: 'ActionName', + authorization: 'Vec', + data: 'Vec' + }, + IostAction: { contract: 'Vec', action_name: 'Vec', data: 'Vec' }, + PermissionLevel: { actor: 'AccountName', permission: 'PermissionName' }, + PermissionName: 'u64', + ActionReceipt: { + receiver: 'AccountName', + act_digest: 'Checksum256', + global_sequence: 'u64', + recv_sequence: 'u64', + auth_sequence: 'FlatMap', + code_sequence: 'UnsignedInt', + abi_sequence: 'UnsignedInt' + }, + Checksum256: '([u8;32])', + BlockchainType: { _enum: ['BIFROST', 'EOS', 'IOST'] }, + Precision: 'u32', + BridgeAssetSymbol: { + blockchain: 'BlockchainType', + symbol: 'Vec', + precision: 'Precision' + }, + ProducerSchedule: { version: 'u32', producers: 'Vec' }, + ProducerKey: { producer_name: 'AccountName', block_signing_key: 'PublicKey' }, + AccountName: 'u64', + ActionName: 'u64', + PublicKey: { type_: 'UnsignedInt', data: '[u8;33]' }, + UnsignedInt: 'u32', + Signature: { type_: 'UnsignedInt', data: '[u8;65]' }, + SignedBlockHeader: { block_header: 'BlockHeader', producer_signature: 'Signature' }, + BlockHeader: { + timestamp: 'BlockTimestamp', + producer: 'AccountName', + confirmed: 'u16', + previous: 'Checksum256', + transaction_mroot: 'Checksum256', + action_mroot: 'Checksum256', + schedule_version: 'u32', + new_producers: 'Option', + header_extensions: 'Vec' + }, + BlockTimestamp: '(u32)', + Extension: '(u16, Vec)', + IncrementalMerkle: { _node_count: 'u64', _active_nodes: 'Checksum256Array' }, + Checksum256Array: 'Vec', + FlatMap: { map: 'Vec<(ActionName, u64)>' }, + TxSig: { signature: 'Vec', author: 'AccountId' }, + MultiSig: { signatures: 'Vec', threshold: 'u8' }, + MultiSigTx: { + chain_id: 'Vec', + raw_tx: 'Vec', + multi_sig: 'MultiSig', + action: 'Action', + from: 'AccountId', + token_symbol: 'TokenSymbol' + }, + Sent: { tx_id: 'Vec', from: 'AccountId', token_symbol: 'TokenSymbol' }, + Succeeded: { tx_id: 'Vec' }, + Failed: { tx_id: 'Vec', reason: 'Vec' }, + TxOut: { + _enum: { + Initialized: 'MultiSigTx', + Created: 'MultiSigTx', + SignComplete: 'MultiSigTx', + Sent: 'Sent', + Succeeded: 'Succeeded', + Failed: 'Failed' + } + }, + RewardRecord: { account_id: 'AccountId', record_amount: 'Balance' }, + ConvertPrice: 'u128', + RatePerBlock: 'u64', + Fee: 'u64', + PoolId: 'u32', + Nonce: 'u32', + PoolDetails: { owner: 'AccountId', swap_fee_rate: 'Fee', active: 'bool' }, + PoolCreateTokenDetails: { + token_id: 'TokenSymbol', + token_balance: 'Balance', + token_weight: 'PoolWeight' + }, + TokenPool: 'Balance', + VTokenPool: 'Balance', + InVariantPool: 'Balance', + TokenSymbol: { + _enum: [ + 'aUSD', 'DOT', + 'vDOT', 'KSM', + 'vKSM', 'EOS', + 'vEOS', 'IOST', + 'vIOST' + ] + }, + TransactionStatus: { + _enum: [ + 'Initialized', + 'Created', + 'SignComplete', + 'Sent', + 'Succeeded', + 'Failed' + ] + }, + Cost: 'u128', + Income: 'u128', + Price: 'u64', + AccountAsset: { + balance: 'Balance', + locked: 'Balance', + available: 'Balance', + cost: 'Cost', + income: 'Income' + }, + SpecIndex: 'u32', + RequestIdentifier: 'u64', + DataVersion: 'u64', + ConvertPool: { + token_pool: 'Balance', + vtoken_pool: 'Balance', + current_reward: 'Balance', + pending_reward: 'Balance' + }, + ProducerAuthoritySchedule: { version: 'u32', producers: 'Vec' }, + ProducerAuthority: { producer_name: 'ActionName', authority: 'BlockSigningAuthority' }, + BlockSigningAuthority: '(UnsignedInt, BlockSigningAuthorityV0)', + BlockSigningAuthorityV0: { threshold: 'u32', keys: 'Vec' }, + KeyWeight: { key: 'PublicKey', weight: 'u16' }, + InvariantValue: 'Balance', + PoolWeight: 'Balance', + AssetConfig: { redeem_duration: 'BlockNumber', min_reward_per_block: 'Balance' }, + ProxyValidatorRegister: { + last_block: 'BlockNumber', + deposit: 'Balance', + need: 'Balance', + staking: 'Balance', + reward_per_block: 'Balance', + validator_address: 'Vec' + }, + BlockNumber: 'u32' + } } - }, - RewardRecord: { account_id: 'AccountId', record_amount: 'Balance' }, - ConvertPrice: 'u128', - RatePerBlock: 'u64', - Fee: 'u64', - PoolId: 'u32', - Nonce: 'u32', - PoolDetails: { owner: 'AccountId', swap_fee_rate: 'Fee', active: 'bool' }, - PoolCreateTokenDetails: { - token_id: 'TokenSymbol', - token_balance: 'Balance', - token_weight: 'PoolWeight' - }, - TokenPool: 'Balance', - VTokenPool: 'Balance', - InVariantPool: 'Balance', - TokenSymbol: { - _enum: [ - 'aUSD', 'DOT', - 'vDOT', 'KSM', - 'vKSM', 'EOS', - 'vEOS', 'IOST', - 'vIOST' - ] - }, - TransactionStatus: { - _enum: [ - 'Initialized', - 'Created', - 'SignComplete', - 'Sent', - 'Succeeded', - 'Failed' - ] - }, - Cost: 'u128', - Income: 'u128', - Price: 'u64', - AccountAsset: { - balance: 'Balance', - locked: 'Balance', - available: 'Balance', - cost: 'Cost', - income: 'Income' - }, - SpecIndex: 'u32', - RequestIdentifier: 'u64', - DataVersion: 'u64', - ConvertPool: { - token_pool: 'Balance', - vtoken_pool: 'Balance', - current_reward: 'Balance', - pending_reward: 'Balance' - }, - ProducerAuthoritySchedule: { version: 'u32', producers: 'Vec' }, - ProducerAuthority: { producer_name: 'ActionName', authority: 'BlockSigningAuthority' }, - BlockSigningAuthority: '(UnsignedInt, BlockSigningAuthorityV0)', - BlockSigningAuthorityV0: { threshold: 'u32', keys: 'Vec' }, - KeyWeight: { key: 'PublicKey', weight: 'u16' }, - InvariantValue: 'Balance', - PoolWeight: 'Balance', - AssetConfig: { redeem_duration: 'BlockNumber', min_reward_per_block: 'Balance' }, - ProxyValidatorRegister: { - last_block: 'BlockNumber', - deposit: 'Balance', - need: 'Balance', - staking: 'Balance', - reward_per_block: 'Balance', - validator_address: 'Vec' - }, - BlockNumber: 'u32' + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/bitcountry.ts b/packages/apps-config/src/api/spec/bitcountry.ts index c4afe8d4b331..3c4f85f69e65 100644 --- a/packages/apps-config/src/api/spec/bitcountry.ts +++ b/packages/apps-config/src/api/spec/bitcountry.ts @@ -1,48 +1,62 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'MultiAddress', - LookupSource: 'MultiAddress', - Balance: 'u128', - AssetId: 'u64', - BlockNumber: 'u32', - AssetInfo: { - owner: 'AccountId', - data: 'AssetData' - }, - AssetData: { - name: 'Vec', - description: 'Vec', - properties: 'Vec', - supporters: 'Vec' - }, - AuctionId: 'u64', - AuctionItem: { - asset_id: 'AssetId', - recipient: 'AccountId', - initial_amount: 'Balance', - amount: 'Balance', - start_time: 'u32', - ed_time: 'u32' - }, - AuctionInfo: { - bid: 'Option<(AccountId,Balance)>', - start: 'BlockNumber', - end: 'Option' - }, - RentId: 'u64 ', - RentalInfo: { - owner: 'AccountId', - start: 'BlockNumber', - end: 'Option', - price_per_block: 'Balance' - }, - CountryId: 'u64', - CollectionId: 'u64', - CurrencyId: 'u32', - TokenId: 'u64', - CurrencyIdOf: 'CurrencyId', - BalanceIdOf: 'Balance' + +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'MultiAddress', + LookupSource: 'MultiAddress', + Balance: 'u128', + AssetId: 'u64', + BlockNumber: 'u32', + AssetInfo: { + owner: 'AccountId', + data: 'AssetData' + }, + AssetData: { + name: 'Vec', + description: 'Vec', + properties: 'Vec', + supporters: 'Vec' + }, + AuctionId: 'u64', + AuctionItem: { + asset_id: 'AssetId', + recipient: 'AccountId', + initial_amount: 'Balance', + amount: 'Balance', + start_time: 'u32', + ed_time: 'u32' + }, + AuctionInfo: { + bid: 'Option<(AccountId,Balance)>', + start: 'BlockNumber', + end: 'Option' + }, + RentId: 'u64 ', + RentalInfo: { + owner: 'AccountId', + start: 'BlockNumber', + end: 'Option', + price_per_block: 'Balance' + }, + CountryId: 'u64', + CollectionId: 'u64', + CurrencyId: 'u32', + TokenId: 'u64', + CurrencyIdOf: 'CurrencyId', + BalanceIdOf: 'Balance' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/canvas.ts b/packages/apps-config/src/api/spec/canvas.ts index 348f2411a50d..a40649803e98 100644 --- a/packages/apps-config/src/api/spec/canvas.ts +++ b/packages/apps-config/src/api/spec/canvas.ts @@ -1,11 +1,23 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId', - Schedule: 'ScheduleTo258' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId', + Schedule: 'ScheduleTo258' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/centrifuge-chain.ts b/packages/apps-config/src/api/spec/centrifuge-chain.ts index 3c409717890f..6ffd2aed9fd1 100644 --- a/packages/apps-config/src/api/spec/centrifuge-chain.ts +++ b/packages/apps-config/src/api/spec/centrifuge-chain.ts @@ -1,64 +1,75 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - // chain-specific - AnchorData: { - id: 'H256', - docRoot: 'H256', - anchoredBlock: 'u64' - }, - Fee: { - key: 'Hash', - price: 'Balance' - }, - PreCommitData: { - signingRoot: 'H256', - identity: 'H256', - expirationBlock: 'u64' - }, - Proof: { - leafHash: 'H256', - sortedHashes: 'H256' - }, - // MultiAccount - MultiAccountData: { - threshold: 'u16', - signatories: 'Vec', - deposit: 'Balance', - depositor: 'AccountId' - }, - // Bridge constants - ChainId: 'u8', - ResourceId: '[u8; 32]', - 'chainbridge::ChainId': 'u8', - DepositNonce: 'u64', - // NFT - RegistryId: 'H160', - TokenId: 'U256', - AssetId: { - registryId: 'RegistryId', - tokenId: 'TokenId' - }, - RegistryInfo: { - ownerCanBurn: 'bool', - fields: 'Vec' - }, - AssetInfo: { - metadata: 'Bytes' - }, - ProofMint: { - value: 'Bytes', - property: 'Bytes', - salt: '[u8; 32]', - hashes: 'Vec' - }, - MintInfo: { - anchorId: 'Hash', - staticHashes: '[Hash; 3]', - proofs: 'Vec' - } +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + AnchorData: { + id: 'H256', + docRoot: 'H256', + anchoredBlock: 'u64' + }, + Fee: { + key: 'Hash', + price: 'Balance' + }, + PreCommitData: { + signingRoot: 'H256', + identity: 'H256', + expirationBlock: 'u64' + }, + Proof: { + leafHash: 'H256', + sortedHashes: 'H256' + }, + // MultiAccount + MultiAccountData: { + threshold: 'u16', + signatories: 'Vec', + deposit: 'Balance', + depositor: 'AccountId' + }, + // Bridge constants + ChainId: 'u8', + ResourceId: '[u8; 32]', + 'chainbridge::ChainId': 'u8', + DepositNonce: 'u64', + // NFT + RegistryId: 'H160', + TokenId: 'U256', + AssetId: { + registryId: 'RegistryId', + tokenId: 'TokenId' + }, + RegistryInfo: { + ownerCanBurn: 'bool', + fields: 'Vec' + }, + AssetInfo: { + metadata: 'Bytes' + }, + ProofMint: { + value: 'Bytes', + property: 'Bytes', + salt: '[u8; 32]', + hashes: 'Vec' + }, + MintInfo: { + anchorId: 'Hash', + staticHashes: '[Hash; 3]', + proofs: 'Vec' + } + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/chainx.ts b/packages/apps-config/src/api/spec/chainx.ts index 75f557cf8b69..7c5c1a056ee5 100644 --- a/packages/apps-config/src/api/spec/chainx.ts +++ b/packages/apps-config/src/api/spec/chainx.ts @@ -1,450 +1,462 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId', - Chain: { - _enum: [ - 'ChainX', - 'Bitcoin', - 'Ethereum', - 'Polkadot' - ] - }, - NetworkType: { - _enum: [ - 'Mainnet', - 'Testnet' - ] - }, - AssetType: { - _enum: [ - 'Usable', - 'Locked', - 'Reserved', - 'ReservedWithdrawal', - 'ReservedDexSpot' - ] - }, - OrderType: { - _enum: [ - 'Limit', - 'Market' - ] - }, - Side: { - _enum: [ - 'Buy', - 'Sell' - ] - }, - LockedType: { - _enum: [ - 'Bonded', - 'BondedWithdrawal' - ] - }, - Memo: 'Text', - AssetInfo: { - token: 'String', - tokenName: 'String', - chain: 'Chain', - decimals: 'Decimals', - desc: 'String' - }, - TradingPairProfile: { - id: 'TradingPairId', - currencyPair: 'CurrencyPair', - pipDecimals: 'u32', - tickDecimals: 'u32', - tradable: 'bool' - }, - Order: { - props: 'OrderProperty', - status: 'OrderStatus', - remaining: 'Balance', - executedIndices: 'Vec', - alreadyFilled: 'Balance', - lastUpdateAt: 'BlockNumber' - }, - TradingPairInfo: { - latestPrice: 'Price', - lastUpdated: 'BlockNumber' - }, - OrderExecutedInfo: { - tradingHistoryIdx: 'TradingHistoryIndex', - pairId: 'TradingPairId', - price: 'Price', - maker: 'AccountId', - taker: 'AccountId', - makerOrderId: 'OrderId', - takerOrderId: 'OrderId', - turnover: 'Balance', - executedAt: 'BlockNumber' - }, - BtcHeaderInfo: { - header: 'BtcHeader', - height: 'u32' - }, - BtcParams: { - maxBits: 'u32', - blockMaxFuture: 'u32', - targetTimespanSeconds: 'u32', - targetSpacingSeconds: 'u32', - retargetingFactor: 'u32', - retargetingInterval: 'u32', - minTimespan: 'u32', - maxTimespan: 'u32' - }, - MiningAssetInfo: { - assetId: 'AssetId', - miningPower: 'FixedAssetPower', - rewardPot: 'AccountId', - rewardPotBalance: 'RpcBalance', - lastTotalMiningWeight: 'RpcMiningWeight', - lastTotalMiningWeightUpdate: 'BlockNumber' - }, - MiningDividendInfo: { - own: 'Balance', - other: 'Balance', - insufficientStake: 'Balance' - }, - AssetLedger: { - lastTotalMiningWeight: 'MiningWeight', - lastTotalMiningWeightUpdate: 'BlockNumber' - }, - MinerLedger: { - lastMiningWeight: 'MiningWeight', - lastMiningWeightUpdate: 'BlockNumber', - lastClaim: 'Option' - }, - ClaimRestriction: { - stakingRequirement: 'StakingRequirement', - frequencyLimit: 'BlockNumber' - }, - NominatorInfo: { - lastRebond: 'Option' - }, - BondRequirement: { - selfBonded: 'Balance', - total: 'Balance' - }, - Unbonded: { - value: 'Balance', - lockedUntil: 'BlockNumber' - }, - ValidatorLedger: { - totalNomination: 'Balance', - lastTotalVoteWeight: 'VoteWeight', - lastTotalVoteWeightUpdate: 'BlockNumber' - }, - NominatorLedger: { - nomination: 'Balance', - lastVoteWeight: 'VoteWeight', - lastVoteWeightUpdate: 'BlockNumber', - unbondedChunks: 'Vec' - }, - ValidatorProfile: { - registeredAt: 'BlockNumber', - isChilled: 'bool', - lastChilled: 'Option', - referralId: 'ReferralId' - }, - GlobalDistribution: { - treasury: 'u32', - mining: 'u32' - }, - MiningDistribution: { - asset: 'u32', - staking: 'u32' - }, - InclusionFee: { - baseFee: 'Balance', - lenFee: 'Balance', - adjustedWeightFee: 'Balance' - }, - FeeDetails: { - inclusionFee: 'Option>', - extraFee: 'Balance', - tip: 'Balance', - finalFee: 'Balance' - }, - UnbondedIndex: 'u32', - Token: 'Text', - Desc: 'Text', - AddrStr: 'Text', - HandicapInfo: 'Handicap', - Price: 'u128', - OrderId: 'u64', - TradingPairId: 'u32', - TradingHistoryIndex: 'u64', - PriceFluctuation: 'u32', - BtcAddress: 'Text', - FixedAssetPower: 'u32', - StakingRequirement: 'u32', - Decimals: 'u8', - CurrencyPair: { - base: 'AssetId', - quote: 'AssetId' - }, - OrderStatus: { - _enum: [ - 'Created', - 'PartialFill', - 'Filled', - 'PartialFillAndCanceled', - 'Canceled' - ] - }, - AssetId: 'u32', - MiningWeight: 'u128', - VoteWeight: 'u128', - ReferralId: 'Text', - AssetRestriction: { - _enum: [ - 'Move', - 'Transfer', - 'Deposit', - 'Withdraw', - 'DestroyWithdrawal', - 'DestroyFree' - ] - }, - AssetRestrictions: { - bits: 'u32' - }, - BtcHeader: 'Vec', - BtcNetwork: { - _enum: [ - 'Mainnet', - 'Testnet' - ] - }, - OrderInfo: 'Order', - Amount: 'i128', - AmountOf: 'Amount', - CurrencyIdOf: 'AssetId', - CurrencyId: 'AssetId', - Handicap: { - highestBid: 'Price', - lowestAsk: 'Price' - }, - OrderProperty: { - id: 'OrderId', - side: 'Side', - price: 'Price', - amount: 'Amount', - pairId: 'TradingPairId', - submitter: 'AccountId', - orderType: 'OrderType', - createdAt: 'BlockNumber' - }, - TotalAssetInfo: { - info: 'AssetInfo', - balance: 'BTreeMap', - isOnline: 'bool', - restrictions: 'AssetRestrictions' - }, - WithdrawalRecordId: 'u32', - WithdrawalState: { - _enum: [ - 'Applying', - 'Processing', - 'NormalFinish', - 'RootFinish', - 'NormalCancel', - 'RootCancel' - ] - }, - WithdrawalRecord: { - assetId: 'AssetId', - applicant: 'AccountId', - balance: 'Balance', - addr: 'AddrStr', - ext: 'Memo', - height: 'BlockNumber' - }, - WithdrawalLimit: { - minimalWithdrawal: 'Balance', - fee: 'Balance' - }, - TrusteeInfoConfig: { - minTrusteeCount: 'u32', - maxTrusteeCount: 'u32' - }, - GenericTrusteeIntentionProps: { - about: 'Text', - hotEntity: 'Vec', - coldEntity: 'Vec' - }, - GenericTrusteeSessionInfo: { - trusteeList: 'Vec', - threshold: 'u16', - hotAddress: 'Vec', - coldAddress: 'Vec' - }, - ChainAddress: 'Vec', - BtcTrusteeType: 'Vec', - BtcTrusteeAddrInfo: { - addr: 'BtcAddress', - redeemScript: 'Vec' - }, - BtcTrusteeIntentionProps: { - about: 'Text', - hotEntity: 'BtcTrusteeType', - coldEntity: 'BtcTrusteeType' - }, - BtcTrusteeSessionInfo: { - trusteeList: 'Vec', - threshold: 'u16', - hotAddress: 'BtcTrusteeAddrInfo', - coldAddress: 'BtcTrusteeAddrInfo' - }, - BtcTransaction: 'Vec', - BtcPartialMerkleTree: 'Vec', - BtcRelayedTxInfo: { - blockHash: 'H256', - merkleProof: 'BtcPartialMerkleTree' - }, - BtcHeaderIndex: { - hash: 'H256', - height: 'u32' - }, - BtcTxResult: { - _enum: [ - 'Success', - 'Failure' - ] - }, - BtcTxState: { - txType: 'BtcTxType', - result: 'BtcTxResult' - }, - BtcTxType: { - _enum: [ - 'Withdrawal', - 'Deposit', - 'HotAndCold', - 'TrusteeTransition', - 'Irrelevance' - ] - }, - BtcDepositCache: { - txid: 'H256', - balance: 'u64' - }, - BtcVoteResult: { - _enum: [ - 'Unfinish', - 'Finish' - ] - }, - BtcWithdrawalProposal: { - sigState: 'BtcVoteResult', - withdrawalIdList: 'Vec', - tx: 'BtcTransaction', - trusteeList: 'Vec<(AccountId, bool)>' - }, - BtcTxVerifier: { - _enum: [ - 'Recover', - 'RuntimeInterface' - ] - }, - RpcTotalAssetInfo: { - info: 'AssetInfo', - balance: 'BTreeMap', - isOnline: 'bool', - restrictions: 'AssetRestrictions' - }, - RpcOrder: { - id: 'OrderId', - side: 'Side', - price: 'RpcPrice', - amount: 'RpcBalance', - pairId: 'TradingPairId', - submitter: 'AccountId', - orderType: 'OrderType', - createdAt: 'BlockNumber', - status: 'OrderStatus', - remaining: 'RpcBalance', - executedIndices: 'Vec', - alreadyFilled: 'RpcBalance', - reservedBalance: 'RpcBalance', - lastUpdateAt: 'BlockNumber' - }, - RpcWithdrawalRecord: { - assetId: 'AssetId', - applicant: 'AccountId', - balance: 'RpcBalance', - addr: 'String', - ext: 'String', - height: 'BlockNumber', - state: 'WithdrawalState' - }, - RpcMiningDividendInfo: { - own: 'RpcBalance', - other: 'RpcBalance', - insufficientStake: 'RpcBalance' - }, - RpcInclusionFee: { - baseFee: 'RpcBalance', - lenFee: 'RpcBalance', - adjustedWeightFee: 'RpcBalance' - }, - RpcFeeDetails: { - inclusionFee: 'Option', - tip: 'RpcBalance', - extraFee: 'RpcBalance', - finalFee: 'RpcBalance' - }, - ValidatorInfo: { - account: 'AccountId', - registeredAt: 'BlockNumber', - isChilled: 'bool', - lastChilled: 'Option', - totalNomination: 'RpcBalance', - lastTotalVoteWeight: 'RpcVoteWeight', - lastTotalVoteWeightUpdate: 'BlockNumber', - isValidating: 'bool', - selfBonded: 'RpcBalance', - referralId: 'String', - rewardPotAccount: 'AccountId', - rewardPotBalance: 'RpcBalance' - }, - FullPairInfo: { - baseCurrency: 'AssetId', - highestBid: 'RpcPrice', - id: 'TradingPairId', - latestPrice: 'RpcPrice', - latestPriceUpdatedAt: 'BlockNumber', - lowestAsk: 'RpcPrice', - maxValidBid: 'RpcPrice', - minValidAsk: 'RpcPrice', - pipDecimals: 'u32', - quoteCurrency: 'AssetId', - tickDecimals: 'u32', - tradable: 'bool' - }, - Depth: { - asks: 'Vec<(RpcPrice, RpcBalance)>', - bids: 'Vec<(RpcPrice, RpcBalance)>' - }, - Page: { - pageIndex: 'u32', - pageSize: 'u32', - data: 'Vec' - }, - String: 'Text', - Balance: 'u128', - RpcPrice: 'String', - RpcBalance: 'String', - RpcMiningWeight: 'String', - RpcVoteWeight: 'String', - FullIdentification: 'ValidatorId', - WithdrawalRecordOf: 'WithdrawalRecord' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId', + Chain: { + _enum: [ + 'ChainX', + 'Bitcoin', + 'Ethereum', + 'Polkadot' + ] + }, + NetworkType: { + _enum: [ + 'Mainnet', + 'Testnet' + ] + }, + AssetType: { + _enum: [ + 'Usable', + 'Locked', + 'Reserved', + 'ReservedWithdrawal', + 'ReservedDexSpot' + ] + }, + OrderType: { + _enum: [ + 'Limit', + 'Market' + ] + }, + Side: { + _enum: [ + 'Buy', + 'Sell' + ] + }, + LockedType: { + _enum: [ + 'Bonded', + 'BondedWithdrawal' + ] + }, + Memo: 'Text', + AssetInfo: { + token: 'String', + tokenName: 'String', + chain: 'Chain', + decimals: 'Decimals', + desc: 'String' + }, + TradingPairProfile: { + id: 'TradingPairId', + currencyPair: 'CurrencyPair', + pipDecimals: 'u32', + tickDecimals: 'u32', + tradable: 'bool' + }, + Order: { + props: 'OrderProperty', + status: 'OrderStatus', + remaining: 'Balance', + executedIndices: 'Vec', + alreadyFilled: 'Balance', + lastUpdateAt: 'BlockNumber' + }, + TradingPairInfo: { + latestPrice: 'Price', + lastUpdated: 'BlockNumber' + }, + OrderExecutedInfo: { + tradingHistoryIdx: 'TradingHistoryIndex', + pairId: 'TradingPairId', + price: 'Price', + maker: 'AccountId', + taker: 'AccountId', + makerOrderId: 'OrderId', + takerOrderId: 'OrderId', + turnover: 'Balance', + executedAt: 'BlockNumber' + }, + BtcHeaderInfo: { + header: 'BtcHeader', + height: 'u32' + }, + BtcParams: { + maxBits: 'u32', + blockMaxFuture: 'u32', + targetTimespanSeconds: 'u32', + targetSpacingSeconds: 'u32', + retargetingFactor: 'u32', + retargetingInterval: 'u32', + minTimespan: 'u32', + maxTimespan: 'u32' + }, + MiningAssetInfo: { + assetId: 'AssetId', + miningPower: 'FixedAssetPower', + rewardPot: 'AccountId', + rewardPotBalance: 'RpcBalance', + lastTotalMiningWeight: 'RpcMiningWeight', + lastTotalMiningWeightUpdate: 'BlockNumber' + }, + MiningDividendInfo: { + own: 'Balance', + other: 'Balance', + insufficientStake: 'Balance' + }, + AssetLedger: { + lastTotalMiningWeight: 'MiningWeight', + lastTotalMiningWeightUpdate: 'BlockNumber' + }, + MinerLedger: { + lastMiningWeight: 'MiningWeight', + lastMiningWeightUpdate: 'BlockNumber', + lastClaim: 'Option' + }, + ClaimRestriction: { + stakingRequirement: 'StakingRequirement', + frequencyLimit: 'BlockNumber' + }, + NominatorInfo: { + lastRebond: 'Option' + }, + BondRequirement: { + selfBonded: 'Balance', + total: 'Balance' + }, + Unbonded: { + value: 'Balance', + lockedUntil: 'BlockNumber' + }, + ValidatorLedger: { + totalNomination: 'Balance', + lastTotalVoteWeight: 'VoteWeight', + lastTotalVoteWeightUpdate: 'BlockNumber' + }, + NominatorLedger: { + nomination: 'Balance', + lastVoteWeight: 'VoteWeight', + lastVoteWeightUpdate: 'BlockNumber', + unbondedChunks: 'Vec' + }, + ValidatorProfile: { + registeredAt: 'BlockNumber', + isChilled: 'bool', + lastChilled: 'Option', + referralId: 'ReferralId' + }, + GlobalDistribution: { + treasury: 'u32', + mining: 'u32' + }, + MiningDistribution: { + asset: 'u32', + staking: 'u32' + }, + InclusionFee: { + baseFee: 'Balance', + lenFee: 'Balance', + adjustedWeightFee: 'Balance' + }, + FeeDetails: { + inclusionFee: 'Option>', + extraFee: 'Balance', + tip: 'Balance', + finalFee: 'Balance' + }, + UnbondedIndex: 'u32', + Token: 'Text', + Desc: 'Text', + AddrStr: 'Text', + HandicapInfo: 'Handicap', + Price: 'u128', + OrderId: 'u64', + TradingPairId: 'u32', + TradingHistoryIndex: 'u64', + PriceFluctuation: 'u32', + BtcAddress: 'Text', + FixedAssetPower: 'u32', + StakingRequirement: 'u32', + Decimals: 'u8', + CurrencyPair: { + base: 'AssetId', + quote: 'AssetId' + }, + OrderStatus: { + _enum: [ + 'Created', + 'PartialFill', + 'Filled', + 'PartialFillAndCanceled', + 'Canceled' + ] + }, + AssetId: 'u32', + MiningWeight: 'u128', + VoteWeight: 'u128', + ReferralId: 'Text', + AssetRestriction: { + _enum: [ + 'Move', + 'Transfer', + 'Deposit', + 'Withdraw', + 'DestroyWithdrawal', + 'DestroyFree' + ] + }, + AssetRestrictions: { + bits: 'u32' + }, + BtcHeader: 'Vec', + BtcNetwork: { + _enum: [ + 'Mainnet', + 'Testnet' + ] + }, + OrderInfo: 'Order', + Amount: 'i128', + AmountOf: 'Amount', + CurrencyIdOf: 'AssetId', + CurrencyId: 'AssetId', + Handicap: { + highestBid: 'Price', + lowestAsk: 'Price' + }, + OrderProperty: { + id: 'OrderId', + side: 'Side', + price: 'Price', + amount: 'Amount', + pairId: 'TradingPairId', + submitter: 'AccountId', + orderType: 'OrderType', + createdAt: 'BlockNumber' + }, + TotalAssetInfo: { + info: 'AssetInfo', + balance: 'BTreeMap', + isOnline: 'bool', + restrictions: 'AssetRestrictions' + }, + WithdrawalRecordId: 'u32', + WithdrawalState: { + _enum: [ + 'Applying', + 'Processing', + 'NormalFinish', + 'RootFinish', + 'NormalCancel', + 'RootCancel' + ] + }, + WithdrawalRecord: { + assetId: 'AssetId', + applicant: 'AccountId', + balance: 'Balance', + addr: 'AddrStr', + ext: 'Memo', + height: 'BlockNumber' + }, + WithdrawalLimit: { + minimalWithdrawal: 'Balance', + fee: 'Balance' + }, + TrusteeInfoConfig: { + minTrusteeCount: 'u32', + maxTrusteeCount: 'u32' + }, + GenericTrusteeIntentionProps: { + about: 'Text', + hotEntity: 'Vec', + coldEntity: 'Vec' + }, + GenericTrusteeSessionInfo: { + trusteeList: 'Vec', + threshold: 'u16', + hotAddress: 'Vec', + coldAddress: 'Vec' + }, + ChainAddress: 'Vec', + BtcTrusteeType: 'Vec', + BtcTrusteeAddrInfo: { + addr: 'BtcAddress', + redeemScript: 'Vec' + }, + BtcTrusteeIntentionProps: { + about: 'Text', + hotEntity: 'BtcTrusteeType', + coldEntity: 'BtcTrusteeType' + }, + BtcTrusteeSessionInfo: { + trusteeList: 'Vec', + threshold: 'u16', + hotAddress: 'BtcTrusteeAddrInfo', + coldAddress: 'BtcTrusteeAddrInfo' + }, + BtcTransaction: 'Vec', + BtcPartialMerkleTree: 'Vec', + BtcRelayedTxInfo: { + blockHash: 'H256', + merkleProof: 'BtcPartialMerkleTree' + }, + BtcHeaderIndex: { + hash: 'H256', + height: 'u32' + }, + BtcTxResult: { + _enum: [ + 'Success', + 'Failure' + ] + }, + BtcTxState: { + txType: 'BtcTxType', + result: 'BtcTxResult' + }, + BtcTxType: { + _enum: [ + 'Withdrawal', + 'Deposit', + 'HotAndCold', + 'TrusteeTransition', + 'Irrelevance' + ] + }, + BtcDepositCache: { + txid: 'H256', + balance: 'u64' + }, + BtcVoteResult: { + _enum: [ + 'Unfinish', + 'Finish' + ] + }, + BtcWithdrawalProposal: { + sigState: 'BtcVoteResult', + withdrawalIdList: 'Vec', + tx: 'BtcTransaction', + trusteeList: 'Vec<(AccountId, bool)>' + }, + BtcTxVerifier: { + _enum: [ + 'Recover', + 'RuntimeInterface' + ] + }, + RpcTotalAssetInfo: { + info: 'AssetInfo', + balance: 'BTreeMap', + isOnline: 'bool', + restrictions: 'AssetRestrictions' + }, + RpcOrder: { + id: 'OrderId', + side: 'Side', + price: 'RpcPrice', + amount: 'RpcBalance', + pairId: 'TradingPairId', + submitter: 'AccountId', + orderType: 'OrderType', + createdAt: 'BlockNumber', + status: 'OrderStatus', + remaining: 'RpcBalance', + executedIndices: 'Vec', + alreadyFilled: 'RpcBalance', + reservedBalance: 'RpcBalance', + lastUpdateAt: 'BlockNumber' + }, + RpcWithdrawalRecord: { + assetId: 'AssetId', + applicant: 'AccountId', + balance: 'RpcBalance', + addr: 'String', + ext: 'String', + height: 'BlockNumber', + state: 'WithdrawalState' + }, + RpcMiningDividendInfo: { + own: 'RpcBalance', + other: 'RpcBalance', + insufficientStake: 'RpcBalance' + }, + RpcInclusionFee: { + baseFee: 'RpcBalance', + lenFee: 'RpcBalance', + adjustedWeightFee: 'RpcBalance' + }, + RpcFeeDetails: { + inclusionFee: 'Option', + tip: 'RpcBalance', + extraFee: 'RpcBalance', + finalFee: 'RpcBalance' + }, + ValidatorInfo: { + account: 'AccountId', + registeredAt: 'BlockNumber', + isChilled: 'bool', + lastChilled: 'Option', + totalNomination: 'RpcBalance', + lastTotalVoteWeight: 'RpcVoteWeight', + lastTotalVoteWeightUpdate: 'BlockNumber', + isValidating: 'bool', + selfBonded: 'RpcBalance', + referralId: 'String', + rewardPotAccount: 'AccountId', + rewardPotBalance: 'RpcBalance' + }, + FullPairInfo: { + baseCurrency: 'AssetId', + highestBid: 'RpcPrice', + id: 'TradingPairId', + latestPrice: 'RpcPrice', + latestPriceUpdatedAt: 'BlockNumber', + lowestAsk: 'RpcPrice', + maxValidBid: 'RpcPrice', + minValidAsk: 'RpcPrice', + pipDecimals: 'u32', + quoteCurrency: 'AssetId', + tickDecimals: 'u32', + tradable: 'bool' + }, + Depth: { + asks: 'Vec<(RpcPrice, RpcBalance)>', + bids: 'Vec<(RpcPrice, RpcBalance)>' + }, + Page: { + pageIndex: 'u32', + pageSize: 'u32', + data: 'Vec' + }, + String: 'Text', + Balance: 'u128', + RpcPrice: 'String', + RpcBalance: 'String', + RpcMiningWeight: 'String', + RpcVoteWeight: 'String', + FullIdentification: 'ValidatorId', + WithdrawalRecordOf: 'WithdrawalRecord' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/clover-rococo.ts b/packages/apps-config/src/api/spec/clover-rococo.ts index 04418ef71d99..82fae7bcc9ac 100644 --- a/packages/apps-config/src/api/spec/clover-rococo.ts +++ b/packages/apps-config/src/api/spec/clover-rococo.ts @@ -1,64 +1,74 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -// types for clover +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order /* eslint-disable sort-keys */ -const cloverRococoTypes = { - Amount: 'i128', - AmountOf: 'Amount', - Balance: 'u128', - CurrencyId: { - _enum: ['CLV', 'CUSDT', 'DOT', 'CETH'] - }, - CurrencyIdOf: 'CurrencyId', - CurrencyTypeEnum: { - _enum: ['CLV', 'CUSDT', 'DOT', 'CETH'] - }, - PairKey: 'u64', - Rate: 'FixedU128', - Ratio: 'FixedU128', - Price: 'FixedU128', - Share: 'u128', - OracleKey: 'CurrencyId', - CurrencyInfo: { - id: 'CurrencyId', - name: 'CurrencyTypeEnum' - }, - ExchangeInfo: { - balance: 'Balance', - routes: 'Vec' - }, - PoolId: { - _enum: { - Swap: 'u64' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Amount: 'i128', + AmountOf: 'Amount', + Balance: 'u128', + CurrencyId: { + _enum: ['CLV', 'CUSDT', 'DOT', 'CETH'] + }, + CurrencyIdOf: 'CurrencyId', + CurrencyTypeEnum: { + _enum: ['CLV', 'CUSDT', 'DOT', 'CETH'] + }, + PairKey: 'u64', + Rate: 'FixedU128', + Ratio: 'FixedU128', + Price: 'FixedU128', + Share: 'u128', + OracleKey: 'CurrencyId', + CurrencyInfo: { + id: 'CurrencyId', + name: 'CurrencyTypeEnum' + }, + ExchangeInfo: { + balance: 'Balance', + routes: 'Vec' + }, + PoolId: { + _enum: { + Swap: 'u64' + } + }, + EcdsaSignature: '[u8; 65]', + EvmAddress: 'H160', + ExitSucceed: { + _enum: ['Stopped', 'Returned', 'Suicided'] + }, + ExitRevert: { + _enum: ['Reverted'] + }, + ExitError: { + _enum: [ + 'StackUnderflow', 'StackOverflow', 'InvalidJump', 'InvalidRange', 'DesignatedInvalid', 'CallTooDeep', + 'CreateCollision', 'CreateContractLimit', 'OutOfOffset', 'OutOfGas', 'OutOfFund', 'PCUnderflow', 'CreateEmpty', + 'Other' + ] + }, + ExitFatal: { + _enum: ['NotSupported', 'UnhandledInterrupt', 'CallErrorAsFatal', 'Other'] + }, + ExitReason: { + _enum: ['Succeed', + 'Error', + 'Revert', + 'Fatal' + ] + } + } } - }, - EcdsaSignature: '[u8; 65]', - EvmAddress: 'H160', - ExitSucceed: { - _enum: ['Stopped', 'Returned', 'Suicided'] - }, - ExitRevert: { - _enum: ['Reverted'] - }, - ExitError: { - _enum: [ - 'StackUnderflow', 'StackOverflow', 'InvalidJump', 'InvalidRange', 'DesignatedInvalid', 'CallTooDeep', - 'CreateCollision', 'CreateContractLimit', 'OutOfOffset', 'OutOfGas', 'OutOfFund', 'PCUnderflow', 'CreateEmpty', - 'Other' - ] - }, - ExitFatal: { - _enum: ['NotSupported', 'UnhandledInterrupt', 'CallErrorAsFatal', 'Other'] - }, - ExitReason: { - _enum: ['Succeed', - 'Error', - 'Revert', - 'Fatal' - ] - } + ] }; -export default cloverRococoTypes; +export default definitions; diff --git a/packages/apps-config/src/api/spec/clover.ts b/packages/apps-config/src/api/spec/clover.ts index 31d2db10a6f3..1fcec6eba9a3 100644 --- a/packages/apps-config/src/api/spec/clover.ts +++ b/packages/apps-config/src/api/spec/clover.ts @@ -1,65 +1,75 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -// types for clover +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order /* eslint-disable sort-keys */ -const cloverTypes = { - Amount: 'i128', - Keys: 'SessionKeys3', - AmountOf: 'Amount', - Balance: 'u128', - CurrencyId: { - _enum: ['CLV', 'CUSDT', 'DOT', 'CETH'] - }, - CurrencyIdOf: 'CurrencyId', - CurrencyTypeEnum: { - _enum: ['CLV', 'CUSDT', 'DOT', 'CETH'] - }, - PairKey: 'u64', - Rate: 'FixedU128', - Ratio: 'FixedU128', - Price: 'FixedU128', - Share: 'u128', - OracleKey: 'CurrencyId', - CurrencyInfo: { - id: 'CurrencyId', - name: 'CurrencyTypeEnum' - }, - ExchangeInfo: { - balance: 'Balance', - routes: 'Vec' - }, - PoolId: { - _enum: { - Swap: 'u64' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Amount: 'i128', + Keys: 'SessionKeys3', + AmountOf: 'Amount', + Balance: 'u128', + CurrencyId: { + _enum: ['CLV', 'CUSDT', 'DOT', 'CETH'] + }, + CurrencyIdOf: 'CurrencyId', + CurrencyTypeEnum: { + _enum: ['CLV', 'CUSDT', 'DOT', 'CETH'] + }, + PairKey: 'u64', + Rate: 'FixedU128', + Ratio: 'FixedU128', + Price: 'FixedU128', + Share: 'u128', + OracleKey: 'CurrencyId', + CurrencyInfo: { + id: 'CurrencyId', + name: 'CurrencyTypeEnum' + }, + ExchangeInfo: { + balance: 'Balance', + routes: 'Vec' + }, + PoolId: { + _enum: { + Swap: 'u64' + } + }, + EcdsaSignature: '[u8; 65]', + EvmAddress: 'H160', + ExitSucceed: { + _enum: ['Stopped', 'Returned', 'Suicided'] + }, + ExitRevert: { + _enum: ['Reverted'] + }, + ExitError: { + _enum: [ + 'StackUnderflow', 'StackOverflow', 'InvalidJump', 'InvalidRange', 'DesignatedInvalid', 'CallTooDeep', + 'CreateCollision', 'CreateContractLimit', 'OutOfOffset', 'OutOfGas', 'OutOfFund', 'PCUnderflow', 'CreateEmpty', + 'Other' + ] + }, + ExitFatal: { + _enum: ['NotSupported', 'UnhandledInterrupt', 'CallErrorAsFatal', 'Other'] + }, + ExitReason: { + _enum: ['Succeed', + 'Error', + 'Revert', + 'Fatal' + ] + } + } } - }, - EcdsaSignature: '[u8; 65]', - EvmAddress: 'H160', - ExitSucceed: { - _enum: ['Stopped', 'Returned', 'Suicided'] - }, - ExitRevert: { - _enum: ['Reverted'] - }, - ExitError: { - _enum: [ - 'StackUnderflow', 'StackOverflow', 'InvalidJump', 'InvalidRange', 'DesignatedInvalid', 'CallTooDeep', - 'CreateCollision', 'CreateContractLimit', 'OutOfOffset', 'OutOfGas', 'OutOfFund', 'PCUnderflow', 'CreateEmpty', - 'Other' - ] - }, - ExitFatal: { - _enum: ['NotSupported', 'UnhandledInterrupt', 'CallErrorAsFatal', 'Other'] - }, - ExitReason: { - _enum: ['Succeed', - 'Error', - 'Revert', - 'Fatal' - ] - } + ] }; -export default cloverTypes; +export default definitions; diff --git a/packages/apps-config/src/api/spec/crab.ts b/packages/apps-config/src/api/spec/crab.ts index 8416588969ef..2606f16d829b 100644 --- a/packages/apps-config/src/api/spec/crab.ts +++ b/packages/apps-config/src/api/spec/crab.ts @@ -1,273 +1,285 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId', - BalanceInfo: 'Null', - BalanceLock: { - id: 'LockIdentifier', - lockFor: 'LockFor', - LockReasons: 'Reasons', - amount: 'Balance', - reasons: 'Reasons' - }, - LockFor: { - _enum: { - Common: 'Common', - Staking: 'StakingLock' - } - }, - Common: { - amount: 'Balance' - }, - StakingLock: { - stakingAmount: 'Balance', - unbondings: 'Vec' - }, - Reasons: { - _enum: ['Fee', 'Misc', 'All'] - }, - Unbonding: { - amount: 'Balance', - moment: 'BlockNumber' - }, - AccountData: { - free: 'Balance', - reserved: 'Balance', - freeKton: 'Balance', - reservedKton: 'Balance', - miscFrozen: 'Balance', - feeFrozen: 'Balance' - }, +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId', + BalanceInfo: 'Null', + BalanceLock: { + id: 'LockIdentifier', + lockFor: 'LockFor', + LockReasons: 'Reasons', + amount: 'Balance', + reasons: 'Reasons' + }, + LockFor: { + _enum: { + Common: 'Common', + Staking: 'StakingLock' + } + }, + Common: { + amount: 'Balance' + }, + StakingLock: { + stakingAmount: 'Balance', + unbondings: 'Vec' + }, + Reasons: { + _enum: ['Fee', 'Misc', 'All'] + }, + Unbonding: { + amount: 'Balance', + moment: 'BlockNumber' + }, + AccountData: { + free: 'Balance', + reserved: 'Balance', + freeKton: 'Balance', + reservedKton: 'Balance', + miscFrozen: 'Balance', + feeFrozen: 'Balance' + }, - RingBalance: 'Balance', - KtonBalance: 'Balance', - TsInMs: 'u64', - Power: 'u32', - DepositId: 'U256', - StakingBalanceT: { - _enum: { - RingBalance: 'Balance', - KtonBalance: 'Balance' - } - }, - StakingLedgerT: { - stash: 'AccountId', - activeRing: 'Compact', - activeDepositRing: 'Compact', - activeKton: 'Compact', - depositItems: 'Vec', - ringStakingLock: 'StakingLock', - ktonStakingLock: 'StakingLock', - claimedRewards: 'Vec', - total: 'Compact', - active: 'Compact', - unlocking: 'Vec' - }, - TimeDepositItem: { - value: 'Compact', - startTime: 'Compact', - expireTime: 'Compact' - }, - ExposureT: { - ownRingBalance: 'Compact', - ownKtonBalance: 'Compact', - ownPower: 'Power', - totalPower: 'Power', - others: 'Vec' - }, - Exposure: 'ExposureT', - IndividualExposure: { - who: 'AccountId', - ringBalance: 'Compact', - ktonBalance: 'Compact', - power: 'Power' - }, - ElectionResultT: { - electedStashes: 'Vec', - exposures: 'Vec<(AccountId, ExposureT)>', - compute: 'ElectionCompute' - }, - RKT: { - r: 'Balance', - k: 'Balance' - }, - SpanRecord: { - slashed: 'RKT', - paidOut: 'RKT' - }, - UnappliedSlash: { - validator: 'AccountId', - own: 'RKT', - others: 'Vec<(AccountId, RKT)>', - reporters: 'Vec', - payout: 'RKT' - }, + RingBalance: 'Balance', + KtonBalance: 'Balance', + TsInMs: 'u64', + Power: 'u32', + DepositId: 'U256', + StakingBalanceT: { + _enum: { + RingBalance: 'Balance', + KtonBalance: 'Balance' + } + }, + StakingLedgerT: { + stash: 'AccountId', + activeRing: 'Compact', + activeDepositRing: 'Compact', + activeKton: 'Compact', + depositItems: 'Vec', + ringStakingLock: 'StakingLock', + ktonStakingLock: 'StakingLock', + claimedRewards: 'Vec', + total: 'Compact', + active: 'Compact', + unlocking: 'Vec' + }, + TimeDepositItem: { + value: 'Compact', + startTime: 'Compact', + expireTime: 'Compact' + }, + ExposureT: { + ownRingBalance: 'Compact', + ownKtonBalance: 'Compact', + ownPower: 'Power', + totalPower: 'Power', + others: 'Vec' + }, + Exposure: 'ExposureT', + IndividualExposure: { + who: 'AccountId', + ringBalance: 'Compact', + ktonBalance: 'Compact', + power: 'Power' + }, + ElectionResultT: { + electedStashes: 'Vec', + exposures: 'Vec<(AccountId, ExposureT)>', + compute: 'ElectionCompute' + }, + RKT: { + r: 'Balance', + k: 'Balance' + }, + SpanRecord: { + slashed: 'RKT', + paidOut: 'RKT' + }, + UnappliedSlash: { + validator: 'AccountId', + own: 'RKT', + others: 'Vec<(AccountId, RKT)>', + reporters: 'Vec', + payout: 'RKT' + }, - TreasuryProposal: { - proposer: 'AccountId', - beneficiary: 'AccountId', - ringValue: 'Balance', - ktonValue: 'Balance', - ringBond: 'Balance', - ktonBond: 'Balance' - }, + TreasuryProposal: { + proposer: 'AccountId', + beneficiary: 'AccountId', + ringValue: 'Balance', + ktonValue: 'Balance', + ringBond: 'Balance', + ktonBond: 'Balance' + }, - MappedRing: 'u128', + MappedRing: 'u128', - EthereumTransactionIndex: '(H256, u64)', - EthereumBlockNumber: 'u64', - EthereumHeader: { - parent_hash: 'H256', - timestamp: 'u64', - number: 'EthereumBlockNumber', - author: 'EthereumAddress', - transactions_root: 'H256', - uncles_hash: 'H256', - extra_data: 'Bytes', - state_root: 'H256', - receipts_root: 'H256', - log_bloom: 'Bloom', - gas_used: 'U256', - gas_limit: 'U256', - difficulty: 'U256', - seal: 'Vec', - hash: 'Option' - }, - EthereumAddress: 'H160', - Bloom: '[u8; 256; Bloom]', - H128: '[u8; 16; H128]', - EthashProof: { - dagNodes: '(H512, H512)', - proof: 'Vec' - }, - EthereumReceipt: { - gasUsed: 'U256', - logBloom: 'Bloom', - logs: 'Vec', - outcome: 'TransactionOutcome' - }, + EthereumTransactionIndex: '(H256, u64)', + EthereumBlockNumber: 'u64', + EthereumHeader: { + parent_hash: 'H256', + timestamp: 'u64', + number: 'EthereumBlockNumber', + author: 'EthereumAddress', + transactions_root: 'H256', + uncles_hash: 'H256', + extra_data: 'Bytes', + state_root: 'H256', + receipts_root: 'H256', + log_bloom: 'Bloom', + gas_used: 'U256', + gas_limit: 'U256', + difficulty: 'U256', + seal: 'Vec', + hash: 'Option' + }, + EthereumAddress: 'H160', + Bloom: '[u8; 256; Bloom]', + H128: '[u8; 16; H128]', + EthashProof: { + dagNodes: '(H512, H512)', + proof: 'Vec' + }, + EthereumReceipt: { + gasUsed: 'U256', + logBloom: 'Bloom', + logs: 'Vec', + outcome: 'TransactionOutcome' + }, - LogEntry: {}, - TransactionOutcome: {}, + LogEntry: {}, + TransactionOutcome: {}, - EthereumNetworkType: { - _enum: { - Mainnet: null, - Ropsten: null - } - }, - RedeemFor: { - _enum: { - Token: null, - Deposit: null - } - }, - EthereumReceiptProof: { - index: 'u64', - proof: 'Bytes', - headerHash: 'H256' - }, - EthereumReceiptProofThing: '(EthereumHeader, EthereumReceiptProof, MMRProof)', - MMRProof: { - memberLeafIndex: 'u64', - lastLeafIndex: 'u64', - proof: 'Vec' - }, - EthereumRelayHeaderParcel: { - header: 'EthereumHeader', - mmrRoot: 'H256' - }, - EthereumRelayProofs: { - ethashProof: 'Vec', - mmrProof: 'Vec' - }, + EthereumNetworkType: { + _enum: { + Mainnet: null, + Ropsten: null + } + }, + RedeemFor: { + _enum: { + Token: null, + Deposit: null + } + }, + EthereumReceiptProof: { + index: 'u64', + proof: 'Bytes', + headerHash: 'H256' + }, + EthereumReceiptProofThing: '(EthereumHeader, EthereumReceiptProof, MMRProof)', + MMRProof: { + memberLeafIndex: 'u64', + lastLeafIndex: 'u64', + proof: 'Vec' + }, + EthereumRelayHeaderParcel: { + header: 'EthereumHeader', + mmrRoot: 'H256' + }, + EthereumRelayProofs: { + ethashProof: 'Vec', + mmrProof: 'Vec' + }, - OtherSignature: { - _enum: { - Eth: 'EcdsaSignature', - Tron: 'EcdsaSignature' - } - }, - EcdsaSignature: '[u8; 65; EcdsaSignature]', - TronAddress: 'EthereumAddress', - OtherAddress: { - _enum: { - Eth: 'EthereumAddress', - Tron: 'TronAddress' - } - }, - AddressT: '[u8; 20; AddressT]', + OtherSignature: { + _enum: { + Eth: 'EcdsaSignature', + Tron: 'EcdsaSignature' + } + }, + EcdsaSignature: '[u8; 65; EcdsaSignature]', + TronAddress: 'EthereumAddress', + OtherAddress: { + _enum: { + Eth: 'EthereumAddress', + Tron: 'TronAddress' + } + }, + AddressT: '[u8; 20; AddressT]', - MerkleMountainRangeRootLog: { - prefix: '[u8; 4; Prefix]', - ParentMmrRoot: 'Hash' - }, + MerkleMountainRangeRootLog: { + prefix: '[u8; 4; Prefix]', + ParentMmrRoot: 'Hash' + }, - AccountInfo: { - nonce: 'Index', - refcount: 'RefCount', - data: 'AccountData' - }, - ProxyDefinition: { - delegate: 'AccountId', - proxyType: 'ProxyType', - delay: 'BlockNumber' - }, - ProxyType: { - _enum: { - Any: null, - NonTransfer: null, - Governance: null, - Staking: null, - IdentityJudgement: null, - EthereumBridge: null + AccountInfo: { + nonce: 'Index', + refcount: 'RefCount', + data: 'AccountData' + }, + ProxyDefinition: { + delegate: 'AccountId', + proxyType: 'ProxyType', + delay: 'BlockNumber' + }, + ProxyType: { + _enum: { + Any: null, + NonTransfer: null, + Governance: null, + Staking: null, + IdentityJudgement: null, + EthereumBridge: null + } + }, + ProxyAnnouncement: { + real: 'AccountId', + callHash: 'Hash', + height: 'BlockNumber' + }, + Announcement: 'ProxyAnnouncement', + RelayHeaderId: 'EthereumBlockNumber', + RelayHeaderParcel: 'EthereumRelayHeaderParcel', + RelayProofs: 'EthereumRelayProofs', + RelayAffirmationId: { + relayHeaderId: 'EthereumBlockNumber', + round: 'u32', + index: 'u32' + }, + RelayAffirmationT: { + relayer: 'AccountId', + relayHeaderParcels: 'EthereumRelayHeaderParcel', + bond: 'Balance', + maybeExtendedRelayAffirmationId: 'Option', + verified: 'bool' + }, + RelayVotingState: { + ayes: 'Vec', + nays: 'Vec' + }, + PowerOf: { + power: 'Power' + }, + Signer: 'EthereumAddress', + RelayAuthorityT: { + accountId: 'AccountId', + signer: 'Signer', + stake: 'Balance', + term: 'BlockNumber' + }, + MMRRoot: 'Hash', + EcdsaAddress: 'EthereumAddress', + EcdsaMessage: 'H256', + RelayAuthoritySigner: 'EcdsaAddress', + RelayAuthorityMessage: 'EcdsaMessage', + RelayAuthoritySignature: 'EcdsaSignature', + Term: 'u32' + } } - }, - ProxyAnnouncement: { - real: 'AccountId', - callHash: 'Hash', - height: 'BlockNumber' - }, - Announcement: 'ProxyAnnouncement', - RelayHeaderId: 'EthereumBlockNumber', - RelayHeaderParcel: 'EthereumRelayHeaderParcel', - RelayProofs: 'EthereumRelayProofs', - RelayAffirmationId: { - relayHeaderId: 'EthereumBlockNumber', - round: 'u32', - index: 'u32' - }, - RelayAffirmationT: { - relayer: 'AccountId', - relayHeaderParcels: 'EthereumRelayHeaderParcel', - bond: 'Balance', - maybeExtendedRelayAffirmationId: 'Option', - verified: 'bool' - }, - RelayVotingState: { - ayes: 'Vec', - nays: 'Vec' - }, - PowerOf: { - power: 'Power' - }, - Signer: 'EthereumAddress', - RelayAuthorityT: { - accountId: 'AccountId', - signer: 'Signer', - stake: 'Balance', - term: 'BlockNumber' - }, - MMRRoot: 'Hash', - EcdsaAddress: 'EthereumAddress', - EcdsaMessage: 'H256', - RelayAuthoritySigner: 'EcdsaAddress', - RelayAuthorityMessage: 'EcdsaMessage', - RelayAuthoritySignature: 'EcdsaSignature', - Term: 'u32' + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/crust-parachain.ts b/packages/apps-config/src/api/spec/crust-parachain.ts index 250eddf1ab8d..500c9b06ff20 100644 --- a/packages/apps-config/src/api/spec/crust-parachain.ts +++ b/packages/apps-config/src/api/spec/crust-parachain.ts @@ -1,76 +1,88 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - AddressInfo: 'Vec', - FileAlias: 'Vec', - Guarantee: { - targets: 'Vec>', - total: 'Compact', - submitted_in: 'EraIndex', - suppressed: 'bool' - }, - IASSig: 'Vec', - Identity: { - pub_key: 'Vec', - code: 'Vec' - }, - ISVBody: 'Vec', - LookupSource: 'AccountId', - MerchantInfo: { - address: 'Vec', - storage_price: 'Balance', - file_map: 'Vec<(Vec, Vec)>' - }, - MerchantPunishment: { - success: 'EraIndex', - failed: 'EraIndex', - value: 'Balance' - }, - MerkleRoot: 'Vec', - OrderStatus: { - _enum: ['Success', 'Failed', 'Pending'] - }, - PaymentLedger: { - total: 'Balance', - paid: 'Balance', - unreserved: 'Balance' - }, - Pledge: { - total: 'Balance', - used: 'Balance' - }, - ReportSlot: 'u64', - Releases: { - _enum: ['V1_0_0', 'V2_0_0'] - }, - Status: { - _enum: ['Free', 'Reserved'] - }, - StorageOrder: { - file_identifier: 'Vec', - file_size: 'u64', - created_on: 'BlockNumber', - completed_on: 'BlockNumber', - expired_on: 'BlockNumber', - provider: 'AccountId', - client: 'AccountId', - amount: 'Balance', - order_status: 'OrderStatus' - }, - SworkerCert: 'Vec', - SworkerCode: 'Vec', - SworkerPubKey: 'Vec', - SworkerSignature: 'Vec', - WorkReport: { - block_number: 'u64', - used: 'u64', - reserved: 'u64', - cached_reserved: 'u64', - files: 'Vec<(Vec, u64)>' - } +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + AddressInfo: 'Vec', + FileAlias: 'Vec', + Guarantee: { + targets: 'Vec>', + total: 'Compact', + submitted_in: 'EraIndex', + suppressed: 'bool' + }, + IASSig: 'Vec', + Identity: { + pub_key: 'Vec', + code: 'Vec' + }, + ISVBody: 'Vec', + LookupSource: 'AccountId', + MerchantInfo: { + address: 'Vec', + storage_price: 'Balance', + file_map: 'Vec<(Vec, Vec)>' + }, + MerchantPunishment: { + success: 'EraIndex', + failed: 'EraIndex', + value: 'Balance' + }, + MerkleRoot: 'Vec', + OrderStatus: { + _enum: ['Success', 'Failed', 'Pending'] + }, + PaymentLedger: { + total: 'Balance', + paid: 'Balance', + unreserved: 'Balance' + }, + Pledge: { + total: 'Balance', + used: 'Balance' + }, + ReportSlot: 'u64', + Releases: { + _enum: ['V1_0_0', 'V2_0_0'] + }, + Status: { + _enum: ['Free', 'Reserved'] + }, + StorageOrder: { + file_identifier: 'Vec', + file_size: 'u64', + created_on: 'BlockNumber', + completed_on: 'BlockNumber', + expired_on: 'BlockNumber', + provider: 'AccountId', + client: 'AccountId', + amount: 'Balance', + order_status: 'OrderStatus' + }, + SworkerCert: 'Vec', + SworkerCode: 'Vec', + SworkerPubKey: 'Vec', + SworkerSignature: 'Vec', + WorkReport: { + block_number: 'u64', + used: 'u64', + reserved: 'u64', + cached_reserved: 'u64', + files: 'Vec<(Vec, u64)>' + } + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/crust.ts b/packages/apps-config/src/api/spec/crust.ts index 109d2a8f4e16..935d8f1c6777 100644 --- a/packages/apps-config/src/api/spec/crust.ts +++ b/packages/apps-config/src/api/spec/crust.ts @@ -1,73 +1,85 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - AddressInfo: 'Vec', - ETHAddress: 'Vec', - EthereumTxHash: 'H256', - FileAlias: 'Vec', - FileInfo: { - file_size: 'u64', - expired_on: 'BlockNumber', - claimed_at: 'BlockNumber', - amount: 'Balance', - expected_replica_count: 'u32', - reported_replica_count: 'u32', - replicas: 'Vec>' - }, - Guarantee: { - targets: 'Vec>', - total: 'Compact', - submitted_in: 'EraIndex', - suppressed: 'bool' - }, - IASSig: 'Vec', - Identity: { - anchor: 'SworkerAnchor', - punishment_deadline: 'u64', - group: 'Option' - }, - ISVBody: 'Vec', - LookupSource: 'AccountId', - MerchantLedger: { - reward: 'Balance', - pledge: 'Balance' - }, - MerkleRoot: 'Vec', - ReportSlot: 'u64', - Replica: { - who: 'AccountId', - valid_at: 'BlockNumber', - anchor: 'SworkerAnchor', - is_reported: 'bool' - }, - PKInfo: { - code: 'SworkerCode', - anchor: 'Option' - }, - Status: { - _enum: ['Free', 'Reserved'] - }, - SworkerAnchor: 'Vec', - SworkerCert: 'Vec', - SworkerCode: 'Vec', - SworkerPubKey: 'Vec', - SworkerSignature: 'Vec', - UsedInfo: { - used_size: 'u64', - reported_group_count: 'u32', - groups: 'BTreeMap' - }, - WorkReport: { - report_slot: 'u64', - used: 'u64', - free: 'u64', - reported_files_size: 'u64', - reported_srd_root: 'MerkleRoot', - reported_files_root: 'MerkleRoot' - } +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + AddressInfo: 'Vec', + ETHAddress: 'Vec', + EthereumTxHash: 'H256', + FileAlias: 'Vec', + FileInfo: { + file_size: 'u64', + expired_on: 'BlockNumber', + claimed_at: 'BlockNumber', + amount: 'Balance', + expected_replica_count: 'u32', + reported_replica_count: 'u32', + replicas: 'Vec>' + }, + Guarantee: { + targets: 'Vec>', + total: 'Compact', + submitted_in: 'EraIndex', + suppressed: 'bool' + }, + IASSig: 'Vec', + Identity: { + anchor: 'SworkerAnchor', + punishment_deadline: 'u64', + group: 'Option' + }, + ISVBody: 'Vec', + LookupSource: 'AccountId', + MerchantLedger: { + reward: 'Balance', + pledge: 'Balance' + }, + MerkleRoot: 'Vec', + ReportSlot: 'u64', + Replica: { + who: 'AccountId', + valid_at: 'BlockNumber', + anchor: 'SworkerAnchor', + is_reported: 'bool' + }, + PKInfo: { + code: 'SworkerCode', + anchor: 'Option' + }, + Status: { + _enum: ['Free', 'Reserved'] + }, + SworkerAnchor: 'Vec', + SworkerCert: 'Vec', + SworkerCode: 'Vec', + SworkerPubKey: 'Vec', + SworkerSignature: 'Vec', + UsedInfo: { + used_size: 'u64', + reported_group_count: 'u32', + groups: 'BTreeMap' + }, + WorkReport: { + report_slot: 'u64', + used: 'u64', + free: 'u64', + reported_files_size: 'u64', + reported_srd_root: 'MerkleRoot', + reported_files_root: 'MerkleRoot' + } + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/cumulus-test-parachain.ts b/packages/apps-config/src/api/spec/cumulus-test-parachain.ts index 65b114ec25f5..f137bf11005b 100644 --- a/packages/apps-config/src/api/spec/cumulus-test-parachain.ts +++ b/packages/apps-config/src/api/spec/cumulus-test-parachain.ts @@ -1,11 +1,23 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId', - RefCount: 'u8' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId', + RefCount: 'u8' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/darwinia-parachain.ts b/packages/apps-config/src/api/spec/darwinia-parachain.ts index b4190a061e55..0e86efc8543b 100644 --- a/packages/apps-config/src/api/spec/darwinia-parachain.ts +++ b/packages/apps-config/src/api/spec/darwinia-parachain.ts @@ -1,229 +1,241 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId', - RefCount: 'u8', - BalanceLock: { - id: 'LockIdentifier', - lock_for: 'LockFor', - lock_reasons: 'LockReasons', - amount: 'Balance', - reasons: 'Reasons' - }, - LockFor: { - _enum: { - Common: 'Common', - Staking: 'StakingLock' - } - }, - Common: { - amount: 'Balance' - }, - StakingLock: { - staking_amount: 'Balance', - unbondings: 'Vec' - }, - LockReasons: { - _enum: { - Fee: null, - Misc: null, - All: null - } - }, - Unbonding: { - amount: 'Balance', - until: 'BlockNumber' - }, - AccountData: { - free: 'Balance', - reserved: 'Balance', - free_kton: 'Balance', - reserved_kton: 'Balance', - misc_frozen: 'Balance', - fee_frozen: 'Balance' - }, - RingBalance: 'Balance', - KtonBalance: 'Balance', - TsInMs: 'u64', - Power: 'u32', - DepositId: 'U256', - StakingBalanceT: { - _enum: { - RingBalance: 'Balance', - KtonBalance: 'Balance' - } - }, - StakingLedgerT: { - stash: 'AccountId', - active_ring: 'Compact', - active_deposit_ring: 'Compact', - active_kton: 'Compact', - deposit_items: 'Vec', - ring_staking_lock: 'StakingLock', - kton_staking_lock: 'StakingLock', - claimed_rewards: 'Vec', - total: 'Compact', - active: 'Compact', - unlocking: 'Vec' - }, - TimeDepositItem: { - value: 'Compact', - start_time: 'Compact', - expire_time: 'Compact' - }, - RewardDestination: { - _enum: { - Staked: 'Staked', - Stash: null, - Controller: null - } - }, - Staked: { - promise_month: 'u8' - }, - ExposureT: { - own_ring_balance: 'Compact', - own_kton_balance: 'Compact', - own_power: 'Power', - total_power: 'Power', - others: 'Vec', - total: 'Compact', - own: 'Compact' - }, - IndividualExposure: { - who: 'AccountId', - ring_balance: 'Compact', - kton_balance: 'Compact', - power: 'Power', - value: 'Compact' - }, - ElectionResultT: { - elected_stashes: 'Vec', - exposures: 'Vec<(AccountId, ExposureT)>', - compute: 'ElectionCompute' - }, - RKT: { - r: 'Balance', - k: 'Balance' - }, - SpanRecord: { - slashed: 'RKT', - paid_out: 'RKT' - }, - UnappliedSlash: { - validator: 'AccountId', - own: 'RKT', - others: 'Vec<(AccountId, RKT)>', - reporters: 'Vec', - payout: 'RKT' - }, - TreasuryProposal: { - proposer: 'AccountId', - beneficiary: 'AccountId', - ring_value: 'Balance', - kton_value: 'Balance', - ring_bond: 'Balance', - kton_bond: 'Balance', - value: 'Balance', - bond: 'Balance' - }, - EthTransactionIndex: '(H256, u64)', - EthHeaderBrief: { - total_difficulty: 'U256', - parent_hash: 'H256', - number: 'EthBlockNumber', - relayer: 'AccountId' - }, - EthBlockNumber: 'u64', - EthHeaderThing: { - eth_header: 'EthHeader', - ethash_proof: 'Vec', - mmr_root: 'MMRHash', - mmr_proof: 'Vec' - }, - EthHeader: { - parent_hash: 'H256', - timestamp: 'u64', - number: 'EthBlockNumber', - author: 'EthAddress', - transactions_root: 'H256', - uncles_hash: 'H256', - extra_data: 'Bytes', - state_root: 'H256', - receipts_root: 'H256', - log_bloom: 'Bloom', - gas_used: 'U256', - gas_limit: 'U256', - difficulty: 'U256', - seal: 'Vec', - hash: 'Option' - }, - EthAddress: 'H160', - Bloom: '[u8; 256; Bloom]', - H128: '[u8; 16; H128]', - EthashProof: { - dag_nodes: '(H512, H512)', - proof: 'Vec' - }, - Receipt: { - gas_used: 'U256', - log_bloom: 'Bloom', - logs: 'Vec', - outcome: 'TransactionOutcome' - }, - EthereumNetworkType: { - _enum: { - Mainnet: null, - Ropsten: null +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId', + RefCount: 'u8', + BalanceLock: { + id: 'LockIdentifier', + lock_for: 'LockFor', + lock_reasons: 'LockReasons', + amount: 'Balance', + reasons: 'Reasons' + }, + LockFor: { + _enum: { + Common: 'Common', + Staking: 'StakingLock' + } + }, + Common: { + amount: 'Balance' + }, + StakingLock: { + staking_amount: 'Balance', + unbondings: 'Vec' + }, + LockReasons: { + _enum: { + Fee: null, + Misc: null, + All: null + } + }, + Unbonding: { + amount: 'Balance', + until: 'BlockNumber' + }, + AccountData: { + free: 'Balance', + reserved: 'Balance', + free_kton: 'Balance', + reserved_kton: 'Balance', + misc_frozen: 'Balance', + fee_frozen: 'Balance' + }, + RingBalance: 'Balance', + KtonBalance: 'Balance', + TsInMs: 'u64', + Power: 'u32', + DepositId: 'U256', + StakingBalanceT: { + _enum: { + RingBalance: 'Balance', + KtonBalance: 'Balance' + } + }, + StakingLedgerT: { + stash: 'AccountId', + active_ring: 'Compact', + active_deposit_ring: 'Compact', + active_kton: 'Compact', + deposit_items: 'Vec', + ring_staking_lock: 'StakingLock', + kton_staking_lock: 'StakingLock', + claimed_rewards: 'Vec', + total: 'Compact', + active: 'Compact', + unlocking: 'Vec' + }, + TimeDepositItem: { + value: 'Compact', + start_time: 'Compact', + expire_time: 'Compact' + }, + RewardDestination: { + _enum: { + Staked: 'Staked', + Stash: null, + Controller: null + } + }, + Staked: { + promise_month: 'u8' + }, + ExposureT: { + own_ring_balance: 'Compact', + own_kton_balance: 'Compact', + own_power: 'Power', + total_power: 'Power', + others: 'Vec', + total: 'Compact', + own: 'Compact' + }, + IndividualExposure: { + who: 'AccountId', + ring_balance: 'Compact', + kton_balance: 'Compact', + power: 'Power', + value: 'Compact' + }, + ElectionResultT: { + elected_stashes: 'Vec', + exposures: 'Vec<(AccountId, ExposureT)>', + compute: 'ElectionCompute' + }, + RKT: { + r: 'Balance', + k: 'Balance' + }, + SpanRecord: { + slashed: 'RKT', + paid_out: 'RKT' + }, + UnappliedSlash: { + validator: 'AccountId', + own: 'RKT', + others: 'Vec<(AccountId, RKT)>', + reporters: 'Vec', + payout: 'RKT' + }, + TreasuryProposal: { + proposer: 'AccountId', + beneficiary: 'AccountId', + ring_value: 'Balance', + kton_value: 'Balance', + ring_bond: 'Balance', + kton_bond: 'Balance', + value: 'Balance', + bond: 'Balance' + }, + EthTransactionIndex: '(H256, u64)', + EthHeaderBrief: { + total_difficulty: 'U256', + parent_hash: 'H256', + number: 'EthBlockNumber', + relayer: 'AccountId' + }, + EthBlockNumber: 'u64', + EthHeaderThing: { + eth_header: 'EthHeader', + ethash_proof: 'Vec', + mmr_root: 'MMRHash', + mmr_proof: 'Vec' + }, + EthHeader: { + parent_hash: 'H256', + timestamp: 'u64', + number: 'EthBlockNumber', + author: 'EthAddress', + transactions_root: 'H256', + uncles_hash: 'H256', + extra_data: 'Bytes', + state_root: 'H256', + receipts_root: 'H256', + log_bloom: 'Bloom', + gas_used: 'U256', + gas_limit: 'U256', + difficulty: 'U256', + seal: 'Vec', + hash: 'Option' + }, + EthAddress: 'H160', + Bloom: '[u8; 256; Bloom]', + H128: '[u8; 16; H128]', + EthashProof: { + dag_nodes: '(H512, H512)', + proof: 'Vec' + }, + Receipt: { + gas_used: 'U256', + log_bloom: 'Bloom', + logs: 'Vec', + outcome: 'TransactionOutcome' + }, + EthereumNetworkType: { + _enum: { + Mainnet: null, + Ropsten: null + } + }, + RedeemFor: { + _enum: { + Ring: null, + Kton: null, + Deposit: null + } + }, + EthereumReceiptProof: { + index: 'u64', + proof: 'Bytes', + header_hash: 'H256' + }, + MMRProof: 'Vec', + OtherSignature: { + _enum: { + Eth: 'EcdsaSignature', + Tron: 'EcdsaSignature' + } + }, + EcdsaSignature: '[u8; 65; EcdsaSignature]', + OtherAddress: { + _enum: { + Eth: '[u8; 20; EthereumAddress]', + Tron: '[u8; 20; TronAddress]' + } + }, + AddressT: '[u8; 20; AddressT]', + MerkleMountainRangeRootLog: { + prefix: '[u8; 4; Prefix]', + mmr_root: 'Hash' + }, + Round: 'u64', + TcBlockNumber: 'Vec', + TcHeaderHash: 'Vec', + TcHeaderMMR: 'Vec', + MMRHash: 'Vec', + GameId: 'TcBlockNumber', + RawHeaderThing: 'Vec', + BalancesRuntimeDispatchInfo: { + usable_balance: 'Balance' + }, + StakingRuntimeDispatchInfo: { + power: 'Power' + } + } } - }, - RedeemFor: { - _enum: { - Ring: null, - Kton: null, - Deposit: null - } - }, - EthereumReceiptProof: { - index: 'u64', - proof: 'Bytes', - header_hash: 'H256' - }, - MMRProof: 'Vec', - OtherSignature: { - _enum: { - Eth: 'EcdsaSignature', - Tron: 'EcdsaSignature' - } - }, - EcdsaSignature: '[u8; 65; EcdsaSignature]', - OtherAddress: { - _enum: { - Eth: '[u8; 20; EthereumAddress]', - Tron: '[u8; 20; TronAddress]' - } - }, - AddressT: '[u8; 20; AddressT]', - MerkleMountainRangeRootLog: { - prefix: '[u8; 4; Prefix]', - mmr_root: 'Hash' - }, - Round: 'u64', - TcBlockNumber: 'Vec', - TcHeaderHash: 'Vec', - TcHeaderMMR: 'Vec', - MMRHash: 'Vec', - GameId: 'TcBlockNumber', - RawHeaderThing: 'Vec', - BalancesRuntimeDispatchInfo: { - usable_balance: 'Balance' - }, - StakingRuntimeDispatchInfo: { - power: 'Power' - } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/darwinia.ts b/packages/apps-config/src/api/spec/darwinia.ts index 0c3a6f56eab6..e777544b1c6e 100644 --- a/packages/apps-config/src/api/spec/darwinia.ts +++ b/packages/apps-config/src/api/spec/darwinia.ts @@ -1,259 +1,271 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId', - BalanceInfo: 'Null', - BalanceLock: { - id: 'LockIdentifier', - lockFor: 'LockFor', - LockReasons: 'Reasons', - amount: 'Balance', - reasons: 'Reasons' - }, - LockFor: { - _enum: { - Common: 'Common', - Staking: 'StakingLock' - } - }, - Common: { - amount: 'Balance' - }, - StakingLock: { - stakingAmount: 'Balance', - unbondings: 'Vec' - }, - Reasons: { - _enum: ['Fee', 'Misc', 'All'] - }, - Unbonding: { - amount: 'Balance', - moment: 'BlockNumber' - }, - AccountData: { - free: 'Balance', - reserved: 'Balance', - freeKton: 'Balance', - reservedKton: 'Balance', - miscFrozen: 'Balance', - feeFrozen: 'Balance' - }, +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId', + BalanceInfo: 'Null', + BalanceLock: { + id: 'LockIdentifier', + lockFor: 'LockFor', + LockReasons: 'Reasons', + amount: 'Balance', + reasons: 'Reasons' + }, + LockFor: { + _enum: { + Common: 'Common', + Staking: 'StakingLock' + } + }, + Common: { + amount: 'Balance' + }, + StakingLock: { + stakingAmount: 'Balance', + unbondings: 'Vec' + }, + Reasons: { + _enum: ['Fee', 'Misc', 'All'] + }, + Unbonding: { + amount: 'Balance', + moment: 'BlockNumber' + }, + AccountData: { + free: 'Balance', + reserved: 'Balance', + freeKton: 'Balance', + reservedKton: 'Balance', + miscFrozen: 'Balance', + feeFrozen: 'Balance' + }, - RingBalance: 'Balance', - KtonBalance: 'Balance', - TsInMs: 'u64', - Power: 'u32', - DepositId: 'U256', - StakingBalanceT: { - _enum: { - RingBalance: 'Balance', - KtonBalance: 'Balance' - } - }, - StakingLedgerT: { - stash: 'AccountId', - activeRing: 'Compact', - activeDepositRing: 'Compact', - activeKton: 'Compact', - depositItems: 'Vec', - ringStakingLock: 'StakingLock', - ktonStakingLock: 'StakingLock', - claimedRewards: 'Vec', - total: 'Compact', - active: 'Compact', - unlocking: 'Vec' - }, - TimeDepositItem: { - value: 'Compact', - startTime: 'Compact', - expireTime: 'Compact' - }, - ExposureT: { - ownRingBalance: 'Compact', - ownKtonBalance: 'Compact', - ownPower: 'Power', - totalPower: 'Power', - others: 'Vec' - }, - Exposure: 'ExposureT', - IndividualExposure: { - who: 'AccountId', - ringBalance: 'Compact', - ktonBalance: 'Compact', - power: 'Power' - }, - ElectionResultT: { - electedStashes: 'Vec', - exposures: 'Vec<(AccountId, ExposureT)>', - compute: 'ElectionCompute' - }, - RKT: { - r: 'Balance', - k: 'Balance' - }, - SpanRecord: { - slashed: 'RKT', - paidOut: 'RKT' - }, - UnappliedSlash: { - validator: 'AccountId', - own: 'RKT', - others: 'Vec<(AccountId, RKT)>', - reporters: 'Vec', - payout: 'RKT' - }, + RingBalance: 'Balance', + KtonBalance: 'Balance', + TsInMs: 'u64', + Power: 'u32', + DepositId: 'U256', + StakingBalanceT: { + _enum: { + RingBalance: 'Balance', + KtonBalance: 'Balance' + } + }, + StakingLedgerT: { + stash: 'AccountId', + activeRing: 'Compact', + activeDepositRing: 'Compact', + activeKton: 'Compact', + depositItems: 'Vec', + ringStakingLock: 'StakingLock', + ktonStakingLock: 'StakingLock', + claimedRewards: 'Vec', + total: 'Compact', + active: 'Compact', + unlocking: 'Vec' + }, + TimeDepositItem: { + value: 'Compact', + startTime: 'Compact', + expireTime: 'Compact' + }, + ExposureT: { + ownRingBalance: 'Compact', + ownKtonBalance: 'Compact', + ownPower: 'Power', + totalPower: 'Power', + others: 'Vec' + }, + Exposure: 'ExposureT', + IndividualExposure: { + who: 'AccountId', + ringBalance: 'Compact', + ktonBalance: 'Compact', + power: 'Power' + }, + ElectionResultT: { + electedStashes: 'Vec', + exposures: 'Vec<(AccountId, ExposureT)>', + compute: 'ElectionCompute' + }, + RKT: { + r: 'Balance', + k: 'Balance' + }, + SpanRecord: { + slashed: 'RKT', + paidOut: 'RKT' + }, + UnappliedSlash: { + validator: 'AccountId', + own: 'RKT', + others: 'Vec<(AccountId, RKT)>', + reporters: 'Vec', + payout: 'RKT' + }, - TreasuryProposal: { - proposer: 'AccountId', - beneficiary: 'AccountId', - ringValue: 'Balance', - ktonValue: 'Balance', - ringBond: 'Balance', - ktonBond: 'Balance' - }, + TreasuryProposal: { + proposer: 'AccountId', + beneficiary: 'AccountId', + ringValue: 'Balance', + ktonValue: 'Balance', + ringBond: 'Balance', + ktonBond: 'Balance' + }, - MappedRing: 'u128', + MappedRing: 'u128', - EthereumTransactionIndex: '(H256, u64)', - EthereumBlockNumber: 'u64', - EthereumHeader: { - parent_hash: 'H256', - timestamp: 'u64', - number: 'EthereumBlockNumber', - author: 'EthereumAddress', - transactions_root: 'H256', - uncles_hash: 'H256', - extra_data: 'Bytes', - state_root: 'H256', - receipts_root: 'H256', - log_bloom: 'Bloom', - gas_used: 'U256', - gas_limit: 'U256', - difficulty: 'U256', - seal: 'Vec', - hash: 'Option' - }, - EthereumAddress: 'H160', - Bloom: '[u8; 256; Bloom]', - H128: '[u8; 16; H128]', - EthashProof: { - dagNodes: '(H512, H512)', - proof: 'Vec' - }, - EthereumReceipt: { - gasUsed: 'U256', - logBloom: 'Bloom', - logs: 'Vec', - outcome: 'TransactionOutcome' - }, + EthereumTransactionIndex: '(H256, u64)', + EthereumBlockNumber: 'u64', + EthereumHeader: { + parent_hash: 'H256', + timestamp: 'u64', + number: 'EthereumBlockNumber', + author: 'EthereumAddress', + transactions_root: 'H256', + uncles_hash: 'H256', + extra_data: 'Bytes', + state_root: 'H256', + receipts_root: 'H256', + log_bloom: 'Bloom', + gas_used: 'U256', + gas_limit: 'U256', + difficulty: 'U256', + seal: 'Vec', + hash: 'Option' + }, + EthereumAddress: 'H160', + Bloom: '[u8; 256; Bloom]', + H128: '[u8; 16; H128]', + EthashProof: { + dagNodes: '(H512, H512)', + proof: 'Vec' + }, + EthereumReceipt: { + gasUsed: 'U256', + logBloom: 'Bloom', + logs: 'Vec', + outcome: 'TransactionOutcome' + }, - LogEntry: {}, - TransactionOutcome: {}, + LogEntry: {}, + TransactionOutcome: {}, - EthereumNetworkType: { - _enum: { - Mainnet: null, - Ropsten: null - } - }, - RedeemFor: { - _enum: { - Token: null, - Deposit: null - } - }, - EthereumReceiptProof: { - index: 'u64', - proof: 'Bytes', - headerHash: 'H256' - }, - EthereumReceiptProofThing: '(EthereumHeader, EthereumReceiptProof, MMRProof)', - MMRProof: { - memberLeafIndex: 'u64', - lastLeafIndex: 'u64', - proof: 'Vec' - }, - EthereumRelayHeaderParcel: { - header: 'EthereumHeader', - mmrRoot: 'H256' - }, - EthereumRelayProofs: { - ethashProof: 'Vec', - mmrProof: 'Vec' - }, + EthereumNetworkType: { + _enum: { + Mainnet: null, + Ropsten: null + } + }, + RedeemFor: { + _enum: { + Token: null, + Deposit: null + } + }, + EthereumReceiptProof: { + index: 'u64', + proof: 'Bytes', + headerHash: 'H256' + }, + EthereumReceiptProofThing: '(EthereumHeader, EthereumReceiptProof, MMRProof)', + MMRProof: { + memberLeafIndex: 'u64', + lastLeafIndex: 'u64', + proof: 'Vec' + }, + EthereumRelayHeaderParcel: { + header: 'EthereumHeader', + mmrRoot: 'H256' + }, + EthereumRelayProofs: { + ethashProof: 'Vec', + mmrProof: 'Vec' + }, - OtherSignature: { - _enum: { - Eth: 'EcdsaSignature', - Tron: 'EcdsaSignature' - } - }, - EcdsaSignature: '[u8; 65; EcdsaSignature]', - TronAddress: 'EthereumAddress', - OtherAddress: { - _enum: { - Eth: 'EthereumAddress', - Tron: 'TronAddress' - } - }, - AddressT: '[u8; 20; AddressT]', + OtherSignature: { + _enum: { + Eth: 'EcdsaSignature', + Tron: 'EcdsaSignature' + } + }, + EcdsaSignature: '[u8; 65; EcdsaSignature]', + TronAddress: 'EthereumAddress', + OtherAddress: { + _enum: { + Eth: 'EthereumAddress', + Tron: 'TronAddress' + } + }, + AddressT: '[u8; 20; AddressT]', - MerkleMountainRangeRootLog: { - prefix: '[u8; 4; Prefix]', - mmrRoot: 'Hash' - }, + MerkleMountainRangeRootLog: { + prefix: '[u8; 4; Prefix]', + mmrRoot: 'Hash' + }, - AccountInfo: { - nonce: 'Index', - refcount: 'RefCount', - data: 'AccountData' - }, - ProxyDefinition: { - delegate: 'AccountId', - proxyType: 'ProxyType', - delay: 'BlockNumber' - }, - ProxyType: { - _enum: { - Any: null, - NonTransfer: null, - Governance: null, - Staking: null, - IdentityJudgement: null, - EthereumBridge: null + AccountInfo: { + nonce: 'Index', + refcount: 'RefCount', + data: 'AccountData' + }, + ProxyDefinition: { + delegate: 'AccountId', + proxyType: 'ProxyType', + delay: 'BlockNumber' + }, + ProxyType: { + _enum: { + Any: null, + NonTransfer: null, + Governance: null, + Staking: null, + IdentityJudgement: null, + EthereumBridge: null + } + }, + ProxyAnnouncement: { + real: 'AccountId', + callHash: 'Hash', + height: 'BlockNumber' + }, + Announcement: 'ProxyAnnouncement', + RelayHeaderId: 'EthereumBlockNumber', + RelayHeaderParcel: 'EthereumRelayHeaderParcel', + RelayProofs: 'EthereumRelayProofs', + RelayAffirmationId: { + relayHeaderId: 'EthereumBlockNumber', + round: 'u32', + index: 'u32' + }, + RelayAffirmationT: { + relayer: 'AccountId', + relayHeaderParcels: 'EthereumRelayHeaderParcel', + bond: 'Balance', + maybeExtendedRelayAffirmationId: 'Option', + verified: 'bool' + }, + RelayVotingState: { + ayes: 'Vec', + nays: 'Vec' + }, + PowerOf: { + power: 'Power' + } + } } - }, - ProxyAnnouncement: { - real: 'AccountId', - callHash: 'Hash', - height: 'BlockNumber' - }, - Announcement: 'ProxyAnnouncement', - RelayHeaderId: 'EthereumBlockNumber', - RelayHeaderParcel: 'EthereumRelayHeaderParcel', - RelayProofs: 'EthereumRelayProofs', - RelayAffirmationId: { - relayHeaderId: 'EthereumBlockNumber', - round: 'u32', - index: 'u32' - }, - RelayAffirmationT: { - relayer: 'AccountId', - relayHeaderParcels: 'EthereumRelayHeaderParcel', - bond: 'Balance', - maybeExtendedRelayAffirmationId: 'Option', - verified: 'bool' - }, - RelayVotingState: { - ayes: 'Vec', - nays: 'Vec' - }, - PowerOf: { - power: 'Power' - } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/datahighway.ts b/packages/apps-config/src/api/spec/datahighway.ts index 762a855c4399..6553b36bb078 100644 --- a/packages/apps-config/src/api/spec/datahighway.ts +++ b/packages/apps-config/src/api/spec/datahighway.ts @@ -1,8 +1,22 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId' + +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/dock.ts b/packages/apps-config/src/api/spec/dock.ts index eb0585ced769..25d07b155230 100644 --- a/packages/apps-config/src/api/spec/dock.ts +++ b/packages/apps-config/src/api/spec/dock.ts @@ -1,126 +1,138 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId', - Keys: 'SessionKeys2', - Did: '[u8;32]', - Bytes32: { - value: '[u8;32]' - }, - Bytes33: { - value: '[u8;33]' - }, - Bytes64: { - value: '[u8;64]' - }, - Bytes65: { - value: '[u8;65]' - }, - PublicKey: { - _enum: { - Sr25519: 'Bytes32', - Ed25519: 'Bytes32', - Secp256k1: 'Bytes33' - } - }, - DidSignature: { - _enum: { - Sr25519: 'Bytes64', - Ed25519: 'Bytes64', - Secp256k1: 'Bytes65' - } - }, - KeyDetail: { - controller: 'Did', - public_key: 'PublicKey' - }, - KeyUpdate: { - did: 'Did', - public_key: 'PublicKey', - controller: 'Option', - last_modified_in_block: 'BlockNumber' - }, - DidRemoval: { - did: 'Did', - last_modified_in_block: 'BlockNumber' - }, - RegistryId: '[u8;32]', - RevokeId: '[u8;32]', - Registry: { - policy: 'Policy', - add_only: 'bool' - }, - Revoke: { - registry_id: 'RegistryId', - revoke_ids: 'BTreeSet', - last_modified: 'BlockNumber' - }, - UnRevoke: { - registry_id: 'RegistryId', - revoke_ids: 'BTreeSet', - last_modified: 'BlockNumber' - }, - RemoveRegistry: { - registry_id: 'RegistryId', - last_modified: 'BlockNumber' - }, - PAuth: 'BTreeMap', - Policy: { - _enum: { - OneOf: 'BTreeSet' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId', + Keys: 'SessionKeys2', + Did: '[u8;32]', + Bytes32: { + value: '[u8;32]' + }, + Bytes33: { + value: '[u8;33]' + }, + Bytes64: { + value: '[u8;64]' + }, + Bytes65: { + value: '[u8;65]' + }, + PublicKey: { + _enum: { + Sr25519: 'Bytes32', + Ed25519: 'Bytes32', + Secp256k1: 'Bytes33' + } + }, + DidSignature: { + _enum: { + Sr25519: 'Bytes64', + Ed25519: 'Bytes64', + Secp256k1: 'Bytes65' + } + }, + KeyDetail: { + controller: 'Did', + public_key: 'PublicKey' + }, + KeyUpdate: { + did: 'Did', + public_key: 'PublicKey', + controller: 'Option', + last_modified_in_block: 'BlockNumber' + }, + DidRemoval: { + did: 'Did', + last_modified_in_block: 'BlockNumber' + }, + RegistryId: '[u8;32]', + RevokeId: '[u8;32]', + Registry: { + policy: 'Policy', + add_only: 'bool' + }, + Revoke: { + registry_id: 'RegistryId', + revoke_ids: 'BTreeSet', + last_modified: 'BlockNumber' + }, + UnRevoke: { + registry_id: 'RegistryId', + revoke_ids: 'BTreeSet', + last_modified: 'BlockNumber' + }, + RemoveRegistry: { + registry_id: 'RegistryId', + last_modified: 'BlockNumber' + }, + PAuth: 'BTreeMap', + Policy: { + _enum: { + OneOf: 'BTreeSet' + } + }, + BlobId: '[u8;32]', + Blob: { + id: 'BlobId', + blob: 'Vec', + author: 'Did' + }, + EpochNo: 'u32', + EpochLen: 'u32', + SlotNo: 'u64', + Balance: 'u64', + EpochDetail: { + validator_count: 'u8', + starting_slot: 'SlotNo', + expected_ending_slot: 'SlotNo', + ending_slot: 'Option', + total_emission: 'Option', + emission_for_treasury: 'Option', + emission_for_validators: 'Option' + }, + ValidatorStatsPerEpoch: { + block_count: 'EpochLen', + locked_reward: 'Option', + unlocked_reward: 'Option' + }, + Payload: { + proposal: 'Vec', + round_no: 'u64' + }, + Membership: { + members: 'BTreeSet', + vote_requirement: 'u64' + }, + PMAuth: 'BTreeMap', + Bonus: { + swap_bonuses: 'Vec<(Balance, BlockNumber)>', + vesting_bonuses: 'Vec<(Balance, Balance, BlockNumber)>' + }, + StateChange: { + _enum: { + KeyUpdate: 'KeyUpdate', + DidRemoval: 'DidRemoval', + Revoke: 'Revoke', + UnRevoke: 'UnRevoke', + RemoveRegistry: 'RemoveRegistry', + Blob: 'Blob', + MasterVote: 'Payload' + } + } + } } - }, - BlobId: '[u8;32]', - Blob: { - id: 'BlobId', - blob: 'Vec', - author: 'Did' - }, - EpochNo: 'u32', - EpochLen: 'u32', - SlotNo: 'u64', - Balance: 'u64', - EpochDetail: { - validator_count: 'u8', - starting_slot: 'SlotNo', - expected_ending_slot: 'SlotNo', - ending_slot: 'Option', - total_emission: 'Option', - emission_for_treasury: 'Option', - emission_for_validators: 'Option' - }, - ValidatorStatsPerEpoch: { - block_count: 'EpochLen', - locked_reward: 'Option', - unlocked_reward: 'Option' - }, - Payload: { - proposal: 'Vec', - round_no: 'u64' - }, - Membership: { - members: 'BTreeSet', - vote_requirement: 'u64' - }, - PMAuth: 'BTreeMap', - Bonus: { - swap_bonuses: 'Vec<(Balance, BlockNumber)>', - vesting_bonuses: 'Vec<(Balance, Balance, BlockNumber)>' - }, - StateChange: { - _enum: { - KeyUpdate: 'KeyUpdate', - DidRemoval: 'DidRemoval', - Revoke: 'Revoke', - UnRevoke: 'UnRevoke', - RemoveRegistry: 'RemoveRegistry', - Blob: 'Blob', - MasterVote: 'Payload' - } - } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/dotmog.ts b/packages/apps-config/src/api/spec/dotmog.ts index 4d93fbfed498..161d0df03362 100644 --- a/packages/apps-config/src/api/spec/dotmog.ts +++ b/packages/apps-config/src/api/spec/dotmog.ts @@ -1,40 +1,52 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'IndicesLookupSource', - LookupSource: 'IndicesLookupSource', - MogwaiStruct: { - id: 'Hash', - dna: 'Hash', - genesis: 'BlockNumber', - price: 'Balance', - gen: 'u64' - }, - MogwaiBios: { - mogwai_id: 'Hash', - state: 'u32', - metaxy: 'Vec<[u8;16]>', - intrinsic: 'Balance', - level: 'u8', - phases: 'Vec', - adaptations: 'Vec' - }, - GameEvent: { - id: 'Hash', - begin: 'BlockNumber', - duration: 'u16', - event_type: 'GameEventType', - hashes: 'Vec', - value: 'u64' - }, - GameEventType: { - _enum: [ - 'Default', - 'Hatch' - ] - } +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'IndicesLookupSource', + LookupSource: 'IndicesLookupSource', + MogwaiStruct: { + id: 'Hash', + dna: 'Hash', + genesis: 'BlockNumber', + price: 'Balance', + gen: 'u64' + }, + MogwaiBios: { + mogwai_id: 'Hash', + state: 'u32', + metaxy: 'Vec<[u8;16]>', + intrinsic: 'Balance', + level: 'u8', + phases: 'Vec', + adaptations: 'Vec' + }, + GameEvent: { + id: 'Hash', + begin: 'BlockNumber', + duration: 'u16', + event_type: 'GameEventType', + hashes: 'Vec', + value: 'u64' + }, + GameEventType: { + _enum: [ + 'Default', + 'Hatch' + ] + } + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/dusty.ts b/packages/apps-config/src/api/spec/dusty.ts index beb2a8b5a46f..d81434d20bdb 100644 --- a/packages/apps-config/src/api/spec/dusty.ts +++ b/packages/apps-config/src/api/spec/dusty.ts @@ -1,83 +1,98 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -export default { - AuthorityId: 'AccountId', - AuthorityVote: 'u32', - ChallengeGameOf: { - challenges: 'Vec', - createdBlock: 'BlockNumber', - decision: 'Decision', - propertyHash: 'Hash' - }, - Claim: { - amount: 'u128', - approve: 'BTreeSet', - complete: 'bool', - decline: 'BTreeSet', - params: 'Lockdrop' - }, - ClaimId: 'H256', - ClaimVote: { - approve: 'bool', - authority: 'u16', - claim_id: 'ClaimId' - }, - Decision: { - _enum: ['Undecided', 'True', 'False'] - }, - DollarRate: 'u128', - EraIndex: 'u32', - EraStakingPoints: { - individual: 'BTreeMap', - total: 'Balance' - }, - Keys: 'SessionKeys2', - Lockdrop: { - duration: 'u64', - public_key: '[u8; 33]', - transaction_hash: 'H256', - type: 'u8', - value: 'u128' - }, - Parameters: { - canBeNominated: 'bool', - optionExpired: 'u128', - optionP: 'u32' - }, - PredicateContractOf: { - inputs: 'Vec', - predicateHash: 'Hash' - }, - PredicateHash: 'Hash', - PrefabOvmModule: { - code: 'Vec', - scheduleVersion: 'u32' - }, - Property: { - inputs: 'Vec>', - predicateAddress: 'AccountId' - }, - PropertyOf: { - inputs: 'Vec>', - predicateAddress: 'AccountId' - }, - Schedule: { - putCodePerByteCost: 'Weight', - version: 'u32' - }, - StakingParameters: { - canBeNominated: 'bool', - optionExpired: 'u128', - optionP: 'u32' - }, - TickerRate: { - authority: 'u16', - btc: 'u128', - eth: 'u128' - }, - VoteCounts: { - bad: 'u32', - good: 'u32' - } +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order +/* eslint-disable sort-keys */ + +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + AuthorityId: 'AccountId', + AuthorityVote: 'u32', + ChallengeGameOf: { + challenges: 'Vec', + createdBlock: 'BlockNumber', + decision: 'Decision', + propertyHash: 'Hash' + }, + Claim: { + amount: 'u128', + approve: 'BTreeSet', + complete: 'bool', + decline: 'BTreeSet', + params: 'Lockdrop' + }, + ClaimId: 'H256', + ClaimVote: { + approve: 'bool', + authority: 'u16', + claim_id: 'ClaimId' + }, + Decision: { + _enum: ['Undecided', 'True', 'False'] + }, + DollarRate: 'u128', + EraIndex: 'u32', + EraStakingPoints: { + individual: 'BTreeMap', + total: 'Balance' + }, + Keys: 'SessionKeys2', + Lockdrop: { + duration: 'u64', + public_key: '[u8; 33]', + transaction_hash: 'H256', + type: 'u8', + value: 'u128' + }, + Parameters: { + canBeNominated: 'bool', + optionExpired: 'u128', + optionP: 'u32' + }, + PredicateContractOf: { + inputs: 'Vec', + predicateHash: 'Hash' + }, + PredicateHash: 'Hash', + PrefabOvmModule: { + code: 'Vec', + scheduleVersion: 'u32' + }, + Property: { + inputs: 'Vec>', + predicateAddress: 'AccountId' + }, + PropertyOf: { + inputs: 'Vec>', + predicateAddress: 'AccountId' + }, + Schedule: { + putCodePerByteCost: 'Weight', + version: 'u32' + }, + StakingParameters: { + canBeNominated: 'bool', + optionExpired: 'u128', + optionP: 'u32' + }, + TickerRate: { + authority: 'u16', + btc: 'u128', + eth: 'u128' + }, + VoteCounts: { + bad: 'u32', + good: 'u32' + } + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/specVersioned/edgeware.ts b/packages/apps-config/src/api/spec/edgeware.ts similarity index 100% rename from packages/apps-config/src/api/specVersioned/edgeware.ts rename to packages/apps-config/src/api/spec/edgeware.ts diff --git a/packages/apps-config/src/api/spec/encointer-node-notee.ts b/packages/apps-config/src/api/spec/encointer-node-notee.ts index 92f38abd5e8b..ea5da8fdd129 100644 --- a/packages/apps-config/src/api/spec/encointer-node-notee.ts +++ b/packages/apps-config/src/api/spec/encointer-node-notee.ts @@ -1,71 +1,82 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -/* eslint-disable camelcase */ -export default { - Address: 'MultiAddress', - LookupSource: 'MultiAddress', - CeremonyPhaseType: { - _enum: [ - 'Registering', - 'Assigning', - 'Attesting' - ] - }, - CeremonyIndexType: 'u32', - ParticipantIndexType: 'u64', - MeetupIndexType: 'u64', - AttestationIndexType: 'u64', - CurrencyIdentifier: 'Hash', - BalanceType: 'i128', - BalanceEntry: { - principal: 'i128', - last_update: 'BlockNumber' - }, - CurrencyCeremony: { - cid: 'CurrencyIdentifier', - cindex: 'CeremonyIndexType' - }, - Location: { - lat: 'i64', - lon: 'i64' - }, - Reputation: { - _enum: [ - 'Unverified', - 'UnverifiedReputable', - 'VerifiedUnlinked', - 'VerifiedLinked' - ] - }, - CurrencyPropertiesType: { - name_utf8: 'Text', - demurrage_per_block: 'i128' - }, - ClaimOfAttendance: { - claimant_public: 'AccountId', - ceremony_index: 'CeremonyIndexType', - currency_identifier: 'CurrencyIdentifier', - meetup_index: 'MeetupIndexType', - location: 'Location', - timestamp: 'Moment', - number_of_participants_confirmed: 'u32' - }, - Attestation: { - claim: 'ClaimOfAttendance', - signature: 'Signature', - public: 'AccountId' - }, - ProofOfAttendance: { - prover_public: 'AccountId', - ceremony_index: 'CeremonyIndexType', - currency_identifier: 'CurrencyIdentifier', - attendee_public: 'AccountId', - attendee_signature: 'Signature' - }, - ShopIdentifier: 'Text', - ArticleIdentifier: 'Text' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'MultiAddress', + LookupSource: 'MultiAddress', + CeremonyPhaseType: { + _enum: [ + 'Registering', + 'Assigning', + 'Attesting' + ] + }, + CeremonyIndexType: 'u32', + ParticipantIndexType: 'u64', + MeetupIndexType: 'u64', + AttestationIndexType: 'u64', + CurrencyIdentifier: 'Hash', + BalanceType: 'i128', + BalanceEntry: { + principal: 'i128', + last_update: 'BlockNumber' + }, + CurrencyCeremony: { + cid: 'CurrencyIdentifier', + cindex: 'CeremonyIndexType' + }, + Location: { + lat: 'i64', + lon: 'i64' + }, + Reputation: { + _enum: [ + 'Unverified', + 'UnverifiedReputable', + 'VerifiedUnlinked', + 'VerifiedLinked' + ] + }, + CurrencyPropertiesType: { + name_utf8: 'Text', + demurrage_per_block: 'i128' + }, + ClaimOfAttendance: { + claimant_public: 'AccountId', + ceremony_index: 'CeremonyIndexType', + currency_identifier: 'CurrencyIdentifier', + meetup_index: 'MeetupIndexType', + location: 'Location', + timestamp: 'Moment', + number_of_participants_confirmed: 'u32' + }, + Attestation: { + claim: 'ClaimOfAttendance', + signature: 'Signature', + public: 'AccountId' + }, + ProofOfAttendance: { + prover_public: 'AccountId', + ceremony_index: 'CeremonyIndexType', + currency_identifier: 'CurrencyIdentifier', + attendee_public: 'AccountId', + attendee_signature: 'Signature' + }, + ShopIdentifier: 'Text', + ArticleIdentifier: 'Text' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/encointer-node-teeproxy.ts b/packages/apps-config/src/api/spec/encointer-node-teeproxy.ts index c22c859ed81a..33d7d1a5c55a 100644 --- a/packages/apps-config/src/api/spec/encointer-node-teeproxy.ts +++ b/packages/apps-config/src/api/spec/encointer-node-teeproxy.ts @@ -1,43 +1,54 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -/* eslint-disable camelcase */ -export default { - Address: 'MultiAddress', - LookupSource: 'MultiAddress', - CeremonyPhaseType: { - _enum: [ - 'Registering', - 'Assigning', - 'Attesting' - ] - }, - CeremonyIndexType: 'u32', - CurrencyIdentifier: 'Hash', - CurrencyCeremony: { - cid: 'CurrencyIdentifier', - cindex: 'CeremonyIndexType' - }, - Location: { - lat: 'i64', - lon: 'i64' - }, - CurrencyPropertiesType: { - name_utf8: 'Text', - demurrage_per_block: 'i128' - }, - ShardIdentifier: 'Hash', - Request: { - shard: 'ShardIdentifier', - cyphertext: 'Vec' - }, - Enclave: { - pubkey: 'AccountId', - mrenclave: 'Hash', - timestamp: 'u64', - url: 'Text' - } +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'MultiAddress', + LookupSource: 'MultiAddress', + CeremonyPhaseType: { + _enum: [ + 'Registering', + 'Assigning', + 'Attesting' + ] + }, + CeremonyIndexType: 'u32', + CurrencyIdentifier: 'Hash', + CurrencyCeremony: { + cid: 'CurrencyIdentifier', + cindex: 'CeremonyIndexType' + }, + Location: { + lat: 'i64', + lon: 'i64' + }, + CurrencyPropertiesType: { + name_utf8: 'Text', + demurrage_per_block: 'i128' + }, + ShardIdentifier: 'Hash', + Request: { + shard: 'ShardIdentifier', + cyphertext: 'Vec' + }, + Enclave: { + pubkey: 'AccountId', + mrenclave: 'Hash', + timestamp: 'u64', + url: 'Text' + } + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/encointer-para.ts b/packages/apps-config/src/api/spec/encointer-para.ts index 16bafa4bc7e6..e251edd8e41a 100644 --- a/packages/apps-config/src/api/spec/encointer-para.ts +++ b/packages/apps-config/src/api/spec/encointer-para.ts @@ -1,71 +1,82 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -/* eslint-disable camelcase */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId', - CeremonyPhaseType: { - _enum: [ - 'Registering', - 'Assigning', - 'Attesting' - ] - }, - CeremonyIndexType: 'u32', - ParticipantIndexType: 'u64', - MeetupIndexType: 'u64', - AttestationIndexType: 'u64', - CurrencyIdentifier: 'Hash', - BalanceType: 'i128', - BalanceEntry: { - principal: 'i128', - last_update: 'BlockNumber' - }, - CurrencyCeremony: { - cid: 'CurrencyIdentifier', - cindex: 'CeremonyIndexType' - }, - Location: { - lat: 'i64', - lon: 'i64' - }, - Reputation: { - _enum: [ - 'Unverified', - 'UnverifiedReputable', - 'VerifiedUnlinked', - 'VerifiedLinked' - ] - }, - CurrencyPropertiesType: { - name_utf8: 'Text', - demurrage_per_block: 'i128' - }, - ClaimOfAttendance: { - claimant_public: 'AccountId', - ceremony_index: 'CeremonyIndexType', - currency_identifier: 'CurrencyIdentifier', - meetup_index: 'MeetupIndexType', - location: 'Location', - timestamp: 'Moment', - number_of_participants_confirmed: 'u32' - }, - Attestation: { - claim: 'ClaimOfAttendance', - signature: 'Signature', - public: 'AccountId' - }, - ProofOfAttendance: { - prover_public: 'AccountId', - ceremony_index: 'CeremonyIndexType', - currency_identifier: 'CurrencyIdentifier', - attendee_public: 'AccountId', - attendee_signature: 'Signature' - }, - ShopIdentifier: 'Text', - ArticleIdentifier: 'Text' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId', + CeremonyPhaseType: { + _enum: [ + 'Registering', + 'Assigning', + 'Attesting' + ] + }, + CeremonyIndexType: 'u32', + ParticipantIndexType: 'u64', + MeetupIndexType: 'u64', + AttestationIndexType: 'u64', + CurrencyIdentifier: 'Hash', + BalanceType: 'i128', + BalanceEntry: { + principal: 'i128', + last_update: 'BlockNumber' + }, + CurrencyCeremony: { + cid: 'CurrencyIdentifier', + cindex: 'CeremonyIndexType' + }, + Location: { + lat: 'i64', + lon: 'i64' + }, + Reputation: { + _enum: [ + 'Unverified', + 'UnverifiedReputable', + 'VerifiedUnlinked', + 'VerifiedLinked' + ] + }, + CurrencyPropertiesType: { + name_utf8: 'Text', + demurrage_per_block: 'i128' + }, + ClaimOfAttendance: { + claimant_public: 'AccountId', + ceremony_index: 'CeremonyIndexType', + currency_identifier: 'CurrencyIdentifier', + meetup_index: 'MeetupIndexType', + location: 'Location', + timestamp: 'Moment', + number_of_participants_confirmed: 'u32' + }, + Attestation: { + claim: 'ClaimOfAttendance', + signature: 'Signature', + public: 'AccountId' + }, + ProofOfAttendance: { + prover_public: 'AccountId', + ceremony_index: 'CeremonyIndexType', + currency_identifier: 'CurrencyIdentifier', + attendee_public: 'AccountId', + attendee_signature: 'Signature' + }, + ShopIdentifier: 'Text', + ArticleIdentifier: 'Text' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/equilibrium.ts b/packages/apps-config/src/api/spec/equilibrium.ts index ee6bc8322425..795477355cae 100644 --- a/packages/apps-config/src/api/spec/equilibrium.ts +++ b/packages/apps-config/src/api/spec/equilibrium.ts @@ -1,98 +1,292 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { ApiInterfaceRx } from '@polkadot/api/types'; +import type { Enum, Struct } from '@polkadot/types'; +import type { Option } from '@polkadot/types/codec'; +import type { AccountId, AccountIndex, AccountInfo, Address, Balance, BlockNumber, Index } from '@polkadot/types/interfaces'; +import type { OverrideBundleDefinition } from '@polkadot/types/types'; +import type { Observable } from '@polkadot/x-rxjs'; + +import { memo } from '@polkadot/api-derive/util/memo'; +import { combineLatest, of } from '@polkadot/x-rxjs'; +import { map, switchMap } from '@polkadot/x-rxjs/operators'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - Balance: 'u64', - BalanceOf: 'Balance', - BalancesAggregate: { - total_issuance: 'Balance', - total_debt: 'Balance' - }, - BlockNumber: 'u64', - ChainId: 'u8', - Currency: { - _enum: ['Unknown', 'Usd', 'EQ', 'Eth', 'Btc', 'Eos', 'Dot'] - }, - DataPoint: { - price: 'u64', - account_id: 'AccountId', - block_number: 'BlockNumber', - timestamp: 'u64' - }, - DepositNonce: 'u64', - FixedI64: 'i64', - Keys: 'SessionKeys3', - LookupSource: 'AccountId', - OperationRequest: { - account: 'AccountId', - authority_index: 'AuthIndex', - validators_len: 'u32', - block_num: 'BlockNumber' - }, - PricePayload: 'Data', - PricePeriod: { - _enum: ['Min', 'TenMin', 'Hour', 'FourHour', 'Day'] - }, - PricePoint: { - block_number: 'BlockNumber', - timestamp: 'u64', - price: 'u64', - data_points: 'Vec' - }, - ProposalStatus: { - _enum: [ - 'Initiated', - 'Approved', - 'Rejected' - ] - }, - ProposalVotes: { - votes_for: 'Vec', - votes_against: 'Vec', - status: 'ProposalStatus', - expiry: 'BlockNumber' - }, - ReinitRequest: { - account: 'AccountId', - authority_index: 'AuthIndex', - validators_len: 'u32', - block_num: 'BlockNumber' - }, - ResourceId: '[u8; 32]', - SignedBalance: { - _enum: { - Positive: 'Balance', - Negative: 'Balance' +interface VestingInfo extends Struct { + readonly locked: Balance; + readonly perBlock: Balance; + readonly startingBlock: BlockNumber; +} + +interface SignedBalance extends Enum { + readonly isPositive: boolean; + readonly asPositive: Balance; + readonly isNegative: boolean; + readonly asNegative: Balance; +} + +export interface EQDeriveBalancesAll { + additional: []; // fix until vesting instances are supported in api-derive + freeBalance: Balance; + reservedBalance: Balance; + vestingLocked: Balance; + lockedBalance: Balance; + accountId: AccountId; + accountNonce: Index; + lockedBreakdown: unknown[]; +} + +type Result = [Balance, Balance, Balance, Index]; + +type RawResult = [ + SignedBalance, + Option, + Option, + AccountInfo +]; + +type EQDeriveBalancesAccountQuery = ( + address: AccountIndex | AccountId | Address | string +) => Observable<{ accountNonce: Index; }>; + +type EQDeriveBalancesAllQuery = ( + address: AccountIndex | AccountId | Address | string +) => Observable; + +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + Balance: 'u64', + BalanceOf: 'Balance', + BalancesAggregate: { + total_issuance: 'Balance', + total_debt: 'Balance' + }, + BlockNumber: 'u64', + ChainId: 'u8', + Currency: { + _enum: ['Unknown', 'Usd', 'EQ', 'Eth', 'Btc', 'Eos', 'Dot'] + }, + DataPoint: { + price: 'u64', + account_id: 'AccountId', + block_number: 'BlockNumber', + timestamp: 'u64' + }, + DepositNonce: 'u64', + FixedI64: 'i64', + Keys: 'SessionKeys3', + LookupSource: 'AccountId', + OperationRequest: { + account: 'AccountId', + authority_index: 'AuthIndex', + validators_len: 'u32', + block_num: 'BlockNumber' + }, + PricePayload: 'Data', + PricePeriod: { + _enum: ['Min', 'TenMin', 'Hour', 'FourHour', 'Day'] + }, + PricePoint: { + block_number: 'BlockNumber', + timestamp: 'u64', + price: 'u64', + data_points: 'Vec' + }, + ProposalStatus: { + _enum: [ + 'Initiated', + 'Approved', + 'Rejected' + ] + }, + ProposalVotes: { + votes_for: 'Vec', + votes_against: 'Vec', + status: 'ProposalStatus', + expiry: 'BlockNumber' + }, + ReinitRequest: { + account: 'AccountId', + authority_index: 'AuthIndex', + validators_len: 'u32', + block_num: 'BlockNumber' + }, + ResourceId: '[u8; 32]', + SignedBalance: { + _enum: { + Positive: 'Balance', + Negative: 'Balance' + } + }, + SubAccType: { + _enum: ['Bailsman', 'Borrower', 'Lender'] + }, + TotalAggregates: { + collateral: 'Balance', + debt: 'Balance' + }, + TransferReason: { + _enum: [ + 'Common', + 'InterestFee', + 'MarginCall', + 'BailsmenRedistribution', + 'TreasuryEqBuyout', + 'TreasuryBuyEq', + 'Subaccount' + ] + }, + UserGroup: { + _enum: ['Unknown', 'Balances', 'Bailsmen', 'Borrowers', 'Lenders'] + }, + VestingInfo: { + locked: 'Balance', + perBlock: 'Balance', + startingBlock: 'BlockNumber' + } + } + } + ], + derives: { + // TODO derive.democracy.locks + // TODO derice.staking.account + balances: { + account: ( + // Compatibility with calc tx fee + instanceId: string, + api: ApiInterfaceRx + ): EQDeriveBalancesAccountQuery => + memo( + instanceId, + (address: AccountId | AccountIndex | Address | string) => + api.derive.accounts.accountId(address).pipe( + switchMap( + (accountId): Observable<[AccountId, [Index]]> => + accountId + ? combineLatest([ + of(accountId), + api + .queryMulti([ + [api.query.system.account, accountId] + ]) + .pipe( + map((raw): [Index] => { + if (raw.length < 1) { + throw new Error('Data expected'); + } + + const data = raw as [AccountInfo]; + + return [data[0].nonce]; + }) + ) + ]) + : of([ + api.registry.createType('AccountId'), + [api.registry.createType('Index')] + ]) + ), + map(([, [accountNonce]]) => ({ accountNonce })) + ) + ), + all: ( + // Compatibility for account balance in explorer + instanceId: string, + api: ApiInterfaceRx + ): EQDeriveBalancesAllQuery => + memo( + instanceId, + (address: AccountIndex | AccountId | Address | string) => + api.derive.accounts.accountId(address).pipe( + switchMap( + (accountId): Observable<[AccountId, Result]> => + accountId + ? combineLatest([ + of(accountId), + api + .queryMulti([ + [api.query.balances.account, [accountId, 'EQ']], + [api.query.eqVesting.vested, accountId], + [api.query.eqVesting.vesting, accountId], + [api.query.system.account, accountId] + ]) + .pipe( + map( + (raw): Result => { + if (raw.length < 4) { + throw new Error('4 members expected'); + } + + const res = raw as RawResult; + const freeBalance = res[0].asPositive; + + let reservedBalance = api.registry.createType( + 'Balance' + ); + + let vestingLocked = api.registry.createType( + 'Balance' + ); + + if (res[1].isSome && res[2].isSome) { + const vested = res[1].unwrap(); + const info = res[2].unwrap(); + + vestingLocked = info.locked; + + reservedBalance = api.registry.createType( + 'Balance', + vestingLocked.sub(vested) + ); + } + + return [ + freeBalance, + reservedBalance, + vestingLocked, + res[3].nonce + ]; + } + ) + ) + ]) + : of([ + api.registry.createType('AccountId'), + [ + api.registry.createType('Balance'), + api.registry.createType('Balance'), + api.registry.createType('Balance'), + api.registry.createType('Index') + ] + ]) + ), + map( + ([ + accountId, + [freeBalance, reservedBalance, vestingLocked, accountNonce] + ]): EQDeriveBalancesAll => ({ + accountId, + accountNonce, + additional: [], + freeBalance, + lockedBalance: vestingLocked, + lockedBreakdown: [], + reservedBalance, + vestingLocked + }) + ) + ) + ) } - }, - SubAccType: { - _enum: ['Bailsman', 'Borrower', 'Lender'] - }, - TotalAggregates: { - collateral: 'Balance', - debt: 'Balance' - }, - TransferReason: { - _enum: [ - 'Common', - 'InterestFee', - 'MarginCall', - 'BailsmenRedistribution', - 'TreasuryEqBuyout', - 'TreasuryBuyEq', - 'Subaccount' - ] - }, - UserGroup: { - _enum: ['Unknown', 'Balances', 'Bailsmen', 'Borrowers', 'Lenders'] - }, - VestingInfo: { - locked: 'Balance', - perBlock: 'Balance', - startingBlock: 'BlockNumber' } }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/hanonycash.ts b/packages/apps-config/src/api/spec/hanonycash.ts index 9d4fed1b2500..037d8ab30eff 100644 --- a/packages/apps-config/src/api/spec/hanonycash.ts +++ b/packages/apps-config/src/api/spec/hanonycash.ts @@ -1,19 +1,31 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Difficulty: 'U256', - DifficultyAndTimestamp: { - difficulty: 'Difficulty', - timestamp: 'Moment' - }, - Era: { - genesisBlockHash: 'H256', - finalBlockHash: 'H256', - finalStateRoot: 'H256' - }, - RefCount: 'u8' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Difficulty: 'U256', + DifficultyAndTimestamp: { + difficulty: 'Difficulty', + timestamp: 'Moment' + }, + Era: { + genesisBlockHash: 'H256', + finalBlockHash: 'H256', + finalStateRoot: 'H256' + }, + RefCount: 'u8' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/hydrate.ts b/packages/apps-config/src/api/spec/hydrate.ts index 26ce6d06f2a4..c5dc1e04be80 100644 --- a/packages/apps-config/src/api/spec/hydrate.ts +++ b/packages/apps-config/src/api/spec/hydrate.ts @@ -1,32 +1,46 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order /* eslint-disable sort-keys */ -export default { - Amount: 'i128', - AmountOf: 'Amount', - Address: 'AccountId', - BalanceInfo: { - amount: 'Balance', - assetId: 'AssetId' - }, - CurrencyId: 'AssetId', - CurrencyIdOf: 'AssetId', - Intention: { - who: 'AccountId', - asset_sell: 'AssetId', - asset_buy: 'AssetId', - amount: 'Balance', - discount: 'bool', - sell_or_buy: 'IntentionType' - }, - IntentionId: 'u128', - IntentionType: { - _enum: [ - 'SELL', - 'BUY' - ] - }, - LookupSource: 'AccountId', - Price: 'Balance' + +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Amount: 'i128', + AmountOf: 'Amount', + Address: 'AccountId', + BalanceInfo: { + amount: 'Balance', + assetId: 'AssetId' + }, + CurrencyId: 'AssetId', + CurrencyIdOf: 'AssetId', + Intention: { + who: 'AccountId', + asset_sell: 'AssetId', + asset_buy: 'AssetId', + amount: 'Balance', + discount: 'bool', + sell_or_buy: 'IntentionType' + }, + IntentionId: 'u128', + IntentionType: { + _enum: [ + 'SELL', + 'BUY' + ] + }, + LookupSource: 'AccountId', + Price: 'Balance' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/idavoll.ts b/packages/apps-config/src/api/spec/idavoll.ts index 2e1241dbbfe4..6553b36bb078 100644 --- a/packages/apps-config/src/api/spec/idavoll.ts +++ b/packages/apps-config/src/api/spec/idavoll.ts @@ -1,10 +1,22 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/index.ts b/packages/apps-config/src/api/spec/index.ts index cbf1d04e3fdb..5a7d67509a87 100644 --- a/packages/apps-config/src/api/spec/index.ts +++ b/packages/apps-config/src/api/spec/index.ts @@ -1,6 +1,9 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +import acala from './acala'; import aresParachain from './ares-parachain'; import bifrost from './bifrost'; import bitcountry from './bitcountry'; @@ -19,6 +22,7 @@ import datahighwayParachain from './datahighway'; import dock from './dock'; import dotmog from './dotmog'; import dusty from './dusty'; +import edgeware from './edgeware'; import encointerNodeNotee from './encointer-node-notee'; import encointerNodeTeeproxy from './encointer-node-teeproxy'; import encointerPara from './encointer-para'; @@ -29,14 +33,18 @@ import idavoll from './idavoll'; import integritee from './integritee'; import jupiter from './jupiter'; import kilt from './kilt'; +import kulupu from './kulupu'; +import laminar from './laminar'; +import moonbeam from './moonbeam'; import nodle from './nodle'; import phala from './phala'; import phalaParachain from './phala-parachain'; import plasm from './plasm'; import plasmParachain from './plasm-parachain'; +import polkabtc from './polkabtc'; import polkadex from './polkadex'; import robonomics from './robonomics'; -import stablePoc from './stable-poc'; +import soraSubstrate from './soraSubstrate'; import stafi from './stafi'; import subdao from './subdao'; import subsocial from './subsocial'; @@ -46,17 +54,19 @@ import uniarts from './uniarts'; import zenlink from './zenlink'; import zero from './zero'; -// mapping from specName in state.getRuntimeVersion -export default { +// NOTE: The mapping is done from specName in state.getRuntimeVersion +const spec: Record = { Crab: crab, Darwinia: darwinia, Equilibrium: equilibrium, + acala, 'ares-parachain': aresParachain, - bifrost: bifrost, + bifrost, 'bitcountry-node': bitcountry, + 'btc-parachain': polkabtc, canvas, 'centrifuge-chain': centrifugeChain, - chainx: chainx, + chainx, clover, 'clover-rococo': cloverRococo, crust, @@ -68,17 +78,25 @@ export default { 'dock-testnet': dock, 'dotmog-node': dotmog, dusty3: dusty, + edgeware, 'encointer-node-notee': encointerNodeNotee, 'encointer-node-teeproxy': encointerNodeTeeproxy, 'encointer-parachain': encointerPara, 'hack-hydra-dx': hydrate, hanonycash, 'hydra-dx': hydrate, - idavoll: idavoll, + idavoll, 'integritee-parachain': integritee, jupiter, 'kilt-parachain': kilt, + kulupu, + laminar, + mandala: acala, 'mashnet-node': kilt, + 'moonbase-alphanet': moonbeam, + moonbeam, + 'moonbeam-standalone': moonbeam, + 'node-moonbeam': moonbeam, 'node-polkadex': polkadex, 'nodle-chain': nodle, 'phala-collator': phalaParachain, @@ -86,14 +104,15 @@ export default { plasm, 'plasm-parachain': plasmParachain, robonomics, - 'stable-poc': stablePoc, - stable_poc: stablePoc, + 'sora-substrate': soraSubstrate, stafi, subdao, subsocial, subzero: zero, - ternoa: ternoa, - trustbase: trustbase, - uniarts: uniarts, + ternoa, + trustbase, + uniarts, zenlink }; + +export default spec; diff --git a/packages/apps-config/src/api/spec/integritee.ts b/packages/apps-config/src/api/spec/integritee.ts index ba258abccfa1..6ac15beed9c1 100644 --- a/packages/apps-config/src/api/spec/integritee.ts +++ b/packages/apps-config/src/api/spec/integritee.ts @@ -1,21 +1,33 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'MultiAddress', - Enclave: { - mrenclave: 'Hash', - pubkey: 'AccountId', - timestamp: 'u64', - url: 'Text' - }, - LookupSource: 'MultiAddress', - Request: { - cyphertext: 'Vec', - shard: 'ShardIdentifier' - }, - ShardIdentifier: 'Hash' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'MultiAddress', + Enclave: { + mrenclave: 'Hash', + pubkey: 'AccountId', + timestamp: 'u64', + url: 'Text' + }, + LookupSource: 'MultiAddress', + Request: { + cyphertext: 'Vec', + shard: 'ShardIdentifier' + }, + ShardIdentifier: 'Hash' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/jupiter.ts b/packages/apps-config/src/api/spec/jupiter.ts index 68119d2e2de1..4322140cb1f3 100644 --- a/packages/apps-config/src/api/spec/jupiter.ts +++ b/packages/apps-config/src/api/spec/jupiter.ts @@ -1,10 +1,22 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'MultiAddress', - LookupSource: 'MultiAddress' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'MultiAddress', + LookupSource: 'MultiAddress' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/kilt.ts b/packages/apps-config/src/api/spec/kilt.ts index 52613e298bed..513d17c0c76c 100644 --- a/packages/apps-config/src/api/spec/kilt.ts +++ b/packages/apps-config/src/api/spec/kilt.ts @@ -1,16 +1,31 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -export default { - Address: 'AccountId', - BlockNumber: 'u64', - DelegationNodeId: 'Hash', - ErrorCode: 'u16', - Index: 'u64', - LookupSource: 'AccountId', - Permissions: 'u32', - PublicBoxKey: 'Hash', - PublicSigningKey: 'Hash', - RefCount: 'u8', - Signature: 'MultiSignature' +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order +/* eslint-disable sort-keys */ + +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + BlockNumber: 'u64', + DelegationNodeId: 'Hash', + ErrorCode: 'u16', + Index: 'u64', + LookupSource: 'AccountId', + Permissions: 'u32', + PublicBoxKey: 'Hash', + PublicSigningKey: 'Hash', + RefCount: 'u8', + Signature: 'MultiSignature' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/specVersioned/kulupu.ts b/packages/apps-config/src/api/spec/kulupu.ts similarity index 100% rename from packages/apps-config/src/api/specVersioned/kulupu.ts rename to packages/apps-config/src/api/spec/kulupu.ts diff --git a/packages/apps-config/src/api/specVersioned/laminar.ts b/packages/apps-config/src/api/spec/laminar.ts similarity index 100% rename from packages/apps-config/src/api/specVersioned/laminar.ts rename to packages/apps-config/src/api/spec/laminar.ts diff --git a/packages/apps-config/src/api/specVersioned/moonbeam.ts b/packages/apps-config/src/api/spec/moonbeam.ts similarity index 100% rename from packages/apps-config/src/api/specVersioned/moonbeam.ts rename to packages/apps-config/src/api/spec/moonbeam.ts diff --git a/packages/apps-config/src/api/spec/nodle.ts b/packages/apps-config/src/api/spec/nodle.ts index 3463e989650a..b97f2cb4754d 100644 --- a/packages/apps-config/src/api/spec/nodle.ts +++ b/packages/apps-config/src/api/spec/nodle.ts @@ -1,30 +1,45 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -export default { - Amendment: 'Call', - Application: { - candidate: 'AccountId', - candidate_deposit: 'Balance', - challenged_block: 'BlockNumber', - challenger: 'Option', - challenger_deposit: 'Option', - created_block: 'BlockNumber', - metadata: 'Vec', - voters_against: 'Vec<(AccountId, Balance)>', - voters_for: 'Vec<(AccountId, Balance)>', - votes_against: 'Option', - votes_for: 'Option' - }, - CertificateId: 'AccountId', - RefCount: 'u8', - RootCertificate: { - child_revocations: 'Vec', - created: 'BlockNumber', - key: 'CertificateId', - owner: 'AccountId', - renewed: 'BlockNumber', - revoked: 'bool', - validity: 'BlockNumber' - } +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order +/* eslint-disable sort-keys */ + +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Amendment: 'Call', + Application: { + candidate: 'AccountId', + candidate_deposit: 'Balance', + challenged_block: 'BlockNumber', + challenger: 'Option', + challenger_deposit: 'Option', + created_block: 'BlockNumber', + metadata: 'Vec', + voters_against: 'Vec<(AccountId, Balance)>', + voters_for: 'Vec<(AccountId, Balance)>', + votes_against: 'Option', + votes_for: 'Option' + }, + CertificateId: 'AccountId', + RefCount: 'u8', + RootCertificate: { + child_revocations: 'Vec', + created: 'BlockNumber', + key: 'CertificateId', + owner: 'AccountId', + renewed: 'BlockNumber', + revoked: 'bool', + validity: 'BlockNumber' + } + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/phala-parachain.ts b/packages/apps-config/src/api/spec/phala-parachain.ts index 0e256ffb3898..7ef28840025e 100644 --- a/packages/apps-config/src/api/spec/phala-parachain.ts +++ b/packages/apps-config/src/api/spec/phala-parachain.ts @@ -1,62 +1,74 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'MultiAddress', - LookupSource: 'MultiAddress', - EthereumAddress: 'H160', - EcdsaSignature: '[u8; 65]', - EthereumTxHash: 'H256', - WorkerStateEnum: { - _enum: { - Empty: null, - Free: null, - Gatekeeper: null, - MiningPending: null, - Mining: 'BlockNumber', - MiningStopping: null +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'MultiAddress', + LookupSource: 'MultiAddress', + EthereumAddress: 'H160', + EcdsaSignature: '[u8; 65]', + EthereumTxHash: 'H256', + WorkerStateEnum: { + _enum: { + Empty: null, + Free: null, + Gatekeeper: null, + MiningPending: null, + Mining: 'BlockNumber', + MiningStopping: null + } + }, + WorkerInfo: { + machineId: 'Vec', + pubkey: 'Vec', + lastUpdated: 'u64', + state: 'WorkerStateEnum', + score: 'Option' + }, + Score: { + overallScore: 'u32', + features: 'Vec' + }, + StashInfo: { + controller: 'AccountId', + payoutPrefs: 'PayoutPrefs' + }, + PayoutPrefs: { + commission: 'u32', + target: 'AccountId' + }, + BlockRewardInfo: { + seed: 'U256', + onlineTarget: 'U256', + computeTarget: 'U256' + }, + RoundInfo: { + round: 'u32', + startBlock: 'BlockNumber' + }, + RoundStats: { + round: 'u32', + onlineWorkers: 'u32', + computeWorkers: 'u32', + fracTargetOnlineReward: 'u32', + totalPower: 'u32' + }, + MinerStatsDelta: { + numWorker: 'i32', + numPower: 'i32' + } + } } - }, - WorkerInfo: { - machineId: 'Vec', - pubkey: 'Vec', - lastUpdated: 'u64', - state: 'WorkerStateEnum', - score: 'Option' - }, - Score: { - overallScore: 'u32', - features: 'Vec' - }, - StashInfo: { - controller: 'AccountId', - payoutPrefs: 'PayoutPrefs' - }, - PayoutPrefs: { - commission: 'u32', - target: 'AccountId' - }, - BlockRewardInfo: { - seed: 'U256', - onlineTarget: 'U256', - computeTarget: 'U256' - }, - RoundInfo: { - round: 'u32', - startBlock: 'BlockNumber' - }, - RoundStats: { - round: 'u32', - onlineWorkers: 'u32', - computeWorkers: 'u32', - fracTargetOnlineReward: 'u32', - totalPower: 'u32' - }, - MinerStatsDelta: { - numWorker: 'i32', - numPower: 'i32' - } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/phala.ts b/packages/apps-config/src/api/spec/phala.ts index ffe6de546444..e9f632ce350a 100644 --- a/packages/apps-config/src/api/spec/phala.ts +++ b/packages/apps-config/src/api/spec/phala.ts @@ -1,34 +1,46 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - EcdsaSignature: '[u8; 65]', - EthereumAddress: 'H160', - EthereumTxHash: 'H256', - MiningInfo: { - isMining: 'bool', - startBlock: 'Option' - }, - PayoutPrefs: { - commission: 'u32', - target: 'AccountId' - }, - Score: { - features: 'Vec', - overallScore: 'u32' - }, - StashInfo: { - controller: 'AccountId', - payoutPrefs: 'PayoutPrefs' - }, - WorkerInfo: { - machineId: 'Vec', - pubkey: 'Vec', - lastUpdated: 'u64', - score: 'Option', - status: 'i32' - } +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + EcdsaSignature: '[u8; 65]', + EthereumAddress: 'H160', + EthereumTxHash: 'H256', + MiningInfo: { + isMining: 'bool', + startBlock: 'Option' + }, + PayoutPrefs: { + commission: 'u32', + target: 'AccountId' + }, + Score: { + features: 'Vec', + overallScore: 'u32' + }, + StashInfo: { + controller: 'AccountId', + payoutPrefs: 'PayoutPrefs' + }, + WorkerInfo: { + machineId: 'Vec', + pubkey: 'Vec', + lastUpdated: 'u64', + score: 'Option', + status: 'i32' + } + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/plasm-parachain.ts b/packages/apps-config/src/api/spec/plasm-parachain.ts index db26aaddcf2c..10be348627f0 100644 --- a/packages/apps-config/src/api/spec/plasm-parachain.ts +++ b/packages/apps-config/src/api/spec/plasm-parachain.ts @@ -1,31 +1,43 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId', - ChainId: { - _enum: { - RelayChain: null, - Parachain: 'ParaId' - } - }, - XCurrencyId: { - chain_id: 'ChainId', - currency_id: 'Bytes' - }, - CurrencyIdOf: 'CurrencyId', - CurrencyId: { - _enum: { - Token: 'TokenSymbol' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId', + ChainId: { + _enum: { + RelayChain: null, + Parachain: 'ParaId' + } + }, + XCurrencyId: { + chain_id: 'ChainId', + currency_id: 'Bytes' + }, + CurrencyIdOf: 'CurrencyId', + CurrencyId: { + _enum: { + Token: 'TokenSymbol' + } + }, + TokenSymbol: { + _enum: ['ACA', 'AUSD', 'DOT', 'XBTC', 'LDOT', 'RENBTC', 'SDN', 'PLM'] + }, + AmountOf: 'Amount', + Amount: 'i128' + } } - }, - TokenSymbol: { - _enum: ['ACA', 'AUSD', 'DOT', 'XBTC', 'LDOT', 'RENBTC', 'SDN', 'PLM'] - }, - AmountOf: 'Amount', - Amount: 'i128' + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/plasm.ts b/packages/apps-config/src/api/spec/plasm.ts index 023923a6f2a0..e82b2a4f92c4 100644 --- a/packages/apps-config/src/api/spec/plasm.ts +++ b/packages/apps-config/src/api/spec/plasm.ts @@ -1,36 +1,51 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -export default { - AuthorityId: 'AccountId', - AuthorityVote: 'u32', - Claim: { - amount: 'u128', - approve: 'BTreeSet', - complete: 'bool', - decline: 'BTreeSet', - params: 'Lockdrop' - }, - ClaimId: 'H256', - ClaimVote: { - approve: 'bool', - authority: 'u16', - claim_id: 'ClaimId' - }, - DollarRate: 'u128', - Keys: 'SessionKeys2', - Lockdrop: { - duration: 'u64', - public_key: '[u8; 33]', - transaction_hash: 'H256', - type: 'u8', - value: 'u128' - }, - PredicateHash: 'H256', - RefCount: 'u8', - TickerRate: { - authority: 'u16', - btc: 'u128', - eth: 'u128' - } +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order +/* eslint-disable sort-keys */ + +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + AuthorityId: 'AccountId', + AuthorityVote: 'u32', + Claim: { + amount: 'u128', + approve: 'BTreeSet', + complete: 'bool', + decline: 'BTreeSet', + params: 'Lockdrop' + }, + ClaimId: 'H256', + ClaimVote: { + approve: 'bool', + authority: 'u16', + claim_id: 'ClaimId' + }, + DollarRate: 'u128', + Keys: 'SessionKeys2', + Lockdrop: { + duration: 'u64', + public_key: '[u8; 33]', + transaction_hash: 'H256', + type: 'u8', + value: 'u128' + }, + PredicateHash: 'H256', + RefCount: 'u8', + TickerRate: { + authority: 'u16', + btc: 'u128', + eth: 'u128' + } + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/specVersioned/polkabtc.ts b/packages/apps-config/src/api/spec/polkabtc.ts similarity index 100% rename from packages/apps-config/src/api/specVersioned/polkabtc.ts rename to packages/apps-config/src/api/spec/polkabtc.ts diff --git a/packages/apps-config/src/api/spec/polkadex.ts b/packages/apps-config/src/api/spec/polkadex.ts index 981dd62eb187..7ddaa9ec3abb 100644 --- a/packages/apps-config/src/api/spec/polkadex.ts +++ b/packages/apps-config/src/api/spec/polkadex.ts @@ -1,72 +1,86 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order /* eslint-disable sort-keys */ -export default { - OrderType: { - _enum: [ - 'BidLimit', - 'BidMarket', - 'AskLimit', - 'AskMarket' - ] - }, - Order: { - id: 'Hash', - trading_pair: 'Hash', - trader: 'AccountId', - price: 'FixedU128', - quantity: 'FixedU128', - order_type: 'OrderType' - }, - Order4RPC: { - id: '[u8;32]', - trading_pair: '[u8;32]', - trader: '[u8;32]', - price: 'Vec', - quantity: 'Vec', - order_type: 'OrderType' - }, - MarketData: { - low: 'FixedU128', - high: 'FixedU128', - volume: 'FixedU128', - open: 'FixedU128', - close: 'FixedU128' - }, - LinkedPriceLevel: { - next: 'Option', - prev: 'Option', - orders: 'Vec' - }, - LinkedPriceLevelRpc: { - next: 'Vec', - prev: 'Vec', - orders: 'Vec' - }, - Orderbook: { - trading_pair: 'Hash', - base_asset_id: 'u32', - quote_asset_id: 'u32', - best_bid_price: 'FixedU128', - best_ask_price: 'FixedU128' - }, - OrderbookRPC: { - trading_pair: '[u8;32]', - base_asset_id: 'u32', - quote_asset_id: 'u32', - best_bid_price: 'Vec', - best_ask_price: 'Vec' - }, - FrontendPricelevel: { - price: 'FixedU128', - quantity: 'FixedU128' - }, - OrderbookUpdates: { - bids: 'Vec', - asks: 'Vec' - }, - LookupSource: 'AccountId', - Address: 'AccountId' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + OrderType: { + _enum: [ + 'BidLimit', + 'BidMarket', + 'AskLimit', + 'AskMarket' + ] + }, + Order: { + id: 'Hash', + trading_pair: 'Hash', + trader: 'AccountId', + price: 'FixedU128', + quantity: 'FixedU128', + order_type: 'OrderType' + }, + Order4RPC: { + id: '[u8;32]', + trading_pair: '[u8;32]', + trader: '[u8;32]', + price: 'Vec', + quantity: 'Vec', + order_type: 'OrderType' + }, + MarketData: { + low: 'FixedU128', + high: 'FixedU128', + volume: 'FixedU128', + open: 'FixedU128', + close: 'FixedU128' + + }, + LinkedPriceLevel: { + next: 'Option', + prev: 'Option', + orders: 'Vec' + }, + LinkedPriceLevelRpc: { + next: 'Vec', + prev: 'Vec', + orders: 'Vec' + }, + Orderbook: { + trading_pair: 'Hash', + base_asset_id: 'u32', + quote_asset_id: 'u32', + best_bid_price: 'FixedU128', + best_ask_price: 'FixedU128' + }, + OrderbookRPC: { + trading_pair: '[u8;32]', + base_asset_id: 'u32', + quote_asset_id: 'u32', + best_bid_price: 'Vec', + best_ask_price: 'Vec' + }, + FrontendPricelevel: { + price: 'FixedU128', + quantity: 'FixedU128' + }, + OrderbookUpdates: { + bids: 'Vec', + asks: 'Vec' + }, + LookupSource: 'AccountId', + Address: 'AccountId' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/robonomics.ts b/packages/apps-config/src/api/spec/robonomics.ts index 4fb0e05c3c64..16880a7cfd51 100644 --- a/packages/apps-config/src/api/spec/robonomics.ts +++ b/packages/apps-config/src/api/spec/robonomics.ts @@ -1,18 +1,31 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order /* eslint-disable sort-keys */ -export default { - Record: 'Vec', - TechnicalParam: 'Vec', - TechnicalReport: 'Vec', - EconomicalParam: '{}', - ProofParam: 'MultiSignature', - LiabilityIndex: 'u64', - ValidationFunctionParams: { - max_code_size: 'u32', - relay_chain_height: 'u32', - code_upgrade_allowed: 'Option' - } +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Record: 'Vec', + TechnicalParam: 'Vec', + TechnicalReport: 'Vec', + EconomicalParam: '{}', + ProofParam: 'MultiSignature', + LiabilityIndex: 'u64', + ValidationFunctionParams: { + max_code_size: 'u32', + relay_chain_height: 'u32', + code_upgrade_allowed: 'Option' + } + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/specVersioned/soraSubstrate.ts b/packages/apps-config/src/api/spec/soraSubstrate.ts similarity index 100% rename from packages/apps-config/src/api/specVersioned/soraSubstrate.ts rename to packages/apps-config/src/api/spec/soraSubstrate.ts diff --git a/packages/apps-config/src/api/spec/stable-poc.ts b/packages/apps-config/src/api/spec/stable-poc.ts deleted file mode 100644 index 13ff550496ba..000000000000 --- a/packages/apps-config/src/api/spec/stable-poc.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2017-2021 @polkadot/apps-config authors & contributors -// SPDX-License-Identifier: Apache-2.0 - -// structs need to be in order -/* eslint-disable sort-keys */ - -export default { - Address: 'AccountId', - LookupSource: 'AccountId', - RefCount: 'u8', - AccountData: { - free: 'Balance', - reserved: 'Balance', - miscFrozen: 'Balance', - feeFrozen: 'Balance', - txCount: 'u32', - sessionIndex: 'u32' - }, - TemplateAccountData: { - txCount: 'u32', - sessionIndex: 'u32' - }, - TxCount: 'u32', - Value: 'u128', - UtxoHash: 'H256', - AccountHash: 'H256', - TxHash: 'H256', - TransactionOutput: { - value: 'Value', - pubkey: 'AccountId' - }, - SignedPair: { - input: 'Vec', - output: 'Vec' - }, - ArchivedTransaction: 'Vec', - ArchivedPair: { - inputs: 'Vec', - outputs: 'Vec' - } -}; diff --git a/packages/apps-config/src/api/spec/stafi.ts b/packages/apps-config/src/api/spec/stafi.ts index 65b114ec25f5..f137bf11005b 100644 --- a/packages/apps-config/src/api/spec/stafi.ts +++ b/packages/apps-config/src/api/spec/stafi.ts @@ -1,11 +1,23 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId', - RefCount: 'u8' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId', + RefCount: 'u8' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/subdao.ts b/packages/apps-config/src/api/spec/subdao.ts index e91acfefeb3a..d9c2fe5f1a30 100644 --- a/packages/apps-config/src/api/spec/subdao.ts +++ b/packages/apps-config/src/api/spec/subdao.ts @@ -1,6 +1,19 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order /* eslint-disable sort-keys */ -export default {}; +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: {} + } + ] +}; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/subsocial.ts b/packages/apps-config/src/api/spec/subsocial.ts index f13abc56583d..68ea30e39fd3 100644 --- a/packages/apps-config/src/api/spec/subsocial.ts +++ b/packages/apps-config/src/api/spec/subsocial.ts @@ -1,10 +1,23 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + import * as subsocialDefinitions from '@subsocial/types/substrate/interfaces/definitions'; import { typesFromDefs } from '../util'; -const subsocialTypes = typesFromDefs(subsocialDefinitions); +// structs need to be in order +/* eslint-disable sort-keys */ + +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: typesFromDefs(subsocialDefinitions) + } + ] +}; -export default subsocialTypes; +export default definitions; diff --git a/packages/apps-config/src/api/spec/ternoa.ts b/packages/apps-config/src/api/spec/ternoa.ts index f50a74485901..51a9d98699b4 100644 --- a/packages/apps-config/src/api/spec/ternoa.ts +++ b/packages/apps-config/src/api/spec/ternoa.ts @@ -1,18 +1,31 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - CapsuleID: 'u32', - CapsuleIDOf: 'CapsuleID', - CapsuleData: { - offchain_uri: 'Vec', - pk_hash: 'Hash', - creator: 'AccountId', - owner: 'AccountId', - locked: 'bool' - }, - LookupSource: 'AccountId' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + CapsuleID: 'u32', + CapsuleIDOf: 'CapsuleID', + CapsuleData: { + offchain_uri: 'Vec', + pk_hash: 'Hash', + creator: 'AccountId', + owner: 'AccountId', + locked: 'bool' + }, + LookupSource: 'AccountId' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/trustbase.ts b/packages/apps-config/src/api/spec/trustbase.ts index 2e1241dbbfe4..6553b36bb078 100644 --- a/packages/apps-config/src/api/spec/trustbase.ts +++ b/packages/apps-config/src/api/spec/trustbase.ts @@ -1,10 +1,22 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/uniarts.ts b/packages/apps-config/src/api/spec/uniarts.ts index 4624a85caef0..e955d2eaeaf4 100644 --- a/packages/apps-config/src/api/spec/uniarts.ts +++ b/packages/apps-config/src/api/spec/uniarts.ts @@ -1,203 +1,214 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -/* eslint-disable camelcase */ -export default { - Keys: 'SessionKeys2', - Address: 'AccountId', - LookupSource: 'AccountId', - WorkId: 'u32', - Id: 'u32', - Name: 'Vec', - Value: 'Vec', - ReasonIndex: 'u32', - LottoIndex: 'u32', - LotteryKind: { - _enum: { - Routine: 'Null', - TreasuryFunded: 'ReasonIndex' - } - }, - LottoResult: { - _enum: { - Routine: '(AccountId, Balance)', - TreasuryFunded: 'Balance' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Keys: 'SessionKeys2', + Address: 'AccountId', + LookupSource: 'AccountId', + WorkId: 'u32', + Id: 'u32', + Name: 'Vec', + Value: 'Vec', + ReasonIndex: 'u32', + LottoIndex: 'u32', + LotteryKind: { + _enum: { + Routine: 'Null', + TreasuryFunded: 'ReasonIndex' + } + }, + LottoResult: { + _enum: { + Routine: '(AccountId, Balance)', + TreasuryFunded: 'Balance' + } + }, + Lottery: { + round: 'LottoIndex', + kind: 'LotteryKind', + jackpot: 'Balance', + next_ticket_id: 'u32', + players: 'BTreeMap', + tickets: 'BTreeMap', + result: 'Option' + }, + NameData: { + value: 'Value', + owner: 'AccountId', + expiration: 'Option' + }, + Token: { + hash: 'H256', + symbol: 'Vec', + total_supply: 'Balance' + }, + OrderType: { + _enum: ['Buy', 'Sell'] + }, + OrderStatus: { + _enum: ['Created', 'PartialFilled', 'Filled', 'Canceled'] + }, + TradePair: { + hash: 'H256', + base: 'H256', + quote: 'H256', + buy_one_price: 'Option', + sell_one_price: 'Option', + latest_matched_price: 'Option', + one_day_trade_volume: 'Option', + one_day_highest_price: 'Option', + one_day_lowest_price: 'Option' + }, + Price: 'u128', + LimitOrder: { + hash: 'H256', + base: 'H256', + quote: 'H256', + owner: 'AccountId', + price: 'Price', + sell_amount: 'Balance', + buy_amount: 'Balance', + remained_sell_amount: 'Balance', + remained_buy_amount: 'Balance', + otype: 'OrderType', + status: 'OrderStatus' + }, + Trade: { + hash: 'H256', + base: 'H256', + quote: 'H256', + buyer: 'AccountId', + seller: 'AccountId', + maker: 'AccountId', + taker: 'AccountId', + otype: 'OrderType', + price: 'Price', + base_amount: 'Balance', + quote_amount: 'Balance' + }, + OrderLinkedItem: { + prev: 'Option', + next: 'Option', + price: 'Option', + orders: 'Vec' + }, + CollectionMode: { + _enum: { + Invalid: null, + NFT: 'u32', + Fungible: 'u32', + ReFungible: '(u32, u32)' + } + }, + NftItemType: { + Collection: 'u64', + Owner: 'AccountId', + Data: 'Vec', + item_hash: 'H160' + }, + FungibleItemType: { + Collection: 'u64', + Owner: 'AccountId', + value: 'u128' + }, + ApprovePermissions: { + approved: 'AccountId', + amount: 'u64' + }, + AccessMode: { + _enum: ['Normal', 'WhiteList'] + }, + SaleOrder: { + collection_id: 'u64', + item_id: 'u64', + value: 'u64', + owner: 'AccountId', + price: 'u64' + }, + SaleOrderHistory: { + collection_id: 'u64', + item_id: 'u64', + value: 'u64', + seller: 'AccountId', + buyer: 'AccountId', + price: 'u64', + buy_time: 'BlockNumber' + }, + SignatureAuthentication: { + collection: 'u64', + item: 'u64', + names: 'Name', + names_owner: 'AccountId', + sign_time: 'BlockNumber', + memo: 'Vec', + expiration: 'Option' + }, + Ownership: { + owner: 'AccountId', + fraction: 'u128' + }, + ReFungibleItemType: { + Collection: 'u64', + Owner: 'Vec', + Data: 'Vec' + }, + CollectionType: { + Owner: 'AccountId', + Mode: 'CollectionMode', + Access: 'u8', + DecimalPoints: 'u32', + Name: 'Vec', + Description: 'Vec', + TokenPrefix: 'Vec', + CustomDataSize: 'u32', + OffchainSchema: 'Vec', + Sponsor: 'AccountId', + UnconfirmedSponsor: 'AccountId' + }, + Auction: { + id: 'u64', + collection_id: 'u64', + item_id: 'u64', + value: 'u64', + owner: 'AccountId', + start_price: 'u64', + increment: 'u64', + current_price: 'u64', + start_time: 'BlockNumber', + end_time: 'BlockNumber' + }, + BidHistory: { + auction_id: 'u64', + bidder: 'AccountId', + bid_price: 'u64', + bid_time: 'BlockNumber' + }, + Pool: { + id: 'Id', + account: 'AccountId', + acc_rewards_per_share: 'Balance', + last_reward_block: 'BlockNumber', + asset_id: 'Id', + total_balance: 'Balance' + }, + Staker: { + amount: 'Balance', + reward: 'Balance', + debt: 'Balance' + } + } } - }, - Lottery: { - round: 'LottoIndex', - kind: 'LotteryKind', - jackpot: 'Balance', - next_ticket_id: 'u32', - players: 'BTreeMap', - tickets: 'BTreeMap', - result: 'Option' - }, - NameData: { - value: 'Value', - owner: 'AccountId', - expiration: 'Option' - }, - Token: { - hash: 'H256', - symbol: 'Vec', - total_supply: 'Balance' - }, - OrderType: { - _enum: ['Buy', 'Sell'] - }, - OrderStatus: { - _enum: ['Created', 'PartialFilled', 'Filled', 'Canceled'] - }, - TradePair: { - hash: 'H256', - base: 'H256', - quote: 'H256', - buy_one_price: 'Option', - sell_one_price: 'Option', - latest_matched_price: 'Option', - one_day_trade_volume: 'Option', - one_day_highest_price: 'Option', - one_day_lowest_price: 'Option' - }, - Price: 'u128', - LimitOrder: { - hash: 'H256', - base: 'H256', - quote: 'H256', - owner: 'AccountId', - price: 'Price', - sell_amount: 'Balance', - buy_amount: 'Balance', - remained_sell_amount: 'Balance', - remained_buy_amount: 'Balance', - otype: 'OrderType', - status: 'OrderStatus' - }, - Trade: { - hash: 'H256', - base: 'H256', - quote: 'H256', - buyer: 'AccountId', - seller: 'AccountId', - maker: 'AccountId', - taker: 'AccountId', - otype: 'OrderType', - price: 'Price', - base_amount: 'Balance', - quote_amount: 'Balance' - }, - OrderLinkedItem: { - prev: 'Option', - next: 'Option', - price: 'Option', - orders: 'Vec' - }, - CollectionMode: { - _enum: { - Invalid: null, - NFT: 'u32', - Fungible: 'u32', - ReFungible: '(u32, u32)' - } - }, - NftItemType: { - Collection: 'u64', - Owner: 'AccountId', - Data: 'Vec', - item_hash: 'H160' - }, - FungibleItemType: { - Collection: 'u64', - Owner: 'AccountId', - value: 'u128' - }, - ApprovePermissions: { - approved: 'AccountId', - amount: 'u64' - }, - AccessMode: { - _enum: ['Normal', 'WhiteList'] - }, - SaleOrder: { - collection_id: 'u64', - item_id: 'u64', - value: 'u64', - owner: 'AccountId', - price: 'u64' - }, - SaleOrderHistory: { - collection_id: 'u64', - item_id: 'u64', - value: 'u64', - seller: 'AccountId', - buyer: 'AccountId', - price: 'u64', - buy_time: 'BlockNumber' - }, - SignatureAuthentication: { - collection: 'u64', - item: 'u64', - names: 'Name', - names_owner: 'AccountId', - sign_time: 'BlockNumber', - memo: 'Vec', - expiration: 'Option' - }, - Ownership: { - owner: 'AccountId', - fraction: 'u128' - }, - ReFungibleItemType: { - Collection: 'u64', - Owner: 'Vec', - Data: 'Vec' - }, - CollectionType: { - Owner: 'AccountId', - Mode: 'CollectionMode', - Access: 'u8', - DecimalPoints: 'u32', - Name: 'Vec', - Description: 'Vec', - TokenPrefix: 'Vec', - CustomDataSize: 'u32', - OffchainSchema: 'Vec', - Sponsor: 'AccountId', - UnconfirmedSponsor: 'AccountId' - }, - Auction: { - id: 'u64', - collection_id: 'u64', - item_id: 'u64', - value: 'u64', - owner: 'AccountId', - start_price: 'u64', - increment: 'u64', - current_price: 'u64', - start_time: 'BlockNumber', - end_time: 'BlockNumber' - }, - BidHistory: { - auction_id: 'u64', - bidder: 'AccountId', - bid_price: 'u64', - bid_time: 'BlockNumber' - }, - Pool: { - id: 'Id', - account: 'AccountId', - acc_rewards_per_share: 'Balance', - last_reward_block: 'BlockNumber', - asset_id: 'Id', - total_balance: 'Balance' - }, - Staker: { - amount: 'Balance', - reward: 'Balance', - debt: 'Balance' - } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/zenlink.ts b/packages/apps-config/src/api/spec/zenlink.ts index bb4ac6442982..d2d9445b5992 100644 --- a/packages/apps-config/src/api/spec/zenlink.ts +++ b/packages/apps-config/src/api/spec/zenlink.ts @@ -1,34 +1,47 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + +// structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - AccountInfo: 'AccountInfoWithRefCount', - AssetId: { - _enum: { - NativeCurrency: null, - ParaCurrency: 'u32' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + AccountInfo: 'AccountInfoWithRefCount', + AssetId: { + _enum: { + NativeCurrency: null, + ParaCurrency: 'u32' + } + }, + LookupSource: 'AccountId', + Pair: { + token_0: 'AssetId', + token_1: 'AssetId', + account: 'AccountId', + total_liquidity: 'TokenBalance' + }, + PairId: 'u32', + PairInfo: { + token_0: 'AssetId', + token_1: 'AssetId', + account: 'AccountId', + total_liquidity: 'TokenBalance', + holding_liquidity: 'TokenBalance', + reserve_0: 'TokenBalance', + reserve_1: 'TokenBalance' + }, + RefCount: 'u32', + TokenBalance: 'u128' + } } - }, - LookupSource: 'AccountId', - Pair: { - token_0: 'AssetId', - token_1: 'AssetId', - account: 'AccountId', - total_liquidity: 'TokenBalance' - }, - PairId: 'u32', - PairInfo: { - token_0: 'AssetId', - token_1: 'AssetId', - account: 'AccountId', - total_liquidity: 'TokenBalance', - holding_liquidity: 'TokenBalance', - reserve_0: 'TokenBalance', - reserve_1: 'TokenBalance' - }, - RefCount: 'u32', - TokenBalance: 'u128' + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/spec/zero.ts b/packages/apps-config/src/api/spec/zero.ts index a15ee03aa7d9..dec1122e24ca 100644 --- a/packages/apps-config/src/api/spec/zero.ts +++ b/packages/apps-config/src/api/spec/zero.ts @@ -1,22 +1,34 @@ // Copyright 2017-2021 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { OverrideBundleDefinition } from '@polkadot/types/types'; + // structs need to be in order /* eslint-disable sort-keys */ -export default { - Address: 'AccountId', - LookupSource: 'AccountId', - Campaign: { - id: 'Hash', - manager: 'AccountId', - deposit: 'Balance', - expiry: 'BlockNumber', - cap: 'Balance', - name: 'Vec', - protocol: 'u8', - status: 'u8' - }, - EventMessage: 'Vec', - Nonce: 'u64' +const definitions: OverrideBundleDefinition = { + types: [ + { + // on all versions + minmax: [0, undefined], + types: { + Address: 'AccountId', + LookupSource: 'AccountId', + Campaign: { + id: 'Hash', + manager: 'AccountId', + deposit: 'Balance', + expiry: 'BlockNumber', + cap: 'Balance', + name: 'Vec', + protocol: 'u8', + status: 'u8' + }, + EventMessage: 'Vec', + Nonce: 'u64' + } + } + ] }; + +export default definitions; diff --git a/packages/apps-config/src/api/specVersioned/equilibrium.ts b/packages/apps-config/src/api/specVersioned/equilibrium.ts deleted file mode 100644 index 46cf84562ad4..000000000000 --- a/packages/apps-config/src/api/specVersioned/equilibrium.ts +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright 2017-2021 @polkadot/apps-config authors & contributors -// SPDX-License-Identifier: Apache-2.0 - -import type { ApiInterfaceRx } from '@polkadot/api/types'; -import type { Enum, Struct } from '@polkadot/types'; -import type { Option } from '@polkadot/types/codec'; -import type { AccountId, AccountIndex, AccountInfo, Address, Balance, BlockNumber, Index } from '@polkadot/types/interfaces'; -import type { Observable } from '@polkadot/x-rxjs'; - -import { memo } from '@polkadot/api-derive/util/memo'; -import { combineLatest, of } from '@polkadot/x-rxjs'; -import { map, switchMap } from '@polkadot/x-rxjs/operators'; - -interface VestingInfo extends Struct { - readonly locked: Balance; - readonly perBlock: Balance; - readonly startingBlock: BlockNumber; -} - -interface SignedBalance extends Enum { - readonly isPositive: boolean; - readonly asPositive: Balance; - readonly isNegative: boolean; - readonly asNegative: Balance; -} - -export interface EQDeriveBalancesAll { - additional: []; // fix until vesting instances are supported in api-derive - freeBalance: Balance; - reservedBalance: Balance; - vestingLocked: Balance; - lockedBalance: Balance; - accountId: AccountId; - accountNonce: Index; - lockedBreakdown: unknown[]; -} - -type Result = [Balance, Balance, Balance, Index]; - -type RawResult = [ - SignedBalance, - Option, - Option, - AccountInfo -]; - -type EQDeriveBalancesAccountQuery = ( - address: AccountIndex | AccountId | Address | string -) => Observable<{ accountNonce: Index; }>; - -type EQDeriveBalancesAllQuery = ( - address: AccountIndex | AccountId | Address | string -) => Observable; - -export default { - derives: { - // TODO derive.democracy.locks - // TODO derice.staking.account - balances: { - account: ( - // Compatibility with calc tx fee - instanceId: string, - api: ApiInterfaceRx - ): EQDeriveBalancesAccountQuery => - memo( - instanceId, - (address: AccountId | AccountIndex | Address | string) => - api.derive.accounts.accountId(address).pipe( - switchMap( - (accountId): Observable<[AccountId, [Index]]> => - accountId - ? combineLatest([ - of(accountId), - api - .queryMulti([ - [api.query.system.account, accountId] - ]) - .pipe( - map((raw): [Index] => { - if (raw.length < 1) { - throw new Error('Data expected'); - } - - const data = raw as [AccountInfo]; - - return [data[0].nonce]; - }) - ) - ]) - : of([ - api.registry.createType('AccountId'), - [api.registry.createType('Index')] - ]) - ), - map(([, [accountNonce]]) => ({ accountNonce })) - ) - ), - all: ( - // Compatibility for account balance in explorer - instanceId: string, - api: ApiInterfaceRx - ): EQDeriveBalancesAllQuery => - memo( - instanceId, - (address: AccountIndex | AccountId | Address | string) => - api.derive.accounts.accountId(address).pipe( - switchMap( - (accountId): Observable<[AccountId, Result]> => - accountId - ? combineLatest([ - of(accountId), - api - .queryMulti([ - [api.query.balances.account, [accountId, 'EQ']], - [api.query.eqVesting.vested, accountId], - [api.query.eqVesting.vesting, accountId], - [api.query.system.account, accountId] - ]) - .pipe( - map( - (raw): Result => { - if (raw.length < 4) { - throw new Error('4 members expected'); - } - - const res = raw as RawResult; - const freeBalance = res[0].asPositive; - - let reservedBalance = api.registry.createType( - 'Balance' - ); - - let vestingLocked = api.registry.createType( - 'Balance' - ); - - if (res[1].isSome && res[2].isSome) { - const vested = res[1].unwrap(); - const info = res[2].unwrap(); - - vestingLocked = info.locked; - - reservedBalance = api.registry.createType( - 'Balance', - vestingLocked.sub(vested) - ); - } - - return [ - freeBalance, - reservedBalance, - vestingLocked, - res[3].nonce - ]; - } - ) - ) - ]) - : of([ - api.registry.createType('AccountId'), - [ - api.registry.createType('Balance'), - api.registry.createType('Balance'), - api.registry.createType('Balance'), - api.registry.createType('Index') - ] - ]) - ), - map( - ([ - accountId, - [freeBalance, reservedBalance, vestingLocked, accountNonce] - ]): EQDeriveBalancesAll => ({ - accountId, - accountNonce, - additional: [], - freeBalance, - lockedBalance: vestingLocked, - lockedBreakdown: [], - reservedBalance, - vestingLocked - }) - ) - ) - ) - } - } -}; diff --git a/packages/apps-config/src/api/specVersioned/index.ts b/packages/apps-config/src/api/specVersioned/index.ts deleted file mode 100644 index 828fe6b5265a..000000000000 --- a/packages/apps-config/src/api/specVersioned/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017-2021 @polkadot/apps-config authors & contributors -// SPDX-License-Identifier: Apache-2.0 - -import acala from './acala'; -import edgeware from './edgeware'; -import equilibrium from './equilibrium'; -import kulupu from './kulupu'; -import laminar from './laminar'; -import moonbeam from './moonbeam'; -import polkabtc from './polkabtc'; -import soraSubstrate from './soraSubstrate'; - -export default { - Equilibrium: equilibrium, - acala, - 'btc-parachain': polkabtc, - edgeware, - kulupu, - laminar, - mandala: acala, - 'moonbase-alphanet': moonbeam, - moonbeam, - 'moonbeam-standalone': moonbeam, - 'node-moonbeam': moonbeam, - 'sora-substrate': soraSubstrate -}; diff --git a/packages/react-api/src/Api.tsx b/packages/react-api/src/Api.tsx index 6eef0e08bede..de15af582413 100644 --- a/packages/react-api/src/Api.tsx +++ b/packages/react-api/src/Api.tsx @@ -12,7 +12,7 @@ import store from 'store'; import { ApiPromise } from '@polkadot/api/promise'; import { deriveMapCache, setDeriveCache } from '@polkadot/api-derive/util'; -import { ethereumChains, typesBundle, typesChain, typesSpec } from '@polkadot/apps-config'; +import { ethereumChains, typesBundle, typesChain } from '@polkadot/apps-config'; import { web3Accounts, web3Enable } from '@polkadot/extension-dapp'; import { TokenUnit } from '@polkadot/react-components/InputNumber'; import { StatusContext } from '@polkadot/react-components/Status'; @@ -198,7 +198,7 @@ function Api ({ children, store, url }: Props): React.ReactElement | null const signer = new ApiSigner(registry, queuePayload, queueSetTxStatus); const types = getDevTypes(); - api = new ApiPromise({ provider, registry, signer, types, typesBundle, typesChain, typesSpec }); + api = new ApiPromise({ provider, registry, signer, types, typesBundle, typesChain }); api.on('connected', () => setIsApiConnected(true)); api.on('disconnected', () => setIsApiConnected(false)); diff --git a/packages/react-hooks/src/useParaApi.ts b/packages/react-hooks/src/useParaApi.ts index cca14126d63a..aa1aff743098 100644 --- a/packages/react-hooks/src/useParaApi.ts +++ b/packages/react-hooks/src/useParaApi.ts @@ -7,7 +7,7 @@ import type { LinkOption } from '@polkadot/apps-config/settings/types'; import { useCallback, useEffect, useRef, useState } from 'react'; import { ApiPromise, WsProvider } from '@polkadot/api'; -import { typesBundle, typesChain, typesSpec } from '@polkadot/apps-config'; +import { typesBundle, typesChain } from '@polkadot/apps-config'; import { useIsMountedRef } from './useIsMountedRef'; import { useParaEndpoints } from './useParaEndpoints'; @@ -52,8 +52,7 @@ export function useParaApi (paraId: BN | number): Result { .create({ provider: new WsProvider(endpoints[endpoints.length - 1].value as string), typesBundle, - typesChain, - typesSpec + typesChain }) .then(_setApi) .catch(console.error);