1234567891011121314151617import {ApiPromise} from '@polkadot/api';18import {usingPlaygrounds, itSub, expect, COLLECTION_HELPER, CONTRACT_HELPER} from './util';192021const MAX_COLLECTION_DESCRIPTION_LENGTH = 256n;22const MAX_COLLECTION_NAME_LENGTH = 64n;23const COLLECTION_ADMINS_LIMIT = 5n;24const MAX_COLLECTION_PROPERTIES_SIZE = 40960n;25const MAX_TOKEN_PREFIX_LENGTH = 16n;26const MAX_PROPERTY_KEY_LENGTH = 256n;27const MAX_PROPERTY_VALUE_LENGTH = 32768n;28const MAX_PROPERTIES_PER_ITEM = 64n;29const MAX_TOKEN_PROPERTIES_SIZE = 32768n;30const NESTING_BUDGET = 5n;3132const DEFAULT_COLLETCTION_LIMIT = {33 accountTokenOwnershipLimit: '1,000,000',34 sponsoredDataSize: '2,048',35 sponsoredDataRateLimit: 'SponsoringDisabled',36 tokenLimit: '4,294,967,295',37 sponsorTransferTimeout: '5',38 sponsorApproveTimeout: '5',39 ownerCanTransfer: false,40 ownerCanDestroy: true,41 transfersEnabled: true,42};4344describe('integration test: API UNIQUE consts', () => {45 let api: ApiPromise;4647 before(async () => {48 await usingPlaygrounds(async (helper) => {49 api = await helper.getApi();50 });51 });5253 itSub('DEFAULT_NFT_COLLECTION_LIMITS', () => {54 expect(api.consts.unique.nftDefaultCollectionLimits.toHuman()).to.deep.equal(DEFAULT_COLLETCTION_LIMIT);55 });5657 itSub('DEFAULT_RFT_COLLECTION_LIMITS', () => {58 expect(api.consts.unique.rftDefaultCollectionLimits.toHuman()).to.deep.equal(DEFAULT_COLLETCTION_LIMIT);59 });6061 itSub('DEFAULT_FT_COLLECTION_LIMITS', () => {62 expect(api.consts.unique.ftDefaultCollectionLimits.toHuman()).to.deep.equal(DEFAULT_COLLETCTION_LIMIT);63 });6465 itSub('MAX_COLLECTION_NAME_LENGTH', () => {66 checkConst(api.consts.unique.maxCollectionNameLength, MAX_COLLECTION_NAME_LENGTH);67 });6869 itSub('MAX_COLLECTION_DESCRIPTION_LENGTH', () => {70 checkConst(api.consts.unique.maxCollectionDescriptionLength, MAX_COLLECTION_DESCRIPTION_LENGTH);71 });7273 itSub('MAX_COLLECTION_PROPERTIES_SIZE', () => {74 checkConst(api.consts.unique.maxCollectionPropertiesSize, MAX_COLLECTION_PROPERTIES_SIZE);75 });7677 itSub('MAX_TOKEN_PREFIX_LENGTH', () => {78 checkConst(api.consts.unique.maxTokenPrefixLength, MAX_TOKEN_PREFIX_LENGTH);79 });8081 itSub('MAX_PROPERTY_KEY_LENGTH', () => {82 checkConst(api.consts.unique.maxPropertyKeyLength, MAX_PROPERTY_KEY_LENGTH);83 });8485 itSub('MAX_PROPERTY_VALUE_LENGTH', () => {86 checkConst(api.consts.unique.maxPropertyValueLength, MAX_PROPERTY_VALUE_LENGTH);87 });8889 itSub('MAX_PROPERTIES_PER_ITEM', () => {90 checkConst(api.consts.unique.maxPropertiesPerItem, MAX_PROPERTIES_PER_ITEM);91 });9293 itSub('NESTING_BUDGET', () => {94 checkConst(api.consts.unique.nestingBudget, NESTING_BUDGET);95 });9697 itSub('MAX_TOKEN_PROPERTIES_SIZE', () => {98 checkConst(api.consts.unique.maxTokenPropertiesSize, MAX_TOKEN_PROPERTIES_SIZE);99 });100101 itSub('COLLECTION_ADMINS_LIMIT', () => {102 checkConst(api.consts.unique.collectionAdminsLimit, COLLECTION_ADMINS_LIMIT);103 });104105 itSub('HELPERS_CONTRACT_ADDRESS', () => {106 expect(api.consts.evmContractHelpers.contractAddress.toString().toLowerCase()).to.be.equal(CONTRACT_HELPER.toLowerCase());107 });108109 itSub('EVM_COLLECTION_HELPERS_ADDRESS', () => {110 expect(api.consts.common.contractAddress.toString().toLowerCase()).to.be.equal(COLLECTION_HELPER.toLowerCase());111 });112});113114function checkConst<T>(constValue: any, expectedValue: T) {115 expect(constValue.toBigInt()).equal(expectedValue);116}