1234567891011121314151617import {IKeyringPair} from '@polkadot/types/types';18import {expect, itSub, Pallets, usingPlaygrounds} from '../../util';1920describe('ReFungible-specific nesting tests', () => {21 let alice: IKeyringPair;2223 before(async () => {24 await usingPlaygrounds(async (helper, privateKey) => {25 const donor = await privateKey({url: import.meta.url});26 [alice] = await helper.arrange.createAccounts([200n], donor);27 });28 });2930 itSub.ifWithPallets('ReFungible: getTopmostOwner works correctly with Nesting', [Pallets.ReFungible], async({helper}) => {31 const collectionNFT = await helper.nft.mintCollection(alice, {32 permissions: {33 nesting: {34 tokenOwner: true,35 },36 },37 });38 const collectionRFT = await helper.rft.mintCollection(alice);3940 const nft = await collectionNFT.mintToken(alice, {Substrate: alice.address});41 const rft = await collectionRFT.mintToken(alice, 100n, {Substrate: alice.address});4243 expect(await rft.getTopmostOwner()).deep.equal({Substrate: alice.address});4445 await rft.transfer(alice, nft.nestingAccount(), 40n);4647 expect(await rft.getTopmostOwner()).deep.equal(null);4849 await rft.transfer(alice, nft.nestingAccount(), 60n);5051 expect(await rft.getTopmostOwner()).deep.equal({Substrate: alice.address});5253 await rft.transferFrom(alice, nft.nestingAccount(), {Substrate: alice.address}, 30n);5455 expect(await rft.getTopmostOwner()).deep.equal(null);5657 await rft.transferFrom(alice, nft.nestingAccount(), {Substrate: alice.address}, 70n);5859 expect(await rft.getTopmostOwner()).deep.equal({Substrate: alice.address});60 });61});