Skip to content

Commit

Permalink
Update type naming
Browse files Browse the repository at this point in the history
  • Loading branch information
vkulinich-cl committed Mar 19, 2024
1 parent de41dbb commit cd9e76c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
6 changes: 2 additions & 4 deletions packages/sdk/src/client/AssetClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ITuple } from '@polkadot/types-codec/types';
import { u32, u64 } from '@polkadot/types-codec';
import { ApiPromise } from '@polkadot/api';
import { SYSTEM_ASSET_ID } from '../consts';
import { Asset, AssetMetadata, ExternalAssetMeta } from '../types';
import { Asset, AssetMetadata, AssetBase } from '../types';
import { findNestedKey } from '../utils/json';

import { PolkadotApiClient } from './PolkadotApi';
Expand Down Expand Up @@ -199,9 +199,7 @@ export class AssetClient extends PolkadotApiClient {
} as Asset;
}

async getOnChainAssets(
externalAssetsMeta?: ExternalAssetMeta[]
): Promise<Asset[]> {
async getOnChainAssets(externalAssetsMeta?: AssetBase[]): Promise<Asset[]> {
const [asset, assetLocations, shares, bonds, assetMetadata] =
await Promise.all([
this.api.query.assetRegistry.assets.entries(),
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/pool/PoolService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
Pool,
Asset,
PoolServiceOptions,
ExternalAssetMeta,
AssetBase,
} from '../types';
import { BigNumber } from '../utils/bignumber';

Expand All @@ -33,7 +33,7 @@ export class PoolService implements IPoolService {
protected readonly stableClient: StableSwapClient;

protected onChainAssets: Asset[] = [];
protected externalAssetsMeta: ExternalAssetMeta[] | undefined = [];
protected externalAssetsMeta: AssetBase[] | undefined = [];
protected onChainAssetsLoaded = false;

constructor(api: ApiPromise, options?: PoolServiceOptions) {
Expand Down
20 changes: 7 additions & 13 deletions packages/sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,30 +165,24 @@ export type Amount = {
decimals: number;
};

export interface Asset {
id: string;
decimals: number;
name: string;
symbol: string;
export interface Asset extends AssetBase {
icon: string;
type: string;
existentialDeposit: string;
origin?: number;
meta?: Record<string, string>;
}

export interface AssetMetadata {
decimals: number;
symbol: string;
export interface AssetBase extends AssetMetadata {
id: string;
name: string;
}

export type ExternalAssetMeta = {
id: string;
export interface AssetMetadata {
decimals: number;
name: string;
symbol: string;
};
}

export type PoolServiceOptions = {
externalAssets: ExternalAssetMeta[];
externalAssets: AssetBase[];
};

0 comments on commit cd9e76c

Please sign in to comment.