difftreelog
fix tests and weights
in: master
16 files changed
pallets/balances-adapter/src/erc.rsdiffbeforeafterboth--- a/pallets/balances-adapter/src/erc.rs
+++ b/pallets/balances-adapter/src/erc.rs
@@ -1,6 +1,7 @@
-use crate::{Config, NativeFungibleHandle};
+use crate::{Config, NativeFungibleHandle, SelfWeightOf};
use evm_coder::{abi::AbiType, ToLog, generate_stubgen, solidity_interface, types::*};
use frame_support::traits::{Currency, ExistenceRequirement};
+use pallet_balances::WeightInfo;
use pallet_common::{
erc::{CommonEvmHandler, CrossAccountId, PrecompileHandle, PrecompileResult},
eth::CrossAddress,
@@ -73,7 +74,7 @@
Ok(total.into())
}
- // #[weight(<SelfWeightOf<T>>::transfer())]
+ #[weight(<SelfWeightOf<T>>::transfer())]
fn transfer(&mut self, caller: Caller, to: Address, amount: U256) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
@@ -93,7 +94,7 @@
Ok(true)
}
- // #[weight(<SelfWeightOf<T>>::transfer_from())]
+ #[weight(<SelfWeightOf<T>>::transfer())]
fn transfer_from(
&mut self,
caller: Caller,
@@ -138,7 +139,7 @@
Ok(balance.into())
}
- // #[weight(<SelfWeightOf<T>>::transfer())]
+ #[weight(<SelfWeightOf<T>>::transfer())]
fn transfer_cross(&mut self, caller: Caller, to: CrossAddress, amount: U256) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
let to = to.into_sub_cross_account::<T>()?;
@@ -158,7 +159,7 @@
Ok(true)
}
- // #[weight(<SelfWeightOf<T>>::transfer_from())]
+ #[weight(<SelfWeightOf<T>>::transfer())]
fn transfer_from_cross(
&mut self,
caller: Caller,
pallets/balances-adapter/src/lib.rsdiffbeforeafterboth--- a/pallets/balances-adapter/src/lib.rs
+++ b/pallets/balances-adapter/src/lib.rs
@@ -11,6 +11,8 @@
pub mod common;
pub mod erc;
+pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
+
pub struct NativeFungibleHandle<T: Config>(SubstrateRecorder<T>);
impl<T: Config> NativeFungibleHandle<T> {
pub fn new() -> NativeFungibleHandle<T> {
@@ -34,6 +36,7 @@
pub mod pallet {
use alloc::string::String;
use frame_support::{traits::Get, sp_runtime::DispatchResult};
+ use pallet_balances::WeightInfo;
use sp_core::U256;
#[pallet::config]
@@ -49,6 +52,8 @@
type Decimals: Get<u8>;
type Name: Get<String>;
type Symbol: Get<String>;
+
+ type WeightInfo: WeightInfo;
}
#[pallet::pallet]
pub struct Pallet<T>(_);
runtime/common/config/pallets/mod.rsdiffbeforeafterboth--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -94,6 +94,7 @@
type Decimals = Decimals;
type Name = Name;
type Symbol = Symbol;
+ type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;
}
parameter_types! {
tests/src/addCollectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/addCollectionAdmin.test.ts
+++ b/tests/src/addCollectionAdmin.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, usingPlaygrounds, expect} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test addCollectionAdmin(collection_id, new_admin_id):', () => {
let donor: IKeyringPair;
@@ -82,7 +83,7 @@
itSub("Can't add collection admin of not existing collection.", async ({helper}) => {
const [alice, bob] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.addAdmin(alice, collectionId, {Substrate: bob.address})).to.be.rejectedWith(/common\.CollectionNotFound/);
tests/src/allowLists.test.tsdiffbeforeafterboth--- a/tests/src/allowLists.test.ts
+++ b/tests/src/allowLists.test.ts
@@ -16,7 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {usingPlaygrounds, expect, itSub} from './util';
-import {ICollectionPermissions} from './util/playgrounds/types';
+import {ICollectionPermissions, NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test ext. Allow list tests', () => {
let alice: IKeyringPair;
@@ -60,7 +60,7 @@
describe('Negative', () => {
itSub('Nobody can add address to allow list of non-existing collection', async ({helper}) => {
- const collectionId = (1<<32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.nft.addToAllowList(bob, collectionId, {Substrate: charlie.address}))
.to.be.rejectedWith(/common\.CollectionNotFound/);
});
@@ -140,7 +140,7 @@
});
itSub('Nobody can remove address from allow list of non-existing collection', async ({helper}) => {
- const collectionId = (1<<32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.removeFromAllowList(bob, collectionId, {Substrate: charlie.address}))
.to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/change-collection-owner.test.tsdiffbeforeafterboth--- a/tests/src/change-collection-owner.test.ts
+++ b/tests/src/change-collection-owner.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {usingPlaygrounds, expect, itSub} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test changeCollectionOwner(collection_id, new_owner):', () => {
let alice: IKeyringPair;
@@ -127,7 +128,7 @@
});
itSub('Can\'t change owner of a non-existing collection.', async ({helper}) => {
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
const changeOwnerTx = () => helper.collection.changeOwner(bob, collectionId, bob.address);
await expect(changeOwnerTx()).to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/confirmSponsorship.test.tsdiffbeforeafterboth1// 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 {IKeyringPair} from '@polkadot/types/types';18import {usingPlaygrounds, expect, itSub, Pallets} from './util';1920async function setSponsorHelper(collection: any, signer: IKeyringPair, sponsorAddress: string) {21 await collection.setSponsor(signer, sponsorAddress);22 const raw = (await collection.getData())?.raw;23 expect(raw.sponsorship.Unconfirmed).to.be.equal(sponsorAddress);24}2526async function confirmSponsorHelper(collection: any, signer: IKeyringPair) {27 await collection.confirmSponsorship(signer);28 const raw = (await collection.getData())?.raw;29 expect(raw.sponsorship.Confirmed).to.be.equal(signer.address);30}3132describe('integration test: ext. confirmSponsorship():', () => {33 let alice: IKeyringPair;34 let bob: IKeyringPair;35 let charlie: IKeyringPair;36 let zeroBalance: IKeyringPair;3738 before(async () => {39 await usingPlaygrounds(async (helper, privateKey) => {40 const donor = await privateKey({url: import.meta.url});41 [alice, bob, charlie, zeroBalance] = await helper.arrange.createAccounts([100n, 100n, 100n, 0n], donor);42 });43 });4445 itSub('Confirm collection sponsorship', async ({helper}) => {46 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});47 await setSponsorHelper(collection, alice, bob.address);48 await confirmSponsorHelper(collection, bob);49 });5051 itSub('Add sponsor to a collection after the same sponsor was already added and confirmed', async ({helper}) => {52 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});53 await setSponsorHelper(collection, alice, bob.address);54 await confirmSponsorHelper(collection, bob);55 await setSponsorHelper(collection, alice, bob.address);56 });57 itSub('Add new sponsor to a collection after another sponsor was already added and confirmed', async ({helper}) => {58 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});59 await setSponsorHelper(collection, alice, bob.address);60 await confirmSponsorHelper(collection, bob);61 await setSponsorHelper(collection, alice, charlie.address);62 });6364 itSub('NFT: Transfer fees are paid by the sponsor after confirmation', async ({helper}) => {65 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});66 await collection.setSponsor(alice, bob.address);67 await collection.confirmSponsorship(bob);68 const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);69 const token = await collection.mintToken(alice, {Substrate: zeroBalance.address});70 await token.transfer(zeroBalance, {Substrate: alice.address});71 const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);72 expect(bobBalanceAfter < bobBalanceBefore).to.be.true;73 });7475 itSub('Fungible: Transfer fees are paid by the sponsor after confirmation', async ({helper}) => {76 const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});77 await collection.setSponsor(alice, bob.address);78 await collection.confirmSponsorship(bob);79 const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);80 await collection.mint(alice, 100n, {Substrate: zeroBalance.address});81 await collection.transfer(zeroBalance, {Substrate: alice.address}, 1n);82 const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);83 expect(bobBalanceAfter < bobBalanceBefore).to.be.true;84 });8586 itSub.ifWithPallets('ReFungible: Transfer fees are paid by the sponsor after confirmation', [Pallets.ReFungible], async ({helper}) => {87 const collection = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});88 await collection.setSponsor(alice, bob.address);89 await collection.confirmSponsorship(bob);90 const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);91 const token = await collection.mintToken(alice, 100n, {Substrate: zeroBalance.address});92 await token.transfer(zeroBalance, {Substrate: alice.address}, 1n);93 const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);94 expect(bobBalanceAfter < bobBalanceBefore).to.be.true;95 });9697 itSub('CreateItem fees are paid by the sponsor after confirmation', async ({helper}) => {98 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});99 await collection.setSponsor(alice, bob.address);100 await collection.confirmSponsorship(bob);101 await collection.setPermissions(alice, {access: 'AllowList', mintMode: true});102 await collection.addToAllowList(alice, {Substrate: zeroBalance.address});103104 const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);105 await collection.mintToken(zeroBalance, {Substrate: zeroBalance.address});106 const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);107108 expect(bobBalanceAfter < bobBalanceBefore).to.be.true;109 });110111 itSub('NFT: Sponsoring of transfers is rate limited', async ({helper}) => {112 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL', limits: {113 sponsorTransferTimeout: 1000,114 }});115 await collection.setSponsor(alice, bob.address);116 await collection.confirmSponsorship(bob);117118 const token = await collection.mintToken(alice, {Substrate: alice.address});119 await token.transfer(alice, {Substrate: zeroBalance.address});120 const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);121122 const transferTx = () => token.transfer(zeroBalance, {Substrate: alice.address});123 await expect(transferTx()).to.be.rejectedWith('Inability to pay some fees');124 const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);125126 expect(bobBalanceAfter === bobBalanceBefore).to.be.true;127 });128129 itSub('Fungible: Sponsoring is rate limited', async ({helper}) => {130 const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL', limits: {131 sponsorTransferTimeout: 1000,132 }});133 await collection.setSponsor(alice, bob.address);134 await collection.confirmSponsorship(bob);135136 await collection.mint(alice, 100n, {Substrate: zeroBalance.address});137 await collection.transfer(zeroBalance, {Substrate: zeroBalance.address}, 1n);138 const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);139140 const transferTx = () => collection.transfer(zeroBalance, {Substrate: zeroBalance.address});141 await expect(transferTx()).to.be.rejected;142 const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);143144 expect(bobBalanceAfter === bobBalanceBefore).to.be.true;145 });146147 itSub.ifWithPallets('ReFungible: Sponsoring is rate limited', [Pallets.ReFungible], async ({helper}) => {148 const collection = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL', limits: {149 sponsorTransferTimeout: 1000,150 }});151 await collection.setSponsor(alice, bob.address);152 await collection.confirmSponsorship(bob);153154 const token = await collection.mintToken(alice, 100n, {Substrate: zeroBalance.address});155 await token.transfer(zeroBalance, {Substrate: alice.address});156157 const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);158 const transferTx = () => token.transfer(zeroBalance, {Substrate: alice.address});159 await expect(transferTx()).to.be.rejectedWith('Inability to pay some fees');160 const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);161162 expect(bobBalanceAfter === bobBalanceBefore).to.be.true;163 });164165 itSub('NFT: Sponsoring of createItem is rate limited', async ({helper}) => {166 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL', limits: {167 sponsoredDataRateLimit: {blocks: 1000},168 sponsorTransferTimeout: 1000,169 }});170 await collection.setSponsor(alice, bob.address);171 await collection.confirmSponsorship(bob);172 await collection.setPermissions(alice, {mintMode: true, access: 'AllowList'});173 await collection.addToAllowList(alice, {Substrate: zeroBalance.address});174175 await collection.mintToken(zeroBalance, {Substrate: zeroBalance.address});176177 const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);178 const mintTx = () => collection.mintToken(zeroBalance, {Substrate: zeroBalance.address});179 await expect(mintTx()).to.be.rejectedWith('Inability to pay some fees');180 const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);181182 expect(bobBalanceAfter === bobBalanceBefore).to.be.true;183 });184});185186describe('(!negative test!) integration test: ext. confirmSponsorship():', () => {187 let alice: IKeyringPair;188 let bob: IKeyringPair;189 let charlie: IKeyringPair;190 let ownerZeroBalance: IKeyringPair;191 let senderZeroBalance: IKeyringPair;192193 before(async () => {194 await usingPlaygrounds(async (helper, privateKey) => {195 const donor = await privateKey({url: import.meta.url});196 [alice, bob, charlie, ownerZeroBalance, senderZeroBalance] = await helper.arrange.createAccounts([100n, 100n, 100n, 0n, 0n], donor);197 });198 });199200 itSub('(!negative test!) Confirm sponsorship for a collection that never existed', async ({helper}) => {201 const collectionId = (1 << 32) - 1;202 const confirmSponsorshipTx = () => helper.collection.confirmSponsorship(bob, collectionId);203 await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.CollectionNotFound/);204 });205206 itSub('(!negative test!) Confirm sponsorship using a non-sponsor address', async ({helper}) => {207 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});208 await collection.setSponsor(alice, bob.address);209 const confirmSponsorshipTx = () => collection.confirmSponsorship(charlie);210 await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.ConfirmSponsorshipFail/);211 });212213 itSub('(!negative test!) Confirm sponsorship using owner address', async ({helper}) => {214 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});215 await collection.setSponsor(alice, bob.address);216 const confirmSponsorshipTx = () => collection.confirmSponsorship(alice);217 await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.ConfirmSponsorshipFail/);218 });219220 itSub('(!negative test!) Confirm sponsorship by collection admin', async ({helper}) => {221 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});222 await collection.setSponsor(alice, bob.address);223 await collection.addAdmin(alice, {Substrate: charlie.address});224 const confirmSponsorshipTx = () => collection.confirmSponsorship(charlie);225 await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.ConfirmSponsorshipFail/);226 });227228 itSub('(!negative test!) Confirm sponsorship without sponsor being set with setCollectionSponsor', async ({helper}) => {229 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});230 const confirmSponsorshipTx = () => collection.confirmSponsorship(charlie);231 await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.ConfirmSponsorshipFail/);232 });233234 itSub('(!negative test!) Confirm sponsorship in a collection that was destroyed', async ({helper}) => {235 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});236 await collection.burn(alice);237 const confirmSponsorshipTx = () => collection.confirmSponsorship(charlie);238 await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.CollectionNotFound/);239 });240241 itSub('(!negative test!) Transfer fees are not paid by the sponsor if the transfer failed', async ({helper}) => {242 const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});243 await collection.setSponsor(alice, bob.address);244 await collection.confirmSponsorship(bob);245 const token = await collection.mintToken(alice, {Substrate: ownerZeroBalance.address});246 const sponsorBalanceBefore = await helper.balance.getSubstrate(bob.address);247 const transferTx = () => token.transfer(senderZeroBalance, {Substrate: alice.address});248 await expect(transferTx()).to.be.rejectedWith('Inability to pay some fees');249 const sponsorBalanceAfter = await helper.balance.getSubstrate(bob.address);250 expect(sponsorBalanceAfter).to.equal(sponsorBalanceBefore);251 });252});tests/src/eth/util/playgrounds/types.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/types.ts
+++ b/tests/src/eth/util/playgrounds/types.ts
@@ -48,5 +48,3 @@
field: CollectionLimitField,
value: OptionUint,
}
-
-export const NON_EXISTENT_COLLECTION_ID = 4_294_967_295;
\ No newline at end of file
tests/src/removeCollectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/removeCollectionAdmin.test.ts
+++ b/tests/src/removeCollectionAdmin.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, usingPlaygrounds, expect} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test removeCollectionAdmin(collection_id, account_id):', () => {
let alice: IKeyringPair;
@@ -68,7 +69,7 @@
});
itSub('Can\'t remove collection admin from not existing collection', async ({helper}) => {
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.removeAdmin(alice, collectionId, {Substrate: bob.address}))
.to.be.rejectedWith(/common\.CollectionNotFound/);
tests/src/removeCollectionSponsor.test.tsdiffbeforeafterboth--- a/tests/src/removeCollectionSponsor.test.ts
+++ b/tests/src/removeCollectionSponsor.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, usingPlaygrounds, expect} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('integration test: ext. removeCollectionSponsor():', () => {
let donor: IKeyringPair;
@@ -91,7 +92,7 @@
});
itSub('(!negative test!) Remove sponsor for a collection that never existed', async ({helper}) => {
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.removeSponsor(alice, collectionId)).to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/setCollectionLimits.test.tsdiffbeforeafterboth--- a/tests/src/setCollectionLimits.test.ts
+++ b/tests/src/setCollectionLimits.test.ts
@@ -17,6 +17,7 @@
// https://unique-network.readthedocs.io/en/latest/jsapi.html#setchainlimits
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, usingPlaygrounds, expect} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
const accountTokenOwnershipLimit = 0;
const sponsoredDataSize = 0;
@@ -110,7 +111,7 @@
});
itSub('execute setCollectionLimits for not exists collection', async ({helper}) => {
- const nonExistentCollectionId = (1 << 32) - 1;
+ const nonExistentCollectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.setLimits(
alice,
nonExistentCollectionId,
tests/src/setCollectionSponsor.test.tsdiffbeforeafterboth--- a/tests/src/setCollectionSponsor.test.ts
+++ b/tests/src/setCollectionSponsor.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, usingPlaygrounds, expect, Pallets} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('integration test: ext. setCollectionSponsor():', () => {
let alice: IKeyringPair;
@@ -105,7 +106,7 @@
});
itSub('(!negative test!) Add sponsor to a collection that never existed', async ({helper}) => {
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.setSponsor(alice, collectionId, bob.address))
.to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/setPermissions.test.tsdiffbeforeafterboth--- a/tests/src/setPermissions.test.ts
+++ b/tests/src/setPermissions.test.ts
@@ -16,6 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, usingPlaygrounds, expect} from './util';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test: Set Permissions', () => {
let alice: IKeyringPair;
@@ -85,7 +86,7 @@
});
itSub('fails on not existing collection', async ({helper}) => {
- const collectionId = (1 << 32) - 1;
+ const collectionId = NON_EXISTENT_COLLECTION_ID;
await expect(helper.collection.setPermissions(alice, collectionId, {access: 'AllowList', mintMode: true}))
.to.be.rejectedWith(/common\.CollectionNotFound/);
});
tests/src/transfer.test.tsdiffbeforeafterboth--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -17,7 +17,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itEth, usingEthPlaygrounds} from './eth/util';
import {itSub, Pallets, usingPlaygrounds, expect} from './util';
-import {NON_EXISTENT_COLLECTION_ID} from './eth/util/playgrounds/types';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test Transfer(recipient, collection_id, item_id, value)', () => {
let donor: IKeyringPair;
tests/src/transferFrom.test.tsdiffbeforeafterboth--- a/tests/src/transferFrom.test.ts
+++ b/tests/src/transferFrom.test.ts
@@ -16,7 +16,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {itSub, Pallets, usingPlaygrounds, expect} from './util';
-import {NON_EXISTENT_COLLECTION_ID} from './eth/util/playgrounds/types';
+import {NON_EXISTENT_COLLECTION_ID} from './util/playgrounds/types';
describe('Integration Test transferFrom(from, recipient, collection_id, item_id, value):', () => {
let alice: IKeyringPair;
tests/src/util/playgrounds/types.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/types.ts
+++ b/tests/src/util/playgrounds/types.ts
@@ -3,6 +3,8 @@
import {IKeyringPair} from '@polkadot/types/types';
+export const NON_EXISTENT_COLLECTION_ID = 4_294_967_295;
+
export interface IEvent {
section: string;
method: string;