--- a/tests/src/maintenance.seqtest.ts +++ b/tests/src/maintenance.seqtest.ts @@ -192,19 +192,22 @@ const blocksToWait = 6; // Scheduling works before the maintenance - await nftBeforeMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdBeforeMM}) - .transfer(bob, {Substrate: superuser.address}); + await helper.scheduler.scheduleAfter(blocksToWait, {scheduledId: scheduledIdBeforeMM}) + .nft.transferToken(bob, collection.collectionId, nftBeforeMM.tokenId, {Substrate: superuser.address}); + await helper.wait.newBlocks(blocksToWait + 1); expect(await nftBeforeMM.getOwner()).to.be.deep.equal({Substrate: superuser.address}); // Schedule a transaction that should occur *during* the maintenance - await nftDuringMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdDuringMM}) - .transfer(bob, {Substrate: superuser.address}); + await helper.scheduler.scheduleAfter(blocksToWait, {scheduledId: scheduledIdDuringMM}) + .nft.transferToken(bob, collection.collectionId, nftDuringMM.tokenId, {Substrate: superuser.address}); + // Schedule a transaction that should occur *after* the maintenance - await nftDuringMM.scheduleAfter(blocksToWait * 2, {scheduledId: scheduledIdBunkerThroughMM}) - .transfer(bob, {Substrate: superuser.address}); + await helper.scheduler.scheduleAfter(blocksToWait * 2, {scheduledId: scheduledIdBunkerThroughMM}) + .nft.transferToken(bob, collection.collectionId, nftDuringMM.tokenId, {Substrate: superuser.address}); + await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []); expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true; @@ -214,16 +217,16 @@ expect(await nftDuringMM.getOwner()).to.be.deep.equal({Substrate: bob.address}); // Any attempts to schedule a tx during the MM should be rejected - await expect(nftDuringMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAttemptDuringMM}) - .transfer(bob, {Substrate: superuser.address})) + await expect(helper.scheduler.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAttemptDuringMM}) + .nft.transferToken(bob, collection.collectionId, nftDuringMM.tokenId, {Substrate: superuser.address})) .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/); await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []); expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false; // Scheduling works after the maintenance - await nftAfterMM.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAfterMM}) - .transfer(bob, {Substrate: superuser.address}); + await helper.scheduler.scheduleAfter(blocksToWait, {scheduledId: scheduledIdAfterMM}) + .nft.transferToken(bob, collection.collectionId, nftAfterMM.tokenId, {Substrate: superuser.address}); await helper.wait.newBlocks(blocksToWait + 1); --- a/tests/src/scheduler.seqtest.ts +++ b/tests/src/scheduler.seqtest.ts @@ -47,9 +47,8 @@ const token = await collection.mintToken(alice); const scheduledId = scheduleKind == 'named' ? helper.arrange.makeScheduledId() : undefined; const blocksBeforeExecution = 4; - - await token.scheduleAfter(blocksBeforeExecution, {scheduledId}) - .transfer(alice, {Substrate: bob.address}); + await helper.scheduler.scheduleAfter(blocksBeforeExecution, {scheduledId}) + .nft.transferToken(alice, collection.collectionId, token.tokenId, {Substrate: bob.address}); const executionBlock = await helper.chain.getLatestBlockNumber() + blocksBeforeExecution + 1; expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address}); @@ -103,8 +102,8 @@ expect(await token.getOwner()).to.be.deep.equal({Substrate: alice.address}); - await token.scheduleAfter(waitForBlocks, {scheduledId}) - .transfer(alice, {Substrate: bob.address}); + await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId}) + .nft.transferToken(alice, collection.collectionId, token.tokenId, {Substrate: bob.address}); const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1; await helper.scheduler.cancelScheduled(alice, scheduledId); @@ -363,8 +362,8 @@ const scheduledId = helper.arrange.makeScheduledId(); const waitForBlocks = 4; - await token.scheduleAfter(waitForBlocks, {scheduledId}) - .transfer(bob, {Substrate: alice.address}); + await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId}) + .nft.transferToken(bob, collection.collectionId, token.tokenId, {Substrate: alice.address}); const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1; await helper.getSudo().scheduler.cancelScheduled(superuser, scheduledId); @@ -404,8 +403,8 @@ const scheduledId = helper.arrange.makeScheduledId(); const waitForBlocks = 6; - await token.scheduleAfter(waitForBlocks, {scheduledId}) - .transfer(bob, {Substrate: alice.address}); + await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId}) + .nft.transferToken(bob, collection.collectionId, token.tokenId, {Substrate: alice.address}); const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1; const priority = 112; @@ -583,8 +582,8 @@ const scheduledId = helper.arrange.makeScheduledId(); const waitForBlocks = 4; - await token.scheduleAfter(waitForBlocks, {scheduledId}) - .transfer(alice, {Substrate: bob.address}); + await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId}) + .nft.transferToken(alice, collection.collectionId, token.tokenId, {Substrate: bob.address}); const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1; const scheduled = helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId}); @@ -614,8 +613,8 @@ const scheduledId = helper.arrange.makeScheduledId(); const waitForBlocks = 4; - await token.scheduleAfter(waitForBlocks, {scheduledId}) - .transfer(alice, {Substrate: bob.address}); + await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId}) + .nft.transferToken(alice, collection.collectionId, token.tokenId, {Substrate: bob.address}); const executionBlock = await helper.chain.getLatestBlockNumber() + waitForBlocks + 1; await expect(helper.scheduler.cancelScheduled(bob, scheduledId)) @@ -655,8 +654,8 @@ const scheduledId = helper.arrange.makeScheduledId(); const waitForBlocks = 4; - await token.scheduleAfter(waitForBlocks, {scheduledId}) - .transfer(bob, {Substrate: alice.address}); + await helper.scheduler.scheduleAfter(waitForBlocks, {scheduledId}) + .nft.transferToken(bob, collection.collectionId, token.tokenId, {Substrate: alice.address}); const priority = 112; await expect(helper.scheduler.changePriority(alice, scheduledId, priority)) --- a/tests/src/util/playgrounds/unique.dev.ts +++ b/tests/src/util/playgrounds/unique.dev.ts @@ -609,7 +609,7 @@ this.wait = new WaitGroup(this); } - getSudo() { + getSudo() { // eslint-disable-next-line @typescript-eslint/naming-convention const SudoHelperType = SudoHelper(this.helperBase); return this.clone(SudoHelperType) as T; @@ -636,7 +636,7 @@ super(logger, options); this.wait = new WaitGroup(this); } - getSudo() { + getSudo() { // eslint-disable-next-line @typescript-eslint/naming-convention const SudoHelperType = SudoHelper(this.helperBase); return this.clone(SudoHelperType) as T;