From 01098395ec65aff67373e01de9421746eb723e98 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Fri, 15 Jan 2021 14:28:57 +0100 Subject: [PATCH] Add crowdloan types (#3060) * Add crowdloan types * Update --- packages/types-known/src/spec/rococo.ts | 10 +- packages/types/src/augment/registry.ts | 31 +++-- .../src/interfaces/crowdloan/definitions.ts | 38 ++++++ .../types/src/interfaces/crowdloan/index.ts | 4 + .../types/src/interfaces/crowdloan/types.ts | 41 +++++++ packages/types/src/interfaces/definitions.ts | 1 + .../src/interfaces/parachains/definitions.ts | 113 +----------------- .../types/src/interfaces/parachains/hrmp.ts | 30 +++++ .../types/src/interfaces/parachains/slots.ts | 48 ++++++++ .../types/src/interfaces/parachains/types.ts | 65 ++-------- packages/types/src/interfaces/types.ts | 1 + 11 files changed, 202 insertions(+), 180 deletions(-) create mode 100644 packages/types/src/interfaces/crowdloan/definitions.ts create mode 100644 packages/types/src/interfaces/crowdloan/index.ts create mode 100644 packages/types/src/interfaces/crowdloan/types.ts create mode 100644 packages/types/src/interfaces/parachains/hrmp.ts create mode 100644 packages/types/src/interfaces/parachains/slots.ts diff --git a/packages/types-known/src/spec/rococo.ts b/packages/types-known/src/spec/rococo.ts index 317204f412..5e630b3c71 100644 --- a/packages/types-known/src/spec/rococo.ts +++ b/packages/types-known/src/spec/rococo.ts @@ -34,15 +34,7 @@ const versioned: OverrideVersionedType[] = [ } }, { - minmax: [13, 13], - types: { - ...sharedTypes, - HostConfig: 'HostConfigurationTo13', - HrmpChannel: 'HrmpChannelTo13' - } - }, - { - minmax: [14, undefined], + minmax: [13, undefined], types: { ...sharedTypes } diff --git a/packages/types/src/augment/registry.ts b/packages/types/src/augment/registry.ts index 6b2ec47502..ed05f08ee3 100644 --- a/packages/types/src/augment/registry.ts +++ b/packages/types/src/augment/registry.ts @@ -16,6 +16,7 @@ import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus'; import type { AliveContractInfo, CodeHash, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractInfo, ContractStorageKey, DeletedContract, Gas, HostFnWeights, InstructionWeights, Limits, PrefabWasmModule, PrefabWasmModuleReserved, Schedule, ScheduleTo212, ScheduleTo258, SeedOf, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts'; import type { ContractConstructorSpec, ContractContractSpec, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpec, ContractEventSpec, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpec, ContractMessageSpec, ContractProject, ContractProjectContract, ContractProjectSource, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi'; +import type { DeployData, FundIndex, FundInfo, LastContribution } from '@polkadot/types/interfaces/crowdloan'; import type { AccountVote, AccountVoteSplit, AccountVoteStandard, Conviction, Delegations, PreimageStatus, PreimageStatusAvailable, PriorLock, PropIndex, Proposal, ProxyState, ReferendumIndex, ReferendumInfo, ReferendumInfoFinished, ReferendumInfoTo239, ReferendumStatus, Tally, Voting, VotingDelegating, VotingDirect, VotingDirectVote } from '@polkadot/types/interfaces/democracy'; import type { ApprovalFlag, DefunctVoter, Renouncing, SetIndex, Vote, VoteIndex, VoteThreshold, VoterInfo } from '@polkadot/types/interfaces/elections'; import type { CreatedBlock, ImportedAux } from '@polkadot/types/interfaces/engine'; @@ -30,7 +31,7 @@ import type { CallIndex, LotteryConfig } from '@polkadot/types/interfaces/lotter import type { DoubleMapTypeLatest, DoubleMapTypeV10, DoubleMapTypeV11, DoubleMapTypeV12, DoubleMapTypeV9, ErrorMetadataLatest, ErrorMetadataV10, ErrorMetadataV11, ErrorMetadataV12, ErrorMetadataV9, EventMetadataLatest, EventMetadataV10, EventMetadataV11, EventMetadataV12, EventMetadataV9, ExtrinsicMetadataLatest, ExtrinsicMetadataV11, ExtrinsicMetadataV12, FunctionArgumentMetadataLatest, FunctionArgumentMetadataV10, FunctionArgumentMetadataV11, FunctionArgumentMetadataV12, FunctionArgumentMetadataV9, FunctionMetadataLatest, FunctionMetadataV10, FunctionMetadataV11, FunctionMetadataV12, FunctionMetadataV9, MapTypeLatest, MapTypeV10, MapTypeV11, MapTypeV12, MapTypeV9, MetadataAll, MetadataLatest, MetadataV10, MetadataV11, MetadataV12, MetadataV9, ModuleConstantMetadataLatest, ModuleConstantMetadataV10, ModuleConstantMetadataV11, ModuleConstantMetadataV12, ModuleConstantMetadataV9, ModuleMetadataLatest, ModuleMetadataV10, ModuleMetadataV11, ModuleMetadataV12, ModuleMetadataV9, StorageEntryMetadataLatest, StorageEntryMetadataV10, StorageEntryMetadataV11, StorageEntryMetadataV12, StorageEntryMetadataV9, StorageEntryModifierLatest, StorageEntryModifierV10, StorageEntryModifierV11, StorageEntryModifierV12, StorageEntryModifierV9, StorageEntryTypeLatest, StorageEntryTypeV10, StorageEntryTypeV11, StorageEntryTypeV12, StorageEntryTypeV9, StorageHasher, StorageHasherV10, StorageHasherV11, StorageHasherV12, StorageHasherV9, StorageMetadataLatest, StorageMetadataV10, StorageMetadataV11, StorageMetadataV12, StorageMetadataV9 } from '@polkadot/types/interfaces/metadata'; import type { StorageKind } from '@polkadot/types/interfaces/offchain'; import type { DeferredOffenceOf, Kind, OffenceDetails, Offender, OpaqueTimeSlot, ReportIdOf, Reporter } from '@polkadot/types/interfaces/offences'; -import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AbstractFungible, AbstractNonFungible, AccountId32Junction, AccountIndex64Junction, AccountKey20Junction, AssetInstance, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Balances, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, ConcreteFungible, ConcreteNonFungible, CoreAssignment, CoreIndex, CoreOccupied, DepositAsset, DepositReserveAsset, DoubleVoteReport, DownwardMessage, ExchangeAsset, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HostConfigurationTo13, HrmpChannel, HrmpChannelId, HrmpChannelTo13, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InitiateReserveWithdraw, InitiateTeleport, Junction, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MultiAsset, MultiLocation, NetworkId, NewBidder, Order, OriginKind, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaPastCodeMeta, ParaScheduling, ParachainDispatchOrigin, ParachainProposal, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueryHolding, QueuedParathread, RegisteredParachainInfo, RelayChainBlockNumber, RelayTo, RelayedFrom, Remark, ReserveAssetDeposit, Retriable, Scheduling, SessionInfo, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, Statement, SubId, TeleportAsset, Transact, TransientValidationData, UpwardMessage, ValidationCode, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorGroup, ValidatorSignature, ValidityAttestation, VersionedMultiAsset, VersionedMultiLocation, VersionedXcm, WinningData, WinningDataEntry, WithdrawAsset, Xcm, XcmError, XcmResult } from '@polkadot/types/interfaces/parachains'; +import type { AbridgedCandidateReceipt, AbridgedHostConfiguration, AbridgedHrmpChannel, AbstractFungible, AbstractNonFungible, AccountId32Junction, AccountIndex64Junction, AccountKey20Junction, AssetInstance, AssignmentId, AssignmentKind, AttestedCandidate, AuctionIndex, AuthorityDiscoveryId, AvailabilityBitfield, AvailabilityBitfieldRecord, BackedCandidate, Balances, Bidder, BufferedSessionChange, CandidateCommitments, CandidateDescriptor, CandidateHash, CandidatePendingAvailability, CandidateReceipt, CollatorId, CollatorSignature, CommittedCandidateReceipt, ConcreteFungible, ConcreteNonFungible, CoreAssignment, CoreIndex, CoreOccupied, DepositAsset, DepositReserveAsset, DoubleVoteReport, DownwardMessage, ExchangeAsset, GlobalValidationSchedule, GroupIndex, HeadData, HostConfiguration, HrmpChannel, HrmpChannelId, HrmpOpenChannelRequest, InboundDownwardMessage, InboundHrmpMessage, InboundHrmpMessages, IncomingParachain, IncomingParachainDeploy, IncomingParachainFixed, InitiateReserveWithdraw, InitiateTeleport, Junction, LeasePeriod, LeasePeriodOf, LocalValidationData, MessageIngestionType, MultiAsset, MultiLocation, NetworkId, NewBidder, NewBidderOption, Order, OriginKind, OutboundHrmpMessage, ParaGenesisArgs, ParaId, ParaInfo, ParaPastCodeMeta, ParaScheduling, ParachainDispatchOrigin, ParachainProposal, ParathreadClaim, ParathreadClaimQueue, ParathreadEntry, PersistedValidationData, QueryHolding, QueuedParathread, RegisteredParachainInfo, RelayChainBlockNumber, RelayTo, RelayedFrom, Remark, ReserveAssetDeposit, Retriable, Scheduling, SessionInfo, SignedAvailabilityBitfield, SignedAvailabilityBitfields, SigningContext, SlotRange, Statement, SubId, TeleportAsset, Transact, TransientValidationData, UpwardMessage, ValidationCode, ValidationData, ValidationDataType, ValidationFunctionParams, ValidatorGroup, ValidatorSignature, ValidityAttestation, VersionedMultiAsset, VersionedMultiLocation, VersionedXcm, WinnersData, WinnersDataTuple, WinningData, WinningDataEntry, WithdrawAsset, Xcm, XcmError, XcmResult } from '@polkadot/types/interfaces/parachains'; import type { RuntimeDispatchInfo } from '@polkadot/types/interfaces/payment'; import type { Approvals } from '@polkadot/types/interfaces/poll'; import type { ProxyAnnouncement, ProxyDefinition, ProxyType } from '@polkadot/types/interfaces/proxy'; @@ -74,6 +75,7 @@ declare module '@polkadot/types/types/registry' { 'Compact': Compact; 'Compact': Compact; 'Compact': Compact; + 'Compact': Compact; 'Compact': Compact; 'Compact': Compact; 'Compact': Compact; @@ -281,6 +283,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -405,6 +408,8 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -426,11 +431,9 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; - 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; - 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -478,6 +481,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -529,6 +533,7 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -826,6 +831,8 @@ declare module '@polkadot/types/types/registry' { 'Option': Option; 'Option': Option; 'Option': Option; + 'Option': Option; + 'Option': Option; 'Option': Option; 'Option': Option; 'Option': Option; @@ -982,6 +989,7 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1106,6 +1114,8 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1127,11 +1137,9 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; - 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; - 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1179,6 +1187,7 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1230,6 +1239,7 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1527,6 +1537,8 @@ declare module '@polkadot/types/types/registry' { 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; + 'Vec': Vec; + 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; 'Vec': Vec; @@ -1683,6 +1695,7 @@ declare module '@polkadot/types/types/registry' { DefunctVoter: DefunctVoter; Delegations: Delegations; DeletedContract: DeletedContract; + DeployData: DeployData; DepositAsset: DepositAsset; DepositReserveAsset: DepositReserveAsset; Digest: Digest; @@ -1807,6 +1820,8 @@ declare module '@polkadot/types/types/registry' { FunctionMetadataV11: FunctionMetadataV11; FunctionMetadataV12: FunctionMetadataV12; FunctionMetadataV9: FunctionMetadataV9; + FundIndex: FundIndex; + FundInfo: FundInfo; Gas: Gas; GlobalValidationSchedule: GlobalValidationSchedule; GrandpaEquivocation: GrandpaEquivocation; @@ -1828,11 +1843,9 @@ declare module '@polkadot/types/types/registry' { Heartbeat: Heartbeat; HeartbeatTo244: HeartbeatTo244; HostConfiguration: HostConfiguration; - HostConfigurationTo13: HostConfigurationTo13; HostFnWeights: HostFnWeights; HrmpChannel: HrmpChannel; HrmpChannelId: HrmpChannelId; - HrmpChannelTo13: HrmpChannelTo13; HrmpOpenChannelRequest: HrmpOpenChannelRequest; i128: i128; I128: I128; @@ -1880,6 +1893,7 @@ declare module '@polkadot/types/types/registry' { KeyValue: KeyValue; KeyValueOption: KeyValueOption; Kind: Kind; + LastContribution: LastContribution; LastRuntimeUpgradeInfo: LastRuntimeUpgradeInfo; LeasePeriod: LeasePeriod; LeasePeriodOf: LeasePeriodOf; @@ -1931,6 +1945,7 @@ declare module '@polkadot/types/types/registry' { NetworkStatePeerset: NetworkStatePeerset; NetworkStatePeersetInfo: NetworkStatePeersetInfo; NewBidder: NewBidder; + NewBidderOption: NewBidderOption; NextAuthority: NextAuthority; NextConfigDescriptor: NextConfigDescriptor; NextConfigDescriptorV1: NextConfigDescriptorV1; @@ -2228,6 +2243,8 @@ declare module '@polkadot/types/types/registry' { WeightMultiplier: WeightMultiplier; WeightPerClass: WeightPerClass; WeightToFeeCoefficient: WeightToFeeCoefficient; + WinnersData: WinnersData; + WinnersDataTuple: WinnersDataTuple; WinningData: WinningData; WinningDataEntry: WinningDataEntry; WithdrawAsset: WithdrawAsset; diff --git a/packages/types/src/interfaces/crowdloan/definitions.ts b/packages/types/src/interfaces/crowdloan/definitions.ts new file mode 100644 index 0000000000..8513d276cc --- /dev/null +++ b/packages/types/src/interfaces/crowdloan/definitions.ts @@ -0,0 +1,38 @@ +// Copyright 2017-2021 @polkadot/types authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +// order important in structs... :) +/* eslint-disable sort-keys */ + +import type { Definitions } from '../../types'; + +export default { + rpc: {}, + types: { + FundIndex: 'u32', + LastContribution: { + _enum: { + Never: 'Null', + PreEnding: 'AuctionIndex', + Ending: 'BlockNumber' + } + }, + DeployData: { + codeHash: 'Hash', + codeSize: 'u32', + initialHeadData: 'HeadData' + }, + FundInfo: { + parachain: 'Option', + owner: 'AccountId', + deposit: 'Balance', + raised: 'Balance', + end: 'BlockNumber', + cap: 'Balance', + lastContribution: 'LastContribution', + firstSlot: 'BlockNumber', + lastSlot: 'BlockNumber', + deployData: 'Option' + } + } +} as Definitions; diff --git a/packages/types/src/interfaces/crowdloan/index.ts b/packages/types/src/interfaces/crowdloan/index.ts new file mode 100644 index 0000000000..2d307291c3 --- /dev/null +++ b/packages/types/src/interfaces/crowdloan/index.ts @@ -0,0 +1,4 @@ +// Auto-generated via `yarn polkadot-types-from-defs`, do not edit +/* eslint-disable */ + +export * from './types'; diff --git a/packages/types/src/interfaces/crowdloan/types.ts b/packages/types/src/interfaces/crowdloan/types.ts new file mode 100644 index 0000000000..ddce183b2c --- /dev/null +++ b/packages/types/src/interfaces/crowdloan/types.ts @@ -0,0 +1,41 @@ +// Auto-generated via `yarn polkadot-types-from-defs`, do not edit +/* eslint-disable */ + +import type { Enum, Option, Struct, u32 } from '@polkadot/types'; +import type { AuctionIndex, HeadData, ParaId } from '@polkadot/types/interfaces/parachains'; +import type { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces/runtime'; + +/** @name DeployData */ +export interface DeployData extends Struct { + readonly codeHash: Hash; + readonly codeSize: u32; + readonly initialHeadData: HeadData; +} + +/** @name FundIndex */ +export interface FundIndex extends u32 {} + +/** @name FundInfo */ +export interface FundInfo extends Struct { + readonly parachain: Option; + readonly owner: AccountId; + readonly deposit: Balance; + readonly raised: Balance; + readonly end: BlockNumber; + readonly cap: Balance; + readonly lastContribution: LastContribution; + readonly firstSlot: BlockNumber; + readonly lastSlot: BlockNumber; + readonly deployData: Option; +} + +/** @name LastContribution */ +export interface LastContribution extends Enum { + readonly isNever: boolean; + readonly isPreEnding: boolean; + readonly asPreEnding: AuctionIndex; + readonly isEnding: boolean; + readonly asEnding: BlockNumber; +} + +export type PHANTOM_CROWDLOAN = 'crowdloan'; diff --git a/packages/types/src/interfaces/definitions.ts b/packages/types/src/interfaces/definitions.ts index 06015a783a..0ad53669ec 100644 --- a/packages/types/src/interfaces/definitions.ts +++ b/packages/types/src/interfaces/definitions.ts @@ -41,6 +41,7 @@ export { default as vesting } from './vesting/definitions'; // polkadot-specific types export { default as attestations } from './attestations/definitions'; export { default as claims } from './claims/definitions'; +export { default as crowdloan } from './crowdloan/definitions'; export { default as parachains } from './parachains/definitions'; export { default as poll } from './poll/definitions'; export { default as purchase } from './purchase/definitions'; diff --git a/packages/types/src/interfaces/parachains/definitions.ts b/packages/types/src/interfaces/parachains/definitions.ts index f8867b9330..a3efa4a5c9 100644 --- a/packages/types/src/interfaces/parachains/definitions.ts +++ b/packages/types/src/interfaces/parachains/definitions.ts @@ -6,7 +6,8 @@ import type { Definitions } from '../../types'; -const SLOT_RANGE_COUNT = 10; +import hrmpTypes from './hrmp'; +import slotTypes from './slots'; // proposeParachain const proposeTypes = { @@ -24,47 +25,12 @@ const proposeTypes = { } }; -// hrmp -const hrmpTypes = { - HrmpChannelTo13: { - senderDeposit: 'Balance', - recipientDeposit: 'Balance', - maxCapacity: 'u32', - maxTotalSize: 'u32', - maxMessageSize: 'u32', - msgCount: 'u32', - totalSize: 'u32', - mqcHead: 'Option' - }, - HrmpChannel: { - maxCapacity: 'u32', - maxTotalSize: 'u32', - maxMessageSize: 'u32', - msgCount: 'u32', - totalSize: 'u32', - mqcHead: 'Option', - senderDeposit: 'Balance', - recipientDeposit: 'Balance' - }, - HrmpChannelId: { - sender: 'u32', - receiver: 'u32' - }, - HrmpOpenChannelRequest: { - confirmed: 'bool', - age: 'SessionIndex', - senderDeposit: 'Balance', - maxMessageSize: 'u32', - maxCapacity: 'u32', - maxTotalSize: 'u32' - } -}; - export default { rpc: {}, types: { ...proposeTypes, ...hrmpTypes, + ...slotTypes, AbridgedCandidateReceipt: { parachainIndex: 'ParaId', relayParent: 'Hash', @@ -106,7 +72,6 @@ export default { validatorIndices: 'BitVec' }, AuthorityDiscoveryId: 'AccountId', - AuctionIndex: 'u32', AvailabilityBitfield: 'BitVec', AvailabilityBitfieldRecord: { bitfield: 'AvailabilityBitfield', @@ -117,12 +82,6 @@ export default { validityVotes: 'Vec', validatorIndices: 'BitVec' }, - Bidder: { - _enum: { - New: 'NewBidder', - Existing: 'ParaId' - } - }, BufferedSessionChange: { applyAt: 'BlockNumber', validators: 'Vec', @@ -232,44 +191,6 @@ export default { neededApprovals: 'u32', relayVrfModuloSamples: 'u32' }, - HostConfigurationTo13: { - validationUpgradeFrequency: 'BlockNumber', - validationUpgradeDelay: 'BlockNumber', - acceptancePeriod: 'BlockNumber', - maxCodeSize: 'u32', - maxHeadDataSize: 'u32', - maxPovSize: 'u32', - parathreadCores: 'u32', - parathreadRetries: 'u32', - groupRotationFrequency: 'BlockNumber', - chainAvailabilityPeriod: 'BlockNumber', - threadAvailabilityPeriod: 'BlockNumber', - schedulingLookahead: 'u32', - maxValidatorsPerCore: 'Option', - disputePeriod: 'SessionIndex', - noShowSlots: 'u32', - nDelayTranches: 'u32', - zerothDelayTrancheWidth: 'u32', - neededApprovals: 'u32', - relayVrfModuloSamples: 'u32', - maxUpwardQueueCount: 'u32', - maxUpwardQueueSize: 'u32', - maxDownwardMessageSize: 'u32', - preferredDispatchableUpwardMessagesStepWeight: 'Weight', - maxUpwardMessageSize: 'u32', - maxUpwardMessageNumPerCandidate: 'u32', - hrmpOpenRequestTtl: 'u32', - hrmpSenderDeposit: 'Balance', - hrmpRecipientDeposit: 'Balance', - hrmpChannelMaxCapacity: 'u32', - hrmpChannelMaxTotalSize: 'u32', - hrmpMaxParachainInboundChannels: 'u32', - hrmpMaxParathreadInboundChannels: 'u32', - hrmpChannelMaxMessageSize: 'u32', - hrmpMaxParachainOutboundChannels: 'u32', - hrmpMaxParathreadOutboundChannels: 'u32', - hrmpMaxMessageNumPerCandidate: 'u32' - }, InboundDownwardMessage: { pubSentAt: 'BlockNumber', pubMsg: 'DownwardMessage' @@ -279,24 +200,6 @@ export default { data: 'Bytes' }, InboundHrmpMessages: 'Vec', - IncomingParachain: { - _enum: { - Unset: 'NewBidder', - Fixed: 'IncomingParachainFixed', - Deploy: 'IncomingParachainDeploy' - } - }, - IncomingParachainFixed: { - codeHash: 'Hash', - codeSize: 'u32', - initialHeadData: 'HeadData' - }, - IncomingParachainDeploy: { - code: 'ValidationCode', - initialHeadData: 'HeadData' - }, - LeasePeriod: 'BlockNumber', - LeasePeriodOf: 'LeasePeriod', LocalValidationData: { parentHead: 'HeadData', balance: 'Balance', @@ -306,10 +209,6 @@ export default { downwardMessages: 'Vec', horizontalMessages: 'BTreeMap' }, - NewBidder: { - who: 'AccountId', - sub: 'SubId' - }, OutboundHrmpMessage: { recipient: 'u32', data: 'Bytes' @@ -387,9 +286,6 @@ export default { sessionIndex: 'SessionIndex', parentHash: 'Hash' }, - SlotRange: { - _enum: ['ZeroZero', 'ZeroOne', 'ZeroTwo', 'ZeroThree', 'OneOne', 'OneTwo', 'OneThree', 'TwoTwo', 'TwoThree', 'ThreeThree'] - }, Statement: { _enum: { Never: 'Null', // starts at 1 @@ -398,7 +294,6 @@ export default { Invalid: 'Hash' } }, - SubId: 'u32', TransientValidationData: { maxCodeSize: 'u32', maxHeadDataSize: 'u32', @@ -435,8 +330,6 @@ export default { V0: 'Xcm' } }, - WinningData: `[WinningDataEntry; ${SLOT_RANGE_COUNT}]`, - WinningDataEntry: 'Option', WithdrawAsset: { assets: 'Vec', effects: 'Vec' diff --git a/packages/types/src/interfaces/parachains/hrmp.ts b/packages/types/src/interfaces/parachains/hrmp.ts new file mode 100644 index 0000000000..fb563fac08 --- /dev/null +++ b/packages/types/src/interfaces/parachains/hrmp.ts @@ -0,0 +1,30 @@ +// Copyright 2017-2021 @polkadot/types authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +// order important in structs... :) +/* eslint-disable sort-keys */ + +export default { + HrmpChannel: { + maxCapacity: 'u32', + maxTotalSize: 'u32', + maxMessageSize: 'u32', + msgCount: 'u32', + totalSize: 'u32', + mqcHead: 'Option', + senderDeposit: 'Balance', + recipientDeposit: 'Balance' + }, + HrmpChannelId: { + sender: 'u32', + receiver: 'u32' + }, + HrmpOpenChannelRequest: { + confirmed: 'bool', + age: 'SessionIndex', + senderDeposit: 'Balance', + maxMessageSize: 'u32', + maxCapacity: 'u32', + maxTotalSize: 'u32' + } +}; diff --git a/packages/types/src/interfaces/parachains/slots.ts b/packages/types/src/interfaces/parachains/slots.ts new file mode 100644 index 0000000000..430912f3ac --- /dev/null +++ b/packages/types/src/interfaces/parachains/slots.ts @@ -0,0 +1,48 @@ +// Copyright 2017-2021 @polkadot/types authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +// order important in structs... :) +/* eslint-disable sort-keys */ + +const SLOT_RANGE_COUNT = 10; + +export default { + AuctionIndex: 'u32', + Bidder: { + _enum: { + New: 'NewBidder', + Existing: 'ParaId' + } + }, + IncomingParachain: { + _enum: { + Unset: 'NewBidder', + Fixed: 'IncomingParachainFixed', + Deploy: 'IncomingParachainDeploy' + } + }, + IncomingParachainDeploy: { + code: 'ValidationCode', + initialHeadData: 'HeadData' + }, + IncomingParachainFixed: { + codeHash: 'Hash', + codeSize: 'u32', + initialHeadData: 'HeadData' + }, + LeasePeriod: 'BlockNumber', + LeasePeriodOf: 'BlockNumber', + NewBidder: { + who: 'AccountId', + sub: 'SubId' + }, + NewBidderOption: 'Option', + SlotRange: { + _enum: ['ZeroZero', 'ZeroOne', 'ZeroTwo', 'ZeroThree', 'OneOne', 'OneTwo', 'OneThree', 'TwoTwo', 'TwoThree', 'ThreeThree'] + }, + SubId: 'u32', + WinningData: `[WinningDataEntry; ${SLOT_RANGE_COUNT}]`, + WinningDataEntry: 'Option', + WinnersData: 'Vec', + WinnersDataTuple: '(NewBidderOption, ParaId, BalanceOf, SlotRange)' +}; diff --git a/packages/types/src/interfaces/parachains/types.ts b/packages/types/src/interfaces/parachains/types.ts index 9e80b831fa..ad83a2fb40 100644 --- a/packages/types/src/interfaces/parachains/types.ts +++ b/packages/types/src/interfaces/parachains/types.ts @@ -4,7 +4,7 @@ import type { BTreeMap, BitVec, Bytes, Compact, Enum, Option, Struct, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types'; import type { ITuple } from '@polkadot/types/types'; import type { Signature } from '@polkadot/types/interfaces/extrinsics'; -import type { AccountId, Balance, BlockNumber, Hash, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime'; +import type { AccountId, Balance, BalanceOf, BlockNumber, Hash, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime'; import type { MembershipProof, SessionIndex } from '@polkadot/types/interfaces/session'; import type { ValidatorIndex } from '@polkadot/types/interfaces/staking'; @@ -325,46 +325,6 @@ export interface HostConfiguration extends Struct { readonly relayVrfModuloSamples: u32; } -/** @name HostConfigurationTo13 */ -export interface HostConfigurationTo13 extends Struct { - readonly validationUpgradeFrequency: BlockNumber; - readonly validationUpgradeDelay: BlockNumber; - readonly acceptancePeriod: BlockNumber; - readonly maxCodeSize: u32; - readonly maxHeadDataSize: u32; - readonly maxPovSize: u32; - readonly parathreadCores: u32; - readonly parathreadRetries: u32; - readonly groupRotationFrequency: BlockNumber; - readonly chainAvailabilityPeriod: BlockNumber; - readonly threadAvailabilityPeriod: BlockNumber; - readonly schedulingLookahead: u32; - readonly maxValidatorsPerCore: Option; - readonly disputePeriod: SessionIndex; - readonly noShowSlots: u32; - readonly nDelayTranches: u32; - readonly zerothDelayTrancheWidth: u32; - readonly neededApprovals: u32; - readonly relayVrfModuloSamples: u32; - readonly maxUpwardQueueCount: u32; - readonly maxUpwardQueueSize: u32; - readonly maxDownwardMessageSize: u32; - readonly preferredDispatchableUpwardMessagesStepWeight: Weight; - readonly maxUpwardMessageSize: u32; - readonly maxUpwardMessageNumPerCandidate: u32; - readonly hrmpOpenRequestTtl: u32; - readonly hrmpSenderDeposit: Balance; - readonly hrmpRecipientDeposit: Balance; - readonly hrmpChannelMaxCapacity: u32; - readonly hrmpChannelMaxTotalSize: u32; - readonly hrmpMaxParachainInboundChannels: u32; - readonly hrmpMaxParathreadInboundChannels: u32; - readonly hrmpChannelMaxMessageSize: u32; - readonly hrmpMaxParachainOutboundChannels: u32; - readonly hrmpMaxParathreadOutboundChannels: u32; - readonly hrmpMaxMessageNumPerCandidate: u32; -} - /** @name HrmpChannel */ export interface HrmpChannel extends Struct { readonly maxCapacity: u32; @@ -383,18 +343,6 @@ export interface HrmpChannelId extends Struct { readonly receiver: u32; } -/** @name HrmpChannelTo13 */ -export interface HrmpChannelTo13 extends Struct { - readonly senderDeposit: Balance; - readonly recipientDeposit: Balance; - readonly maxCapacity: u32; - readonly maxTotalSize: u32; - readonly maxMessageSize: u32; - readonly msgCount: u32; - readonly totalSize: u32; - readonly mqcHead: Option; -} - /** @name HrmpOpenChannelRequest */ export interface HrmpOpenChannelRequest extends Struct { readonly confirmed: bool; @@ -481,7 +429,7 @@ export interface Junction extends Enum { export interface LeasePeriod extends BlockNumber {} /** @name LeasePeriodOf */ -export interface LeasePeriodOf extends LeasePeriod {} +export interface LeasePeriodOf extends BlockNumber {} /** @name LocalValidationData */ export interface LocalValidationData extends Struct { @@ -548,6 +496,9 @@ export interface NewBidder extends Struct { readonly sub: SubId; } +/** @name NewBidderOption */ +export interface NewBidderOption extends Option {} + /** @name Order */ export interface Order extends Enum { readonly isNull: boolean; @@ -840,6 +791,12 @@ export interface VersionedXcm extends Enum { readonly asV0: Xcm; } +/** @name WinnersData */ +export interface WinnersData extends Vec {} + +/** @name WinnersDataTuple */ +export interface WinnersDataTuple extends ITuple<[NewBidderOption, ParaId, BalanceOf, SlotRange]> {} + /** @name WinningData */ export interface WinningData extends Vec {} diff --git a/packages/types/src/interfaces/types.ts b/packages/types/src/interfaces/types.ts index 1c6ea355ee..f42bbc1993 100644 --- a/packages/types/src/interfaces/types.ts +++ b/packages/types/src/interfaces/types.ts @@ -36,6 +36,7 @@ export * from './utility/types'; export * from './vesting/types'; export * from './attestations/types'; export * from './claims/types'; +export * from './crowdloan/types'; export * from './parachains/types'; export * from './poll/types'; export * from './purchase/types';