difftreelog
feat add foreignAssets to playgrnds
in: master
2 files changed
tests/src/util/playgrounds/types.tsdiffbeforeafterboth172 },172 },173}173}174175export interface IForeignAssetMetadata {176 name?: number | Uint8Array,177 symbol?: string,178 decimals?: number,179 minimalBalance?: bigint,180}174181175export type TSubstrateAccount = string;182export type TSubstrateAccount = string;176export type TEthereumAccount = string;183export type TEthereumAccount = string;tests/src/util/playgrounds/unique.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -9,7 +9,7 @@
import {ApiInterfaceEvents, SignerOptions} from '@polkadot/api/types';
import {encodeAddress, decodeAddress, keccakAsHex, evmToAddress, addressToEvm} from '@polkadot/util-crypto';
import {IKeyringPair} from '@polkadot/types/types';
-import {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';
+import {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';
export class CrossAccountId implements ICrossAccountId {
Substrate?: TSubstrateAccount;
@@ -2314,6 +2314,30 @@
}
}
+class ForeignAssetsGroup extends HelperGroup {
+ constructor(helper: UniqueHelper) {
+ super(helper);
+ }
+
+ async register(signer: TSigner, ownerAddress: TSubstrateAccount, location: any, metadata: IForeignAssetMetadata) {
+ await this.helper.executeExtrinsic(
+ signer,
+ 'api.tx.foreignAssets.registerForeignAsset',
+ [ownerAddress, location, metadata],
+ true,
+ );
+ }
+
+ async update(signer: TSigner, foreignAssetId: number, location: any, metadata: IForeignAssetMetadata) {
+ await this.helper.executeExtrinsic(
+ signer,
+ 'api.tx.foreignAssets.updateForeignAsset',
+ [foreignAssetId, location, metadata],
+ true,
+ );
+ }
+}
+
export type UniqueHelperConstructor = new(...args: any[]) => UniqueHelper;
export class UniqueHelper extends ChainHelperBase {
@@ -2328,6 +2352,7 @@
ft: FTGroup;
staking: StakingGroup;
scheduler: SchedulerGroup;
+ foreignAssets: ForeignAssetsGroup;
constructor(logger?: ILogger, options: {[key: string]: any} = {}) {
super(logger);
@@ -2343,6 +2368,7 @@
this.ft = new FTGroup(this);
this.staking = new StakingGroup(this);
this.scheduler = new SchedulerGroup(this);
+ this.foreignAssets = new ForeignAssetsGroup(this);
}
clone(helperCls: UniqueHelperConstructor, options: {[key: string]: any} = {}) {