git.delta.rocks / unique-network / refs/commits / f2ade55622b2

difftreelog

feat add foreignAssets to playgrnds

Daniel Shiposha2022-10-06parent: #3bccb6b.patch.diff
in: master

2 files changed

modifiedtests/src/util/playgrounds/types.tsdiffbeforeafterboth
172 },172 },
173}173}
174
175export interface IForeignAssetMetadata {
176 name?: number | Uint8Array,
177 symbol?: string,
178 decimals?: number,
179 minimalBalance?: bigint,
180}
174181
175export type TSubstrateAccount = string;182export type TSubstrateAccount = string;
176export type TEthereumAccount = string;183export type TEthereumAccount = string;
modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
9import {ApiInterfaceEvents, SignerOptions} from '@polkadot/api/types';9import {ApiInterfaceEvents, SignerOptions} from '@polkadot/api/types';
10import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm} from '@polkadot/util-crypto';10import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm} from '@polkadot/util-crypto';
11import {IKeyringPair} from '@polkadot/types/types';11import {IKeyringPair} from '@polkadot/types/types';
12import {IApiListeners, IBlock, IEvent, IChainProperties, ICollectionCreationOptions, ICollectionLimits, ICollectionPermissions, ICrossAccountId, ICrossAccountIdLower, ILogger, INestingPermissions, IProperty, IStakingInfo, ISchedulerOptions, ISubstrateBalance, IToken, ITokenPropertyPermission, ITransactionResult, IUniqueHelperLog, TApiAllowedListeners, TEthereumAccount, TSigner, TSubstrateAccount, TUniqueNetworks} from './types';12import {IApiListeners, IBlock, IEvent, IChainProperties, ICollectionCreationOptions, ICollectionLimits, ICollectionPermissions, ICrossAccountId, ICrossAccountIdLower, ILogger, INestingPermissions, IProperty, IStakingInfo, ISchedulerOptions, ISubstrateBalance, IToken, ITokenPropertyPermission, ITransactionResult, IUniqueHelperLog, TApiAllowedListeners, TEthereumAccount, TSigner, TSubstrateAccount, TUniqueNetworks, IForeignAssetMetadata} from './types';
1313
14export class CrossAccountId implements ICrossAccountId {14export class CrossAccountId implements ICrossAccountId {
15 Substrate?: TSubstrateAccount;15 Substrate?: TSubstrateAccount;
2314 }2314 }
2315}2315}
2316
2317class ForeignAssetsGroup extends HelperGroup {
2318 constructor(helper: UniqueHelper) {
2319 super(helper);
2320 }
2321
2322 async register(signer: TSigner, ownerAddress: TSubstrateAccount, location: any, metadata: IForeignAssetMetadata) {
2323 await this.helper.executeExtrinsic(
2324 signer,
2325 'api.tx.foreignAssets.registerForeignAsset',
2326 [ownerAddress, location, metadata],
2327 true,
2328 );
2329 }
2330
2331 async update(signer: TSigner, foreignAssetId: number, location: any, metadata: IForeignAssetMetadata) {
2332 await this.helper.executeExtrinsic(
2333 signer,
2334 'api.tx.foreignAssets.updateForeignAsset',
2335 [foreignAssetId, location, metadata],
2336 true,
2337 );
2338 }
2339}
23162340
2317export type UniqueHelperConstructor = new(...args: any[]) => UniqueHelper;2341export type UniqueHelperConstructor = new(...args: any[]) => UniqueHelper;
23182342
2328 ft: FTGroup;2352 ft: FTGroup;
2329 staking: StakingGroup;2353 staking: StakingGroup;
2330 scheduler: SchedulerGroup;2354 scheduler: SchedulerGroup;
2355 foreignAssets: ForeignAssetsGroup;
23312356
2332 constructor(logger?: ILogger, options: {[key: string]: any} = {}) {2357 constructor(logger?: ILogger, options: {[key: string]: any} = {}) {
2333 super(logger);2358 super(logger);
2343 this.ft = new FTGroup(this);2368 this.ft = new FTGroup(this);
2344 this.staking = new StakingGroup(this);2369 this.staking = new StakingGroup(this);
2345 this.scheduler = new SchedulerGroup(this);2370 this.scheduler = new SchedulerGroup(this);
2371 this.foreignAssets = new ForeignAssetsGroup(this);
2346 }2372 }
23472373
2348 clone(helperCls: UniqueHelperConstructor, options: {[key: string]: any} = {}) {2374 clone(helperCls: UniqueHelperConstructor, options: {[key: string]: any} = {}) {