difftreelog
CORE-410 Restor tests
in: master
6 files changed
tests/src/interfaces/augment-api-query.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-query.ts
+++ b/tests/src/interfaces/augment-api-query.ts
@@ -408,6 +408,7 @@
**/
owned: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array, arg3: u32 | AnyNumber | Uint8Array) => Observable<bool>, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]> & QueryableStorageEntry<ApiType, [u32, PalletEvmAccountBasicCrossAccountIdRepr, u32]>;
tokenData: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<PalletRefungibleItemData>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
+ tokenProperties: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<UpDataStructsProperties>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
tokensBurnt: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
tokensMinted: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<u32>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
totalSupply: AugmentedQuery<ApiType, (arg1: u32 | AnyNumber | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<u128>, [u32, u32]> & QueryableStorageEntry<ApiType, [u32, u32]>;
tests/src/interfaces/default/types.tsdiffbeforeafterboth--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -2461,12 +2461,14 @@
export interface UpDataStructsCreateReFungibleData extends Struct {
readonly constData: Bytes;
readonly pieces: u128;
+ readonly properties: Vec<UpDataStructsProperty>;
}
/** @name UpDataStructsCreateRefungibleExData */
export interface UpDataStructsCreateRefungibleExData extends Struct {
readonly constData: Bytes;
readonly users: BTreeMap<PalletEvmAccountBasicCrossAccountIdRepr, u128>;
+ readonly properties: Vec<UpDataStructsProperty>;
}
/** @name UpDataStructsNestingPermissions */
tests/src/interfaces/lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/lookup.ts
+++ b/tests/src/interfaces/lookup.ts
@@ -1502,7 +1502,8 @@
**/
UpDataStructsCreateReFungibleData: {
constData: 'Bytes',
- pieces: 'u128'
+ pieces: 'u128',
+ properties: 'Vec<UpDataStructsProperty>'
},
/**
* Lookup193: up_data_structs::CreateItemExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
@@ -1527,7 +1528,8 @@
**/
UpDataStructsCreateRefungibleExData: {
constData: 'Bytes',
- users: 'BTreeMap<PalletEvmAccountBasicCrossAccountIdRepr, u128>'
+ users: 'BTreeMap<PalletEvmAccountBasicCrossAccountIdRepr, u128>',
+ properties: 'Vec<UpDataStructsProperty>'
},
/**
* Lookup204: pallet_unique_scheduler::pallet::Call<T>
tests/src/interfaces/types-lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -1629,6 +1629,7 @@
export interface UpDataStructsCreateReFungibleData extends Struct {
readonly constData: Bytes;
readonly pieces: u128;
+ readonly properties: Vec<UpDataStructsProperty>;
}
/** @name UpDataStructsCreateItemExData (193) */
@@ -1654,6 +1655,7 @@
export interface UpDataStructsCreateRefungibleExData extends Struct {
readonly constData: Bytes;
readonly users: BTreeMap<PalletEvmAccountBasicCrossAccountIdRepr, u128>;
+ readonly properties: Vec<UpDataStructsProperty>;
}
/** @name PalletUniqueSchedulerCall (204) */
tests/src/nesting/properties.test.tsdiffbeforeafterboth806 await testDeletePropertiesAccordingPermission({type: 'ReFungible'}, 100);806 await testDeletePropertiesAccordingPermission({type: 'ReFungible'}, 100);807 });807 });808808809 // it('Assigns properties to a nested token according to permissions', async () => {809 it('Assigns properties to a nested token according to permissions', async () => {810 // await usingApi(async api => {810 await usingApi(async api => {811 // const propertyKeys: string[] = [];811 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});812 // let i = 0;812 await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});813 // for (const permission of permissions) {813 const token = await createItemExpectSuccess(alice, collection, 'NFT');814 // for (const signer of permission.signers) {814 const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, token)});815 // const key = i + '_' + signer.address;815 await addCollectionAdminExpectSuccess(alice, collection, bob.address);816 // propertyKeys.push(key);816 await transferExpectSuccess(collection, token, alice, charlie);817817818 // await expect(executeTransaction(818 const propertyKeys: string[] = [];819 // api, 819 let i = 0;820 // alice, 820 for (const permission of permissions) {821 // api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 821 for (const signer of permission.signers) {822 // ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;822 const key = i + '_' + signer.address;823823 propertyKeys.push(key);824 // await expect(executeTransaction(824825 // api, 825 await expect(executeTransaction(826 // signer, 826 api, 827 // api.tx.unique.setTokenProperties(collection, nestedToken, [{key: key, value: 'Serotonin increase'}]), 827 alice, 828 // ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;828 api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 829 // }829 ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;830830831 // i++;831 await expect(executeTransaction(832 // }832 api, 833833 signer, 834 // const properties = (await api.rpc.unique.tokenProperties(collection, nestedToken, propertyKeys)).toHuman() as any[];834 api.tx.unique.setTokenProperties(collection, nestedToken, [{key: key, value: 'Serotonin increase'}]), 835 // const tokensData = (await api.rpc.unique.tokenData(collection, nestedToken, propertyKeys)).toHuman().properties as any[];835 ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;836 // for (let i = 0; i < properties.length; i++) {836 }837 // expect(properties[i].value).to.be.equal('Serotonin increase');837838 // expect(tokensData[i].value).to.be.equal('Serotonin increase');838 i++;839 // }839 }840 // });840841 // });841 const properties = (await api.rpc.unique.tokenProperties(collection, nestedToken, propertyKeys)).toHuman() as any[];842842 const tokensData = (await api.rpc.unique.tokenData(collection, nestedToken, propertyKeys)).toHuman().properties as any[];843 // it('Changes properties of a nested token according to permissions', async () => {843 for (let i = 0; i < properties.length; i++) {844 // await usingApi(async api => {844 expect(properties[i].value).to.be.equal('Serotonin increase');845 // const propertyKeys: string[] = [];845 expect(tokensData[i].value).to.be.equal('Serotonin increase');846 // let i = 0;846 }847 // for (const permission of permissions) {847 });848 // if (!permission.permission.mutable) continue;848 });849 849850 // for (const signer of permission.signers) {850 it('Changes properties of a nested token according to permissions', async () => {851 // const key = i + '_' + signer.address;851 await usingApi(async api => {852 // propertyKeys.push(key);852 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});853853 await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});854 // await expect(executeTransaction(854 const token = await createItemExpectSuccess(alice, collection, 'NFT');855 // api, 855 const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, token)});856 // alice, 856 await addCollectionAdminExpectSuccess(alice, collection, bob.address);857 // api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 857 await transferExpectSuccess(collection, token, alice, charlie);858 // ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;858859859 const propertyKeys: string[] = [];860 // await expect(executeTransaction(860 let i = 0;861 // api, 861 for (const permission of permissions) {862 // signer, 862 if (!permission.permission.mutable) continue;863 // api.tx.unique.setTokenProperties(collection, nestedToken, [{key: key, value: 'Serotonin increase'}]), 863 864 // ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;864 for (const signer of permission.signers) {865865 const key = i + '_' + signer.address;866 // await expect(executeTransaction(866 propertyKeys.push(key);867 // api, 867868 // signer, 868 await expect(executeTransaction(869 // api.tx.unique.setTokenProperties(collection, nestedToken, [{key: key, value: 'Serotonin stable'}]), 869 api, 870 // ), `on changing property ${i} by ${signer.address}`).to.not.be.rejected;870 alice, 871 // }871 api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 872872 ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;873 // i++;873874 // }874 await expect(executeTransaction(875875 api, 876 // const properties = (await api.rpc.unique.tokenProperties(collection, nestedToken, propertyKeys)).toHuman() as any[];876 signer, 877 // const tokensData = (await api.rpc.unique.tokenData(collection, nestedToken, propertyKeys)).toHuman().properties as any[];877 api.tx.unique.setTokenProperties(collection, nestedToken, [{key: key, value: 'Serotonin increase'}]), 878 // for (let i = 0; i < properties.length; i++) {878 ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;879 // expect(properties[i].value).to.be.equal('Serotonin stable');879880 // expect(tokensData[i].value).to.be.equal('Serotonin stable');880 await expect(executeTransaction(881 // }881 api, 882 // });882 signer, 883 // });883 api.tx.unique.setTokenProperties(collection, nestedToken, [{key: key, value: 'Serotonin stable'}]), 884884 ), `on changing property ${i} by ${signer.address}`).to.not.be.rejected;885 // it('Deletes properties of a nested token according to permissions', async () => {885 }886 // await usingApi(async api => {886887 // const propertyKeys: string[] = [];887 i++;888 // let i = 0;888 }889889890 // for (const permission of permissions) {890 const properties = (await api.rpc.unique.tokenProperties(collection, nestedToken, propertyKeys)).toHuman() as any[];891 // if (!permission.permission.mutable) continue;891 const tokensData = (await api.rpc.unique.tokenData(collection, nestedToken, propertyKeys)).toHuman().properties as any[];892 892 for (let i = 0; i < properties.length; i++) {893 // for (const signer of permission.signers) {893 expect(properties[i].value).to.be.equal('Serotonin stable');894 // const key = i + '_' + signer.address;894 expect(tokensData[i].value).to.be.equal('Serotonin stable');895 // propertyKeys.push(key);895 }896896 });897 // await expect(executeTransaction(897 });898 // api, 898899 // alice, 899 it('Deletes properties of a nested token according to permissions', async () => {900 // api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 900 await usingApi(async api => {901 // ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;901 const collection = await createCollectionExpectSuccess({mode: {type: 'NFT'}});902902 await setCollectionPermissionsExpectSuccess(alice, collection, {nesting: {tokenOwner: true}});903 // await expect(executeTransaction(903 const token = await createItemExpectSuccess(alice, collection, 'NFT');904 // api, 904 const nestedToken = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: tokenIdToAddress(collection, token)});905 // signer, 905 await addCollectionAdminExpectSuccess(alice, collection, bob.address);906 // api.tx.unique.setTokenProperties(collection, nestedToken, [{key: key, value: 'Serotonin increase'}]), 906 await transferExpectSuccess(collection, token, alice, charlie);907 // ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;907908908 const propertyKeys: string[] = [];909 // await expect(executeTransaction(909 let i = 0;910 // api, 910911 // signer, 911 for (const permission of permissions) {912 // api.tx.unique.deleteTokenProperties(collection, nestedToken, [key]), 912 if (!permission.permission.mutable) continue;913 // ), `on deleting property ${i} by ${signer.address}`).to.not.be.rejected;913 914 // }914 for (const signer of permission.signers) {915 915 const key = i + '_' + signer.address;916 // i++;916 propertyKeys.push(key);917 // }917918918 await expect(executeTransaction(919 // const properties = (await api.rpc.unique.tokenProperties(collection, nestedToken, propertyKeys)).toJSON() as any[];919 api, 920 // expect(properties).to.be.empty;920 alice, 921 // const tokensData = (await api.rpc.unique.tokenData(collection, nestedToken, propertyKeys)).toJSON().properties as any[];921 api.tx.unique.setTokenPropertyPermissions(collection, [{key: key, permission: permission.permission}]), 922 // expect(tokensData).to.be.empty;922 ), `on setting permission ${i} by ${signer.address}`).to.not.be.rejected;923 // expect((await api.query.nonfungible.tokenProperties(collection, nestedToken)).toJSON().consumedSpace).to.be.equal(0);923924 // });924 await expect(executeTransaction(925 // });925 api, 926 signer, 927 api.tx.unique.setTokenProperties(collection, nestedToken, [{key: key, value: 'Serotonin increase'}]), 928 ), `on adding property ${i} by ${signer.address}`).to.not.be.rejected;929930 await expect(executeTransaction(931 api, 932 signer, 933 api.tx.unique.deleteTokenProperties(collection, nestedToken, [key]), 934 ), `on deleting property ${i} by ${signer.address}`).to.not.be.rejected;935 }936 937 i++;938 }939940 const properties = (await api.rpc.unique.tokenProperties(collection, nestedToken, propertyKeys)).toJSON() as any[];941 expect(properties).to.be.empty;942 const tokensData = (await api.rpc.unique.tokenData(collection, nestedToken, propertyKeys)).toJSON().properties as any[];943 expect(tokensData).to.be.empty;944 expect((await api.query.nonfungible.tokenProperties(collection, nestedToken)).toJSON().consumedSpace).to.be.equal(0);945 });946 });926});947});927948928describe('Negative Integration Test: Token Properties', () => {949describe('Negative Integration Test: Token Properties', () => {tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -1414,7 +1414,7 @@
tx = api.tx.unique.createItem(collectionId, to, createData as any);
}
- const events = await submitTransactionAsync(sender, tx);
+ const events = await executeTransaction(api, sender, tx);
const result = getCreateItemResult(events);
const itemCountAfter = await getLastTokenId(api, collectionId);