--- a/tests/src/util/helpers.ts +++ b/tests/src/util/helpers.ts @@ -100,6 +100,23 @@ checkMsgSysMethod: string; } +export interface IFungibleTokenDataType { + Value: number; +} + +export interface IChainLimits { + CollectionNumbersLimit: number; + AccountTokenOwnershipLimit: number; + CollectionsAdminsLimit: number; + CustomDataLimit: number; + NftSponsorTransferTimeout: number; + FungibleSponsorTransferTimeout: number; + RefungibleSponsorTransferTimeout: number; + OffchainSchemaLimit: number; + VariableOnChainSchemaLimit: number; + ConstOnChainSchemaLimit: number; +} + export interface IReFungibleTokenDataType { Owner: IReFungibleOwner[]; ConstData: number[]; @@ -457,11 +474,11 @@ }); } -export async function removeCollectionSponsorExpectFailure(collectionId: number) { +export async function removeCollectionSponsorExpectFailure(collectionId: number, senderSeed = '//Alice') { await usingApi(async (api) => { // Run the transaction - const alicePrivateKey = privateKey('//Alice'); + const alicePrivateKey = privateKey(senderSeed); const tx = api.tx.nft.removeCollectionSponsor(collectionId); await expect(submitTransactionExpectFailAsync(alicePrivateKey, tx)).to.be.rejected; }); @@ -770,6 +787,15 @@ }); } +export async function addCollectionAdminExpectSuccess(sender: IKeyringPair, collectionId: number, address: IKeyringPair) { + await usingApi(async (api) => { + const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(address.address)); + const events = await submitTransactionAsync(sender, changeAdminTx); + const result = getCreateCollectionResult(events); + expect(result.success).to.be.true; + }); +} + export async function scheduleTransferExpectSuccess( collectionId: number, @@ -1047,6 +1073,17 @@ }); } +export async function setChainLimitsExpectFailure(sender: IKeyringPair, limits: IChainLimits) { + await usingApi(async (api) => { + // Run the transaction + const tx = api.tx.nft.setChainLimits(limits); + const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected; + const result = getCreateCollectionResult(events); + // tslint:disable-next-line:no-unused-expression + expect(result.success).to.be.false; + }); +} + export async function isWhitelisted(collectionId: number, address: string) { let whitelisted = false; await usingApi(async (api) => {