1234567891011121314151617import {ApiPromise} from '@polkadot/api';18import {usingPlaygrounds, itSub, expect} 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};4344const EVM_COLLECTION_HELPERS_ADDRESS = '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f';45const HELPERS_CONTRACT_ADDRESS = '0x842899ECF380553E8a4de75bF534cdf6fBF64049';4647describe('integration test: API UNIQUE consts', () => {48 let api: ApiPromise;49 50 before(async () => {51 await usingPlaygrounds(async (helper) => {52 api = await helper.getApi();53 });54 });55 56 itSub('DEFAULT_NFT_COLLECTION_LIMITS', () => {57 expect(api.consts.unique.nftDefaultCollectionLimits.toHuman()).to.deep.equal(DEFAULT_COLLETCTION_LIMIT);58 });59 60 itSub('DEFAULT_RFT_COLLECTION_LIMITS', () => {61 expect(api.consts.unique.rftDefaultCollectionLimits.toHuman()).to.deep.equal(DEFAULT_COLLETCTION_LIMIT);62 });63 64 itSub('DEFAULT_FT_COLLECTION_LIMITS', () => {65 expect(api.consts.unique.ftDefaultCollectionLimits.toHuman()).to.deep.equal(DEFAULT_COLLETCTION_LIMIT);66 });67 68 itSub('MAX_COLLECTION_NAME_LENGTH', () => {69 checkConst(api.consts.unique.maxCollectionNameLength, MAX_COLLECTION_NAME_LENGTH);70 });71 72 itSub('MAX_COLLECTION_DESCRIPTION_LENGTH', () => {73 checkConst(api.consts.unique.maxCollectionDescriptionLength, MAX_COLLECTION_DESCRIPTION_LENGTH);74 });75 76 itSub('MAX_COLLECTION_PROPERTIES_SIZE', () => {77 checkConst(api.consts.unique.maxCollectionPropertiesSize, MAX_COLLECTION_PROPERTIES_SIZE);78 });7980 itSub('MAX_TOKEN_PREFIX_LENGTH', () => {81 checkConst(api.consts.unique.maxTokenPrefixLength, MAX_TOKEN_PREFIX_LENGTH);82 });8384 itSub('MAX_PROPERTY_KEY_LENGTH', () => {85 checkConst(api.consts.unique.maxPropertyKeyLength, MAX_PROPERTY_KEY_LENGTH);86 });87 88 itSub('MAX_PROPERTY_VALUE_LENGTH', () => {89 checkConst(api.consts.unique.maxPropertyValueLength, MAX_PROPERTY_VALUE_LENGTH);90 });91 92 itSub('MAX_PROPERTIES_PER_ITEM', () => {93 checkConst(api.consts.unique.maxPropertiesPerItem, MAX_PROPERTIES_PER_ITEM);94 });95 96 itSub('NESTING_BUDGET', () => {97 checkConst(api.consts.unique.nestingBudget, NESTING_BUDGET);98 });99 100 itSub('MAX_TOKEN_PROPERTIES_SIZE', () => {101 checkConst(api.consts.unique.maxTokenPropertiesSize, MAX_TOKEN_PROPERTIES_SIZE);102 });103 104 itSub('COLLECTION_ADMINS_LIMIT', () => {105 checkConst(api.consts.unique.collectionAdminsLimit, COLLECTION_ADMINS_LIMIT);106 });107 108 itSub('HELPERS_CONTRACT_ADDRESS', () => {109 expect(api.consts.evmContractHelpers.contractAddress.toString().toLowerCase()).to.be.equal(HELPERS_CONTRACT_ADDRESS.toLowerCase());110 });111 112 itSub('EVM_COLLECTION_HELPERS_ADDRESS', () => {113 expect(api.consts.common.contractAddress.toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS.toLowerCase());114 });115});116117function checkConst<T>(constValue: any, expectedValue: T) {118 expect(constValue.toBigInt()).equal(expectedValue);119}