git.delta.rocks / unique-network / refs/commits / 68b26b95f7a0

difftreelog

CORE-238 add effective_collection_limits

Trubnikov Sergey2022-03-24parent: #c8aac15.patch.diff
in: master

13 files changed

modifiedCargo.lockdiffbeforeafterboth
9359 "sp-runtime",9359 "sp-runtime",
9360]9360]
9361
9362[[package]]
9363name = "sc-consensus-manual-seal"
9364version = "0.10.0-dev"
9365source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.17#22d40c761a985482f93bbbea5ba4199bdba74f8e"
9366dependencies = [
9367 "assert_matches",
9368 "async-trait",
9369 "futures 0.3.21",
9370 "jsonrpc-core",
9371 "jsonrpc-core-client",
9372 "jsonrpc-derive",
9373 "log",
9374 "parity-scale-codec",
9375 "sc-client-api",
9376 "sc-consensus",
9377 "sc-consensus-aura",
9378 "sc-consensus-babe",
9379 "sc-consensus-epochs",
9380 "sc-transaction-pool",
9381 "sc-transaction-pool-api",
9382 "serde",
9383 "sp-api",
9384 "sp-blockchain",
9385 "sp-consensus",
9386 "sp-consensus-aura",
9387 "sp-consensus-babe",
9388 "sp-consensus-slots",
9389 "sp-core",
9390 "sp-inherents",
9391 "sp-keystore",
9392 "sp-runtime",
9393 "sp-timestamp",
9394 "substrate-prometheus-endpoint",
9395 "thiserror",
9396]
93619397
9362[[package]]9398[[package]]
9363name = "sc-consensus-slots"9399name = "sc-consensus-slots"
11697 "chrono",11733 "chrono",
11698 "lazy_static",11734 "lazy_static",
11699 "matchers",11735 "matchers",
11700 "parking_lot 0.11.2",11736 "parking_lot 0.10.2",
11701 "regex",11737 "regex",
11702 "serde",11738 "serde",
11703 "serde_json",11739 "serde_json",
11957 "sc-client-api",11993 "sc-client-api",
11958 "sc-consensus",11994 "sc-consensus",
11959 "sc-consensus-aura",11995 "sc-consensus-aura",
11996 "sc-consensus-manual-seal",
11960 "sc-executor",11997 "sc-executor",
11961 "sc-finality-grandpa",11998 "sc-finality-grandpa",
11962 "sc-keystore",11999 "sc-keystore",
modifiedclient/rpc/src/lib.rsdiffbeforeafterboth
19use codec::Decode;19use codec::Decode;
20use jsonrpc_core::{Error as RpcError, ErrorCode, Result};20use jsonrpc_core::{Error as RpcError, ErrorCode, Result};
21use jsonrpc_derive::rpc;21use jsonrpc_derive::rpc;
22use up_data_structs::{Collection, CollectionId, CollectionStats, TokenId};22use up_data_structs::{Collection, CollectionId, CollectionStats, CollectionLimits, TokenId};
23use sp_api::{BlockId, BlockT, ProvideRuntimeApi, ApiExt};23use sp_api::{BlockId, BlockT, ProvideRuntimeApi, ApiExt};
24use sp_blockchain::HeaderBackend;24use sp_blockchain::HeaderBackend;
25use up_rpc::UniqueApi as UniqueRuntimeApi;25use up_rpc::UniqueApi as UniqueRuntimeApi;
119 ) -> Result<Option<Collection<AccountId>>>;119 ) -> Result<Option<Collection<AccountId>>>;
120 #[rpc(name = "unique_collectionStats")]120 #[rpc(name = "unique_collectionStats")]
121 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;121 fn collection_stats(&self, at: Option<BlockHash>) -> Result<CollectionStats>;
122 #[rpc(name = "unique_effectiveCollectionLimits")]
123 fn effective_collection_limits(
124 &self,
125 collection_id: CollectionId,
126 at: Option<BlockHash>
127 ) -> Result<Option<CollectionLimits>>;
122}128}
123129
124pub struct Unique<C, P> {130pub struct Unique<C, P> {
222 pass_method!(last_token_id(collection: CollectionId) -> TokenId);228 pass_method!(last_token_id(collection: CollectionId) -> TokenId);
223 pass_method!(collection_by_id(collection: CollectionId) -> Option<Collection<AccountId>>);229 pass_method!(collection_by_id(collection: CollectionId) -> Option<Collection<AccountId>>);
224 pass_method!(collection_stats() -> CollectionStats);230 pass_method!(collection_stats() -> CollectionStats);
231 pass_method!(effective_collection_limits(collection_id: CollectionId) -> Option<CollectionLimits>);
225}232}
226233
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
33 TokenId, Weight, WithdrawReasons, CollectionStats, MAX_TOKEN_OWNERSHIP, CollectionMode,33 TokenId, Weight, WithdrawReasons, CollectionStats, MAX_TOKEN_OWNERSHIP, CollectionMode,
34 NFT_SPONSOR_TRANSFER_TIMEOUT, FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,34 NFT_SPONSOR_TRANSFER_TIMEOUT, FUNGIBLE_SPONSOR_TRANSFER_TIMEOUT,
35 REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT, CUSTOM_DATA_LIMIT, CollectionLimits,35 REFUNGIBLE_SPONSOR_TRANSFER_TIMEOUT, MAX_SPONSOR_TIMEOUT, CUSTOM_DATA_LIMIT, CollectionLimits,
36 CustomDataLimit, CreateCollectionData, SponsorshipState, CreateItemExData,36 CustomDataLimit, CreateCollectionData, SponsorshipState, CreateItemExData, SponsoringRateLimit
37};37};
38pub use pallet::*;38pub use pallet::*;
39use sp_core::H160;39use sp_core::H160;
422 }422 }
423 }423 }
424
425 pub fn effective_collection_limits(collection: CollectionId) -> Option<CollectionLimits> {
426 let collection = <CollectionById<T>>::get(collection);
427 if collection.is_none() {
428 return None;
429 }
430
431 let limits = collection.unwrap().limits;
432 let effective_limits = CollectionLimits {
433 account_token_ownership_limit: Some(limits.account_token_ownership_limit()),
434 sponsored_data_size: Some(limits.sponsored_data_size()),
435 sponsored_data_rate_limit: Some(
436 limits.sponsored_data_rate_limit
437 .unwrap_or(SponsoringRateLimit::SponsoringDisabled)),
438 token_limit: Some(limits.token_limit()),
439 sponsor_transfer_timeout: Some(limits.sponsor_transfer_timeout(MAX_SPONSOR_TIMEOUT)),
440 sponsor_approve_timeout: Some(limits.sponsor_approve_timeout()),
441 owner_can_transfer: Some(limits.owner_can_transfer()),
442 owner_can_destroy: Some(limits.owner_can_destroy()),
443 transfers_enabled: Some(limits.transfers_enabled()),
444 };
445
446 Some(effective_limits)
447 }
424}448}
425449
426impl<T: Config> Pallet<T> {450impl<T: Config> Pallet<T> {
modifiedprimitives/rpc/src/lib.rsdiffbeforeafterboth
1616
17#![cfg_attr(not(feature = "std"), no_std)]17#![cfg_attr(not(feature = "std"), no_std)]
1818
19use up_data_structs::{CollectionId, TokenId, Collection, CollectionStats};19use up_data_structs::{CollectionId, TokenId, Collection, CollectionStats, CollectionLimits};
20use sp_std::vec::Vec;20use sp_std::vec::Vec;
21use sp_core::H160;21use sp_core::H160;
22use codec::Decode;22use codec::Decode;
59 fn last_token_id(collection: CollectionId) -> Result<TokenId>;59 fn last_token_id(collection: CollectionId) -> Result<TokenId>;
60 fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>>;60 fn collection_by_id(collection: CollectionId) -> Result<Option<Collection<AccountId>>>;
61 fn collection_stats() -> Result<CollectionStats>;61 fn collection_stats() -> Result<CollectionStats>;
62 fn effective_collection_limits(collection_id: CollectionId) -> Result<Option<CollectionLimits>>;
62 }63 }
63}64}
6465
modifiedruntime/common/src/runtime_apis.rsdiffbeforeafterboth
70 Ok(<pallet_common::Pallet<Runtime>>::collection_stats())70 Ok(<pallet_common::Pallet<Runtime>>::collection_stats())
71 }71 }
72
73 fn effective_collection_limits(collection: CollectionId) -> Result<Option<CollectionLimits>, DispatchError> {
74 Ok(<pallet_common::Pallet<Runtime>>::effective_collection_limits(collection))
75 }
72 }76 }
7377
74 impl sp_api::Core<Block> for Runtime {78 impl sp_api::Core<Block> for Runtime {
modifiedtests/src/interfaces/augment-api-errors.tsdiffbeforeafterboth
104 * No permission to perform action104 * No permission to perform action
105 **/105 **/
106 NoPermission: AugmentedError<ApiType>;106 NoPermission: AugmentedError<ApiType>;
107 /**
108 * Not sufficient founds to perform action
109 **/
110 NotSufficientFounds: AugmentedError<ApiType>;
107 /**111 /**
108 * Tried to enable permissions which are only permitted to be disabled112 * Tried to enable permissions which are only permitted to be disabled
109 **/113 **/
modifiedtests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth
1// Auto-generated via `yarn polkadot-types-from-chain`, do not edit1// Auto-generated via `yarn polkadot-types-from-chain`, do not edit
2/* eslint-disable */2/* eslint-disable */
33
4import type { PalletCommonAccountBasicCrossAccountIdRepr, UpDataStructsCollection, UpDataStructsCollectionStats } from './unique';4import type { PalletCommonAccountBasicCrossAccountIdRepr, UpDataStructsCollection, UpDataStructsCollectionLimits, UpDataStructsCollectionStats } from './unique';
5import type { AugmentedRpc } from '@polkadot/rpc-core/types';5import type { AugmentedRpc } from '@polkadot/rpc-core/types';
6import type { Metadata, StorageKey } from '@polkadot/types';6import type { Metadata, StorageKey } from '@polkadot/types';
7import type { Bytes, HashMap, Json, Null, Option, Text, U256, U64, Vec, bool, u128, u32, u64 } from '@polkadot/types-codec';7import type { Bytes, HashMap, Json, Null, Option, Text, U256, U64, Vec, bool, u128, u32, u64 } from '@polkadot/types-codec';
603 * Get token constant metadata603 * Get token constant metadata
604 **/604 **/
605 constMetadata: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Bytes>>;605 constMetadata: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Bytes>>;
606 /**
607 * Get effective collection limits
608 **/
609 effectiveCollectionLimits: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<UpDataStructsCollectionLimits>>>;
606 /**610 /**
607 * Get last token id611 * Get last token id
608 **/612 **/
modifiedtests/src/interfaces/augment-types.tsdiffbeforeafterboth
1// Auto-generated via `yarn polkadot-types-from-defs`, do not edit1// Auto-generated via `yarn polkadot-types-from-defs`, do not edit
2/* eslint-disable */2/* eslint-disable */
33
4import type { CumulusPalletDmpQueueCall, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueueError, CumulusPalletDmpQueueEvent, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCall, CumulusPalletParachainSystemError, CumulusPalletParachainSystemEvent, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmCall, CumulusPalletXcmError, CumulusPalletXcmEvent, CumulusPalletXcmpQueueCall, CumulusPalletXcmpQueueError, CumulusPalletXcmpQueueEvent, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueInboundState, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueOutboundState, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FpRpcTransactionStatus, FrameSupportPalletId, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchClass, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPays, FrameSupportWeightsPerDispatchClassU32, FrameSupportWeightsPerDispatchClassU64, FrameSupportWeightsPerDispatchClassWeightsPerClass, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, OrmlVestingModuleCall, OrmlVestingModuleError, OrmlVestingModuleEvent, OrmlVestingVestingSchedule, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesReasons, PalletBalancesReleases, PalletBalancesReserveData, PalletCommonAccountBasicCrossAccountIdRepr, PalletCommonError, PalletCommonEvent, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEvmCall, PalletEvmCoderSubstrateError, PalletEvmContractHelpersError, PalletEvmContractHelpersSponsoringModeT, PalletEvmError, PalletEvmEvent, PalletEvmMigrationCall, PalletEvmMigrationError, PalletFungibleError, PalletInflationCall, PalletNonfungibleError, PalletNonfungibleItemData, PalletRefungibleError, PalletRefungibleItemData, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTemplateTransactionPaymentCall, PalletTemplateTransactionPaymentChargeTransactionPayment, PalletTimestampCall, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUniqueCall, PalletUniqueError, PalletUniqueRawEvent, PalletXcmCall, PalletXcmError, PalletXcmEvent, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV1AbridgedHostConfiguration, PolkadotPrimitivesV1AbridgedHrmpChannel, PolkadotPrimitivesV1PersistedValidationData, PolkadotPrimitivesV1UpgradeRestriction, SpCoreEcdsaSignature, SpCoreEd25519Signature, SpCoreSr25519Signature, SpRuntimeArithmeticError, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpTrieStorageProof, SpVersionRuntimeVersion, UniqueRuntimeRuntime, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionStats, UpDataStructsCreateCollectionData, UpDataStructsCreateFungibleData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsCreateNftData, UpDataStructsCreateNftExData, UpDataStructsCreateReFungibleData, UpDataStructsCreateRefungibleExData, UpDataStructsMetaUpdatePermission, UpDataStructsSchemaVersion, UpDataStructsSponsoringRateLimit, UpDataStructsSponsorshipState, XcmDoubleEncoded, XcmV0Junction, XcmV0JunctionBodyId, XcmV0JunctionBodyPart, XcmV0JunctionNetworkId, XcmV0MultiAsset, XcmV0MultiLocation, XcmV0Order, XcmV0OriginKind, XcmV0Response, XcmV0Xcm, XcmV1Junction, XcmV1MultiAsset, XcmV1MultiLocation, XcmV1MultiassetAssetId, XcmV1MultiassetAssetInstance, XcmV1MultiassetFungibility, XcmV1MultiassetMultiAssetFilter, XcmV1MultiassetMultiAssets, XcmV1MultiassetWildFungibility, XcmV1MultiassetWildMultiAsset, XcmV1MultilocationJunctions, XcmV1Order, XcmV1Response, XcmV1Xcm, XcmV2Instruction, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2WeightLimit, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from './unique';4import type { CumulusPalletDmpQueueCall, CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueueError, CumulusPalletDmpQueueEvent, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCall, CumulusPalletParachainSystemError, CumulusPalletParachainSystemEvent, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmCall, CumulusPalletXcmError, CumulusPalletXcmEvent, CumulusPalletXcmpQueueCall, CumulusPalletXcmpQueueError, CumulusPalletXcmpQueueEvent, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueInboundState, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueOutboundState, CumulusPalletXcmpQueueQueueConfigData, CumulusPrimitivesParachainInherentParachainInherentData, EthbloomBloom, EthereumBlock, EthereumHeader, EthereumLog, EthereumReceiptEip658ReceiptData, EthereumReceiptReceiptV3, EthereumTransactionAccessListItem, EthereumTransactionEip1559Transaction, EthereumTransactionEip2930Transaction, EthereumTransactionLegacyTransaction, EthereumTransactionTransactionAction, EthereumTransactionTransactionSignature, EthereumTransactionTransactionV2, EthereumTypesHashH64, EvmCoreErrorExitError, EvmCoreErrorExitFatal, EvmCoreErrorExitReason, EvmCoreErrorExitRevert, EvmCoreErrorExitSucceed, FpRpcTransactionStatus, FrameSupportPalletId, FrameSupportTokensMiscBalanceStatus, FrameSupportWeightsDispatchClass, FrameSupportWeightsDispatchInfo, FrameSupportWeightsPays, FrameSupportWeightsPerDispatchClassU32, FrameSupportWeightsPerDispatchClassU64, FrameSupportWeightsPerDispatchClassWeightsPerClass, FrameSupportWeightsRuntimeDbWeight, FrameSupportWeightsWeightToFeeCoefficient, FrameSystemAccountInfo, FrameSystemCall, FrameSystemError, FrameSystemEvent, FrameSystemEventRecord, FrameSystemExtensionsCheckGenesis, FrameSystemExtensionsCheckNonce, FrameSystemExtensionsCheckSpecVersion, FrameSystemExtensionsCheckWeight, FrameSystemLastRuntimeUpgradeInfo, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, FrameSystemLimitsWeightsPerClass, FrameSystemPhase, OpalRuntimeRuntime, OrmlVestingModuleCall, OrmlVestingModuleError, OrmlVestingModuleEvent, OrmlVestingVestingSchedule, PalletBalancesAccountData, PalletBalancesBalanceLock, PalletBalancesCall, PalletBalancesError, PalletBalancesEvent, PalletBalancesReasons, PalletBalancesReleases, PalletBalancesReserveData, PalletCommonAccountBasicCrossAccountIdRepr, PalletCommonError, PalletCommonEvent, PalletEthereumCall, PalletEthereumError, PalletEthereumEvent, PalletEvmCall, PalletEvmCoderSubstrateError, PalletEvmContractHelpersError, PalletEvmContractHelpersSponsoringModeT, PalletEvmError, PalletEvmEvent, PalletEvmMigrationCall, PalletEvmMigrationError, PalletFungibleError, PalletInflationCall, PalletNonfungibleError, PalletNonfungibleItemData, PalletRefungibleError, PalletRefungibleItemData, PalletSudoCall, PalletSudoError, PalletSudoEvent, PalletTemplateTransactionPaymentCall, PalletTemplateTransactionPaymentChargeTransactionPayment, PalletTimestampCall, PalletTransactionPaymentReleases, PalletTreasuryCall, PalletTreasuryError, PalletTreasuryEvent, PalletTreasuryProposal, PalletUniqueCall, PalletUniqueError, PalletUniqueRawEvent, PalletXcmCall, PalletXcmError, PalletXcmEvent, PolkadotCorePrimitivesInboundDownwardMessage, PolkadotCorePrimitivesInboundHrmpMessage, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotParachainPrimitivesXcmpMessageFormat, PolkadotPrimitivesV1AbridgedHostConfiguration, PolkadotPrimitivesV1AbridgedHrmpChannel, PolkadotPrimitivesV1PersistedValidationData, PolkadotPrimitivesV1UpgradeRestriction, SpCoreEcdsaSignature, SpCoreEd25519Signature, SpCoreSr25519Signature, SpRuntimeArithmeticError, SpRuntimeDigest, SpRuntimeDigestDigestItem, SpRuntimeDispatchError, SpRuntimeModuleError, SpRuntimeMultiSignature, SpRuntimeTokenError, SpTrieStorageProof, SpVersionRuntimeVersion, UpDataStructsAccessMode, UpDataStructsCollection, UpDataStructsCollectionLimits, UpDataStructsCollectionMode, UpDataStructsCollectionStats, UpDataStructsCreateCollectionData, UpDataStructsCreateFungibleData, UpDataStructsCreateItemData, UpDataStructsCreateItemExData, UpDataStructsCreateNftData, UpDataStructsCreateNftExData, UpDataStructsCreateReFungibleData, UpDataStructsCreateRefungibleExData, UpDataStructsMetaUpdatePermission, UpDataStructsSchemaVersion, UpDataStructsSponsoringRateLimit, UpDataStructsSponsorshipState, XcmDoubleEncoded, XcmV0Junction, XcmV0JunctionBodyId, XcmV0JunctionBodyPart, XcmV0JunctionNetworkId, XcmV0MultiAsset, XcmV0MultiLocation, XcmV0Order, XcmV0OriginKind, XcmV0Response, XcmV0Xcm, XcmV1Junction, XcmV1MultiAsset, XcmV1MultiLocation, XcmV1MultiassetAssetId, XcmV1MultiassetAssetInstance, XcmV1MultiassetFungibility, XcmV1MultiassetMultiAssetFilter, XcmV1MultiassetMultiAssets, XcmV1MultiassetWildFungibility, XcmV1MultiassetWildMultiAsset, XcmV1MultilocationJunctions, XcmV1Order, XcmV1Response, XcmV1Xcm, XcmV2Instruction, XcmV2Response, XcmV2TraitsError, XcmV2TraitsOutcome, XcmV2WeightLimit, XcmV2Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from './unique';
5import type { Data, StorageKey } from '@polkadot/types';5import type { Data, StorageKey } from '@polkadot/types';
6import type { BitVec, Bool, Bytes, I128, I16, I256, I32, I64, I8, Json, Null, Raw, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types-codec';6import type { BitVec, Bool, Bytes, I128, I16, I256, I32, I64, I8, Json, Null, Raw, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types-codec';
7import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';7import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';
18import type { StatementKind } from '@polkadot/types/interfaces/claims';18import type { StatementKind } from '@polkadot/types/interfaces/claims';
19import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';19import type { CollectiveOrigin, MemberCount, ProposalIndex, Votes, VotesTo230 } from '@polkadot/types/interfaces/collective';
20import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';20import type { AuthorityId, RawVRFOutput } from '@polkadot/types/interfaces/consensus';
21import type { AliveContractInfo, CodeHash, CodeUploadRequest, CodeUploadResult, CodeUploadResultValue, ContractCallFlags, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractReturnFlags, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateReturnValue, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';21import type { AliveContractInfo, CodeHash, CodeSource, CodeUploadRequest, CodeUploadResult, CodeUploadResultValue, ContractCallFlags, ContractCallRequest, ContractExecResult, ContractExecResultErr, ContractExecResultErrModule, ContractExecResultOk, ContractExecResultResult, ContractExecResultSuccessTo255, ContractExecResultSuccessTo260, ContractExecResultTo255, ContractExecResultTo260, ContractExecResultTo267, ContractInfo, ContractInstantiateResult, ContractInstantiateResultTo267, ContractInstantiateResultTo299, ContractReturnFlags, ContractStorageKey, DeletedContract, ExecReturnValue, Gas, HostFnWeights, HostFnWeightsTo264, InstantiateRequest, InstantiateRequestV1, InstantiateRequestV2, InstantiateReturnValue, InstantiateReturnValueOk, InstantiateReturnValueTo267, InstructionWeights, Limits, LimitsTo264, PrefabWasmModule, RentProjection, Schedule, ScheduleTo212, ScheduleTo258, ScheduleTo264, SeedOf, StorageDeposit, TombstoneContractInfo, TrieId } from '@polkadot/types/interfaces/contracts';
22import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV1, ContractConstructorSpecV2, ContractConstructorSpecV3, ContractContractSpecV0, ContractContractSpecV1, ContractContractSpecV2, ContractContractSpecV3, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV1, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV1, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractMetadataV3, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';22import type { ContractConstructorSpecLatest, ContractConstructorSpecV0, ContractConstructorSpecV1, ContractConstructorSpecV2, ContractConstructorSpecV3, ContractContractSpecV0, ContractContractSpecV1, ContractContractSpecV2, ContractContractSpecV3, ContractCryptoHasher, ContractDiscriminant, ContractDisplayName, ContractEventParamSpecLatest, ContractEventParamSpecV0, ContractEventParamSpecV2, ContractEventSpecLatest, ContractEventSpecV0, ContractEventSpecV1, ContractEventSpecV2, ContractLayoutArray, ContractLayoutCell, ContractLayoutEnum, ContractLayoutHash, ContractLayoutHashingStrategy, ContractLayoutKey, ContractLayoutStruct, ContractLayoutStructField, ContractMessageParamSpecLatest, ContractMessageParamSpecV0, ContractMessageParamSpecV2, ContractMessageSpecLatest, ContractMessageSpecV0, ContractMessageSpecV1, ContractMessageSpecV2, ContractMetadata, ContractMetadataLatest, ContractMetadataV0, ContractMetadataV1, ContractMetadataV2, ContractMetadataV3, ContractProject, ContractProjectContract, ContractProjectInfo, ContractProjectSource, ContractProjectV0, ContractSelector, ContractStorageLayout, ContractTypeSpec } from '@polkadot/types/interfaces/contractsAbi';
23import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan';23import type { FundIndex, FundInfo, LastContribution, TrieIndex } from '@polkadot/types/interfaces/crowdloan';
24import type { ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData } from '@polkadot/types/interfaces/cumulus';24import type { ConfigData, MessageId, OverweightIndex, PageCounter, PageIndexData } from '@polkadot/types/interfaces/cumulus';
198 ClassMetadata: ClassMetadata;198 ClassMetadata: ClassMetadata;
199 CodecHash: CodecHash;199 CodecHash: CodecHash;
200 CodeHash: CodeHash;200 CodeHash: CodeHash;
201 CodeSource: CodeSource;
201 CodeUploadRequest: CodeUploadRequest;202 CodeUploadRequest: CodeUploadRequest;
202 CodeUploadResult: CodeUploadResult;203 CodeUploadResult: CodeUploadResult;
203 CodeUploadResultValue: CodeUploadResultValue;204 CodeUploadResultValue: CodeUploadResultValue;
250 ContractInfo: ContractInfo;251 ContractInfo: ContractInfo;
251 ContractInstantiateResult: ContractInstantiateResult;252 ContractInstantiateResult: ContractInstantiateResult;
252 ContractInstantiateResultTo267: ContractInstantiateResultTo267;253 ContractInstantiateResultTo267: ContractInstantiateResultTo267;
254 ContractInstantiateResultTo299: ContractInstantiateResultTo299;
253 ContractLayoutArray: ContractLayoutArray;255 ContractLayoutArray: ContractLayoutArray;
254 ContractLayoutCell: ContractLayoutCell;256 ContractLayoutCell: ContractLayoutCell;
255 ContractLayoutEnum: ContractLayoutEnum;257 ContractLayoutEnum: ContractLayoutEnum;
591 InstanceId: InstanceId;593 InstanceId: InstanceId;
592 InstanceMetadata: InstanceMetadata;594 InstanceMetadata: InstanceMetadata;
593 InstantiateRequest: InstantiateRequest;595 InstantiateRequest: InstantiateRequest;
596 InstantiateRequestV1: InstantiateRequestV1;
597 InstantiateRequestV2: InstantiateRequestV2;
594 InstantiateReturnValue: InstantiateReturnValue;598 InstantiateReturnValue: InstantiateReturnValue;
599 InstantiateReturnValueOk: InstantiateReturnValueOk;
595 InstantiateReturnValueTo267: InstantiateReturnValueTo267;600 InstantiateReturnValueTo267: InstantiateReturnValueTo267;
596 InstructionV2: InstructionV2;601 InstructionV2: InstructionV2;
597 InstructionWeights: InstructionWeights;602 InstructionWeights: InstructionWeights;
707 OffchainAccuracyCompact: OffchainAccuracyCompact;712 OffchainAccuracyCompact: OffchainAccuracyCompact;
708 OffenceDetails: OffenceDetails;713 OffenceDetails: OffenceDetails;
709 Offender: Offender;714 Offender: Offender;
715 OpalRuntimeRuntime: OpalRuntimeRuntime;
710 OpaqueCall: OpaqueCall;716 OpaqueCall: OpaqueCall;
711 OpaqueMultiaddr: OpaqueMultiaddr;717 OpaqueMultiaddr: OpaqueMultiaddr;
712 OpaqueNetworkState: OpaqueNetworkState;718 OpaqueNetworkState: OpaqueNetworkState;
1146 UnappliedSlash: UnappliedSlash;1152 UnappliedSlash: UnappliedSlash;
1147 UnappliedSlashOther: UnappliedSlashOther;1153 UnappliedSlashOther: UnappliedSlashOther;
1148 UncleEntryItem: UncleEntryItem;1154 UncleEntryItem: UncleEntryItem;
1149 UniqueRuntimeRuntime: UniqueRuntimeRuntime;
1150 UnknownTransaction: UnknownTransaction;1155 UnknownTransaction: UnknownTransaction;
1151 UnlockChunk: UnlockChunk;1156 UnlockChunk: UnlockChunk;
1152 UnrewardedRelayer: UnrewardedRelayer;1157 UnrewardedRelayer: UnrewardedRelayer;
modifiedtests/src/interfaces/lookup.tsdiffbeforeafterboth
1755 RuntimeEnvironmentUpdated: 'Null'1755 RuntimeEnvironmentUpdated: 'Null'
1756 }1756 }
1757 },1757 },
1758 /**1758 /**
1759 * Lookup225: frame_system::EventRecord<unique_runtime::Event, primitive_types::H256>1759 * Lookup225: frame_system::EventRecord<opal_runtime::Event, primitive_types::H256>
1760 **/1760 **/
1761 FrameSystemEventRecord: {1761 FrameSystemEventRecord: {
1762 phase: 'FrameSystemPhase',1762 phase: 'FrameSystemPhase',
1763 event: 'Event',1763 event: 'Event',
2240 * Lookup297: pallet_common::pallet::Error<T>2240 * Lookup297: pallet_common::pallet::Error<T>
2241 **/2241 **/
2242 PalletCommonError: {2242 PalletCommonError: {
2243 _enum: ['CollectionNotFound', 'MustBeTokenOwner', 'NoPermission', 'PublicMintingNotAllowed', 'AddressNotInAllowlist', 'CollectionNameLimitExceeded', 'CollectionDescriptionLimitExceeded', 'CollectionTokenPrefixLimitExceeded', 'TotalCollectionsLimitExceeded', 'TokenVariableDataLimitExceeded', 'CollectionAdminCountExceeded', 'CollectionLimitBoundsExceeded', 'OwnerPermissionsCantBeReverted', 'TransferNotAllowed', 'AccountTokenLimitExceeded', 'CollectionTokenLimitExceeded', 'MetadataFlagFrozen', 'TokenNotFound', 'TokenValueTooLow', 'ApprovedValueTooLow', 'CantApproveMoreThanOwned', 'AddressIsZero', 'UnsupportedOperation']2243 _enum: ['CollectionNotFound', 'MustBeTokenOwner', 'NoPermission', 'PublicMintingNotAllowed', 'AddressNotInAllowlist', 'CollectionNameLimitExceeded', 'CollectionDescriptionLimitExceeded', 'CollectionTokenPrefixLimitExceeded', 'TotalCollectionsLimitExceeded', 'TokenVariableDataLimitExceeded', 'CollectionAdminCountExceeded', 'CollectionLimitBoundsExceeded', 'OwnerPermissionsCantBeReverted', 'TransferNotAllowed', 'AccountTokenLimitExceeded', 'CollectionTokenLimitExceeded', 'MetadataFlagFrozen', 'TokenNotFound', 'TokenValueTooLow', 'ApprovedValueTooLow', 'CantApproveMoreThanOwned', 'AddressIsZero', 'UnsupportedOperation', 'NotSufficientFounds']
2244 },2244 },
2245 /**2245 /**
2246 * Lookup299: pallet_fungible::pallet::Error<T>2246 * Lookup299: pallet_fungible::pallet::Error<T>
2416 * Lookup344: frame_system::extensions::check_weight::CheckWeight<T>2416 * Lookup344: frame_system::extensions::check_weight::CheckWeight<T>
2417 **/2417 **/
2418 FrameSystemExtensionsCheckWeight: 'Null',2418 FrameSystemExtensionsCheckWeight: 'Null',
2419 /**2419 /**
2420 * Lookup345: pallet_template_transaction_payment::ChargeTransactionPayment<unique_runtime::Runtime>2420 * Lookup345: pallet_template_transaction_payment::ChargeTransactionPayment<opal_runtime::Runtime>
2421 **/2421 **/
2422 PalletTemplateTransactionPaymentChargeTransactionPayment: 'Compact<u128>',2422 PalletTemplateTransactionPaymentChargeTransactionPayment: 'Compact<u128>',
2423 /**2423 /**
2424 * Lookup346: unique_runtime::Runtime2424 * Lookup346: opal_runtime::Runtime
2425 **/2425 **/
2426 UniqueRuntimeRuntime: 'Null'2426 OpalRuntimeRuntime: 'Null'
2427};2427};
24282428
modifiedtests/src/interfaces/types-lookup.tsdiffbeforeafterboth
2462 readonly isCantApproveMoreThanOwned: boolean;2462 readonly isCantApproveMoreThanOwned: boolean;
2463 readonly isAddressIsZero: boolean;2463 readonly isAddressIsZero: boolean;
2464 readonly isUnsupportedOperation: boolean;2464 readonly isUnsupportedOperation: boolean;
2465 readonly isNotSufficientFounds: boolean;
2465 readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'TokenVariableDataLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsZero' | 'UnsupportedOperation';2466 readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'TokenVariableDataLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsZero' | 'UnsupportedOperation' | 'NotSufficientFounds';
2466 }2467 }
24672468
2468 /** @name PalletFungibleError (299) */2469 /** @name PalletFungibleError (299) */
2643 /** @name PalletTemplateTransactionPaymentChargeTransactionPayment (345) */2644 /** @name PalletTemplateTransactionPaymentChargeTransactionPayment (345) */
2644 export interface PalletTemplateTransactionPaymentChargeTransactionPayment extends Compact<u128> {}2645 export interface PalletTemplateTransactionPaymentChargeTransactionPayment extends Compact<u128> {}
26452646
2646 /** @name UniqueRuntimeRuntime (346) */2647 /** @name OpalRuntimeRuntime (346) */
2647 export type UniqueRuntimeRuntime = Null;2648 export type OpalRuntimeRuntime = Null;
26482649
2649} // declare module2650} // declare module
26502651
modifiedtests/src/interfaces/unique/definitions.tsdiffbeforeafterboth
55 collectionById: fun('Get collection by specified id', [collectionParam], 'Option<UpDataStructsCollection>'),55 collectionById: fun('Get collection by specified id', [collectionParam], 'Option<UpDataStructsCollection>'),
56 collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),56 collectionStats: fun('Get collection stats', [], 'UpDataStructsCollectionStats'),
57 allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),57 allowed: fun('Check if user is allowed to use collection', [collectionParam, crossAccountParam()], 'bool'),
58 effectiveCollectionLimits: fun('Get effective collection limits', [collectionParam], 'Option<UpDataStructsCollectionLimits>'),
58 },59 },
59};60};
6061
modifiedtests/src/interfaces/unique/types.tsdiffbeforeafterboth
654 readonly type: 'ApplyExtrinsic' | 'Finalization' | 'Initialization';654 readonly type: 'ApplyExtrinsic' | 'Finalization' | 'Initialization';
655}655}
656
657/** @name OpalRuntimeRuntime */
658export interface OpalRuntimeRuntime extends Null {}
656659
657/** @name OrmlVestingModuleCall */660/** @name OrmlVestingModuleCall */
658export interface OrmlVestingModuleCall extends Enum {661export interface OrmlVestingModuleCall extends Enum {
892 readonly isCantApproveMoreThanOwned: boolean;895 readonly isCantApproveMoreThanOwned: boolean;
893 readonly isAddressIsZero: boolean;896 readonly isAddressIsZero: boolean;
894 readonly isUnsupportedOperation: boolean;897 readonly isUnsupportedOperation: boolean;
898 readonly isNotSufficientFounds: boolean;
895 readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'TokenVariableDataLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsZero' | 'UnsupportedOperation';899 readonly type: 'CollectionNotFound' | 'MustBeTokenOwner' | 'NoPermission' | 'PublicMintingNotAllowed' | 'AddressNotInAllowlist' | 'CollectionNameLimitExceeded' | 'CollectionDescriptionLimitExceeded' | 'CollectionTokenPrefixLimitExceeded' | 'TotalCollectionsLimitExceeded' | 'TokenVariableDataLimitExceeded' | 'CollectionAdminCountExceeded' | 'CollectionLimitBoundsExceeded' | 'OwnerPermissionsCantBeReverted' | 'TransferNotAllowed' | 'AccountTokenLimitExceeded' | 'CollectionTokenLimitExceeded' | 'MetadataFlagFrozen' | 'TokenNotFound' | 'TokenValueTooLow' | 'ApprovedValueTooLow' | 'CantApproveMoreThanOwned' | 'AddressIsZero' | 'UnsupportedOperation' | 'NotSufficientFounds';
896}900}
897901
898/** @name PalletCommonEvent */902/** @name PalletCommonEvent */
1722 readonly stateVersion: u8;1726 readonly stateVersion: u8;
1723}1727}
1724
1725/** @name UniqueRuntimeRuntime */
1726export interface UniqueRuntimeRuntime extends Null {}
17271728
1728/** @name UpDataStructsAccessMode */1729/** @name UpDataStructsAccessMode */
1729export interface UpDataStructsAccessMode extends Enum {1730export interface UpDataStructsAccessMode extends Enum {
modifiedtests/src/limits.test.tsdiffbeforeafterboth
397 });397 });
398});398});
399399
400describe.only('Effective collection limits', () => {
401 it('Test1', async () => {
402 await usingApi(async (api) => {
403 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
404
405 {
406 const collection = await api.rpc.unique.collectionById(collectionId);
407 expect(collection.isSome).to.be.true;
408 const limits = collection.unwrap().limits;
409 expect(limits).to.be.any;
410
411 // Check that limits is undefined
412 expect(limits.accountTokenOwnershipLimit.isNone).to.be.true;
413 expect(limits.sponsoredDataSize.isNone).to.be.true;
414 expect(limits.sponsoredDataRateLimit.isNone).to.be.true;
415 expect(limits.tokenLimit.isNone).to.be.true;
416 expect(limits.sponsorTransferTimeout.isNone).to.be.true;
417 expect(limits.sponsorApproveTimeout.isNone).to.be.true;
418 expect(limits.ownerCanTransfer.isNone).to.be.true;
419 expect(limits.ownerCanDestroy.isNone).to.be.true;
420 expect(limits.transfersEnabled.isNone).to.be.true;
421 }
422
423 {
424 const limits = await api.rpc.unique.effectiveCollectionLimits(11111);
425 expect(limits.isNone).to.be.true;
426 }
427
428 {
429 const limitsOpt = await api.rpc.unique.effectiveCollectionLimits(collectionId);
430 expect(limitsOpt.isNone).to.be.false;
431 const limits = limitsOpt.unwrap();
432
433 console.log(limits);
434 expect(limits.accountTokenOwnershipLimit.isSome).to.be.true;
435 expect(limits.sponsoredDataSize.isSome).to.be.true;
436 expect(limits.sponsoredDataRateLimit.isSome).to.be.true;
437 expect(limits.tokenLimit.isSome).to.be.true;
438 expect(limits.sponsorTransferTimeout.isSome).to.be.true;
439 expect(limits.sponsorApproveTimeout.isSome).to.be.true;
440 expect(limits.ownerCanTransfer.isSome).to.be.true;
441 expect(limits.ownerCanDestroy.isSome).to.be.true;
442 expect(limits.transfersEnabled.isSome).to.be.true;
443 }
444 });
445 });
446});