git.delta.rocks / unique-network / refs/commits / 6f234a4dd6c2

difftreelog

test get rid of AccountId::default

Yaroslav Bolyukin2022-04-08parent: #7e32db5.patch.diff
in: master

5 files changed

modifiedtests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth
633 /**633 /**
634 * Get token owner634 * Get token owner
635 **/635 **/
636 tokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<PalletEvmAccountBasicCrossAccountIdRepr>>;636 tokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>>;
637 /**637 /**
638 * Get token owner, in case of nested token - find parent recursive638 * Get token owner, in case of nested token - find parent recursive
639 **/639 **/
640 topmostTokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<PalletEvmAccountBasicCrossAccountIdRepr>>;640 topmostTokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>>;
641 /**641 /**
642 * Get token variable metadata642 * Get token variable metadata
643 **/643 **/
modifiedtests/src/interfaces/unique/definitions.tsdiffbeforeafterboth
48 accountBalance: fun('Get amount of different user tokens', [collectionParam, crossAccountParam()], 'u32'),48 accountBalance: fun('Get amount of different user tokens', [collectionParam, crossAccountParam()], 'u32'),
49 balance: fun('Get amount of specific account token', [collectionParam, crossAccountParam(), tokenParam], 'u128'),49 balance: fun('Get amount of specific account token', [collectionParam, crossAccountParam(), tokenParam], 'u128'),
50 allowance: fun('Get allowed amount', [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 'u128'),50 allowance: fun('Get allowed amount', [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 'u128'),
51 tokenOwner: fun('Get token owner', [collectionParam, tokenParam], CROSS_ACCOUNT_ID_TYPE),51 tokenOwner: fun('Get token owner', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
52 topmostTokenOwner: fun('Get token owner, in case of nested token - find parent recursive', [collectionParam, tokenParam], CROSS_ACCOUNT_ID_TYPE),52 topmostTokenOwner: fun('Get token owner, in case of nested token - find parent recursive', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
53 constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),53 constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),
54 variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),54 variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),
55 tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),55 tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),
modifiedtests/src/nesting/nest.test.tsdiffbeforeafterboth
4import usingApi from '../substrate/substrate-api';4import usingApi from '../substrate/substrate-api';
5import {createCollectionExpectSuccess, createItemExpectSuccess, getTokenOwner, getTopmostTokenOwner, setCollectionLimitsExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../util/helpers';5import {createCollectionExpectSuccess, createItemExpectSuccess, getTokenOwner, getTopmostTokenOwner, setCollectionLimitsExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../util/helpers';
66
7describe.only('nesting', () => {7describe('nesting', () => {
8 it('allows to nest/unnest token', async () => {8 it('allows to nest/unnest token', async () => {
9 await usingApi(async api => {9 await usingApi(async api => {
10 const alice = privateKey('//Alice');10 const alice = privateKey('//Alice');
addedtests/src/rpc.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/util/helpers.tsdiffbeforeafterboth
985 collectionId: number,985 collectionId: number,
986 token: number,986 token: number,
987): Promise<CrossAccountId> {987): Promise<CrossAccountId> {
988 return normalizeAccountId((await api.rpc.unique.tokenOwner(collectionId, token)).toJSON() as any);988 const owner = (await api.rpc.unique.tokenOwner(collectionId, token)).toJSON() as any;
989 if (owner == null) throw new Error('owner == null');
990 return normalizeAccountId(owner);
989}991}
990export async function getTopmostTokenOwner(992export async function getTopmostTokenOwner(
991 api: ApiPromise,993 api: ApiPromise,
992 collectionId: number,994 collectionId: number,
993 token: number,995 token: number,
994): Promise<CrossAccountId> {996): Promise<CrossAccountId> {
995 return normalizeAccountId((await api.rpc.unique.topmostTokenOwner(collectionId, token)).toJSON() as any);997 const owner = (await api.rpc.unique.topmostTokenOwner(collectionId, token)).toJSON() as any;
998 if (owner == null) throw new Error('owner == null');
999 return normalizeAccountId(owner);
996}1000}
997export async function isTokenExists(1001export async function isTokenExists(
998 api: ApiPromise,1002 api: ApiPromise,