git.delta.rocks / unique-network / refs/commits / 8b0ce93028c8

difftreelog

fix yarn fix

Trubnikov Sergey2022-12-13parent: #f0bc4b6.patch.diff
in: master

3 files changed

modifiedtests/src/apiConsts.test.tsdiffbeforeafterboth
before · tests/src/apiConsts.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {ApiPromise} from '@polkadot/api';18import {ApiBase} from '@polkadot/api/base';19import {usingPlaygrounds, itSub, expect} from './util';202122const MAX_COLLECTION_DESCRIPTION_LENGTH = 256n;23const MAX_COLLECTION_NAME_LENGTH = 64n;24const COLLECTION_ADMINS_LIMIT = 5n;25const MAX_COLLECTION_PROPERTIES_SIZE = 40960n;26const MAX_TOKEN_PREFIX_LENGTH = 16n;27const MAX_PROPERTY_KEY_LENGTH = 256n;28const MAX_PROPERTY_VALUE_LENGTH = 32768n;29const MAX_PROPERTIES_PER_ITEM = 64n;30const MAX_TOKEN_PROPERTIES_SIZE = 32768n;31const NESTING_BUDGET = 5n;3233const DEFAULT_COLLETCTION_LIMIT = {34  accountTokenOwnershipLimit: '1,000,000',35  sponsoredDataSize: '2,048',36  sponsoredDataRateLimit: 'SponsoringDisabled',37  tokenLimit: '4,294,967,295',38  sponsorTransferTimeout: '5',39  sponsorApproveTimeout: '5',40  ownerCanTransfer: false,41  ownerCanDestroy: true,42  transfersEnabled: true,43};4445const EVM_COLLECTION_HELPERS_ADDRESS = '0x6c4e9fe1ae37a41e93cee429e8e1881abdcbb54f';46const HELPERS_CONTRACT_ADDRESS = '0x842899ECF380553E8a4de75bF534cdf6fBF64049';4748describe('integration test: API UNIQUE consts', () => {49  let api: ApiPromise;50  51  before(async () => {52    await usingPlaygrounds(async (helper) => {53      api = await helper.getApi();54    });55  });56  57  itSub('DEFAULT_NFT_COLLECTION_LIMITS', () => {58    expect(api.consts.unique.nftDefaultCollectionLimits.toHuman()).to.deep.equal(DEFAULT_COLLETCTION_LIMIT);59  });60  61  itSub('DEFAULT_RFT_COLLECTION_LIMITS', () => {62    expect(api.consts.unique.rftDefaultCollectionLimits.toHuman()).to.deep.equal(DEFAULT_COLLETCTION_LIMIT);63  });64  65  itSub('DEFAULT_FT_COLLECTION_LIMITS', () => {66    expect(api.consts.unique.ftDefaultCollectionLimits.toHuman()).to.deep.equal(DEFAULT_COLLETCTION_LIMIT);67  });68  69  itSub('MAX_COLLECTION_NAME_LENGTH', () => {70    checkConst(api.consts.unique.maxCollectionNameLength, MAX_COLLECTION_NAME_LENGTH);71  });72  73  itSub('MAX_COLLECTION_DESCRIPTION_LENGTH', () => {74    checkConst(api.consts.unique.maxCollectionDescriptionLength, MAX_COLLECTION_DESCRIPTION_LENGTH);75  });76  77  itSub('MAX_COLLECTION_PROPERTIES_SIZE', () => {78    checkConst(api.consts.unique.maxCollectionPropertiesSize, MAX_COLLECTION_PROPERTIES_SIZE);79  });8081  itSub('MAX_TOKEN_PREFIX_LENGTH', () => {82    checkConst(api.consts.unique.maxTokenPrefixLength, MAX_TOKEN_PREFIX_LENGTH);83  });8485  itSub('MAX_PROPERTY_KEY_LENGTH', () => {86    checkConst(api.consts.unique.maxPropertyKeyLength, MAX_PROPERTY_KEY_LENGTH);87  });88  89  itSub('MAX_PROPERTY_VALUE_LENGTH', () => {90    checkConst(api.consts.unique.maxPropertyValueLength, MAX_PROPERTY_VALUE_LENGTH);91  });92  93  itSub('MAX_PROPERTIES_PER_ITEM', () => {94    checkConst(api.consts.unique.maxPropertiesPerItem, MAX_PROPERTIES_PER_ITEM);95  });96  97  itSub('NESTING_BUDGET', () => {98    checkConst(api.consts.unique.nestingBudget, NESTING_BUDGET);99  });100  101  itSub('MAX_TOKEN_PROPERTIES_SIZE', () => {102    checkConst(api.consts.unique.maxTokenPropertiesSize, MAX_TOKEN_PROPERTIES_SIZE);103  });104  105  itSub('COLLECTION_ADMINS_LIMIT', () => {106    checkConst(api.consts.unique.collectionAdminsLimit, COLLECTION_ADMINS_LIMIT);107  });108  109  itSub('HELPERS_CONTRACT_ADDRESS', () => {110    expect(api.consts.evmContractHelpers.contractAddress.toString().toLowerCase()).to.be.equal(HELPERS_CONTRACT_ADDRESS.toLowerCase());111  });112  113  itSub('EVM_COLLECTION_HELPERS_ADDRESS', () => {114    expect(api.consts.common.contractAddress.toString().toLowerCase()).to.be.equal(EVM_COLLECTION_HELPERS_ADDRESS.toLowerCase());115  });116});117118function checkConst<T>(constValue: any, expectedValue: T) {119  expect(constValue.toBigInt()).equal(expectedValue);120}
after · tests/src/apiConsts.test.ts
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {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}
modifiedtests/src/eth/collectionProperties.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionProperties.test.ts
+++ b/tests/src/eth/collectionProperties.test.ts
@@ -14,7 +14,7 @@
 // You should have received a copy of the GNU General Public License
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
-import {itEth, usingEthPlaygrounds, expect, EthUniqueHelper} from './util';
+import {itEth, usingEthPlaygrounds, expect} from './util';
 import {Pallets} from '../util';
 import {IProperty, ITokenPropertyPermission} from '../util/playgrounds/types';
 import {IKeyringPair} from '@polkadot/types/types';
modifiedtests/src/eth/events.test.tsdiffbeforeafterboth
--- a/tests/src/eth/events.test.ts
+++ b/tests/src/eth/events.test.ts
@@ -245,7 +245,7 @@
 
 async function testCollectionOwnedChanged(helper: EthUniqueHelper, mode: TCollectionMode) {
   const owner = await helper.eth.createAccountWithBalance(donor);
-  const new_owner = helper.ethCrossAccount.createAccount();
+  const newOwner = helper.ethCrossAccount.createAccount();
   const {collectionAddress} = await helper.eth.createCollection(mode, owner, 'A', 'B', 'C');
   const collection = await helper.ethNativeContract.collection(collectionAddress, mode, owner);
   const collectionHelper = helper.ethNativeContract.collectionHelpers(owner);
@@ -255,7 +255,7 @@
   });
   const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionOwnerChanged']}]);
   {
-    await collection.methods.changeCollectionOwnerCross(new_owner).send({from: owner});
+    await collection.methods.changeCollectionOwnerCross(newOwner).send({from: owner});
     await helper.wait.newBlocks(1);
     expect(ethEvents).to.be.like([
       {