@galacticcouncil/sdk 0.8.0-beta.2 → 0.8.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.cjs +2 -2
- package/build/index.mjs +2 -2
- package/build/types/api/Router.d.ts +9 -9
- package/build/types/client/AssetClient.d.ts +2 -2
- package/build/types/pool/PoolClient.d.ts +4 -4
- package/build/types/pool/PoolService.d.ts +2 -2
- package/build/types/types.d.ts +3 -9
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPoolService, PoolBase, Hop, Pool,
|
|
1
|
+
import { Asset, IPoolService, PoolBase, Hop, Pool, PoolType } from '../types';
|
|
2
2
|
export type RouterOptions = {
|
|
3
3
|
includeOnly?: PoolType[];
|
|
4
4
|
};
|
|
@@ -21,16 +21,16 @@ export declare class Router {
|
|
|
21
21
|
/**
|
|
22
22
|
* Return list of all available assets from substrate based pools
|
|
23
23
|
*
|
|
24
|
-
* @returns {
|
|
24
|
+
* @returns {Asset[]} List of all available assets
|
|
25
25
|
*/
|
|
26
|
-
getAllAssets(): Promise<
|
|
26
|
+
getAllAssets(): Promise<Asset[]>;
|
|
27
27
|
/**
|
|
28
28
|
* Calculate and return list of all assets, given token can be trade with
|
|
29
29
|
*
|
|
30
30
|
* @param {string} asset - Storage key of asset
|
|
31
|
-
* @returns {
|
|
31
|
+
* @returns {Asset[]} List of all available assets, given token can be trade with
|
|
32
32
|
*/
|
|
33
|
-
getAssetPairs(asset: string): Promise<
|
|
33
|
+
getAssetPairs(asset: string): Promise<Asset[]>;
|
|
34
34
|
/**
|
|
35
35
|
* Calculate and return all possible paths for best swap assetIn>assetOut
|
|
36
36
|
*
|
|
@@ -45,7 +45,7 @@ export declare class Router {
|
|
|
45
45
|
* @param pools - pools
|
|
46
46
|
* @returns Map of all available assets
|
|
47
47
|
*/
|
|
48
|
-
protected getAssets(pools: PoolBase[]): Promise<Map<string,
|
|
48
|
+
protected getAssets(pools: PoolBase[]): Promise<Map<string, Asset>>;
|
|
49
49
|
/**
|
|
50
50
|
* Calculate and return all possible paths for best swap assetIn>assetOut
|
|
51
51
|
*
|
|
@@ -64,7 +64,7 @@ export declare class Router {
|
|
|
64
64
|
* @returns Pool assets & map
|
|
65
65
|
*/
|
|
66
66
|
protected validateTokenPair(assetIn: string, assetOut: string, pools: PoolBase[]): Promise<{
|
|
67
|
-
assets: Map<string,
|
|
67
|
+
assets: Map<string, Asset>;
|
|
68
68
|
poolsMap: Map<string, Pool>;
|
|
69
69
|
}>;
|
|
70
70
|
/**
|
|
@@ -74,7 +74,7 @@ export declare class Router {
|
|
|
74
74
|
* @returns Pool assets & map
|
|
75
75
|
*/
|
|
76
76
|
protected validateToken(token: string, pools: PoolBase[]): Promise<{
|
|
77
|
-
assets: Map<string,
|
|
77
|
+
assets: Map<string, Asset>;
|
|
78
78
|
poolsMap: Map<string, Pool>;
|
|
79
79
|
}>;
|
|
80
80
|
/**
|
|
@@ -98,5 +98,5 @@ export declare class Router {
|
|
|
98
98
|
*/
|
|
99
99
|
private validEdge;
|
|
100
100
|
private toHops;
|
|
101
|
-
private
|
|
101
|
+
private toAssets;
|
|
102
102
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PalletAssetRegistryAssetMetadata, PalletStableswapPoolInfo } from '@polkadot/types/lookup';
|
|
2
2
|
import { ApiPromise } from '@polkadot/api';
|
|
3
|
-
import {
|
|
3
|
+
import { Asset } from '../types';
|
|
4
4
|
import { PolkadotApiClient } from './PolkadotApi';
|
|
5
5
|
import { ITuple } from '@polkadot/types-codec/types';
|
|
6
6
|
import { u32, u64 } from '@polkadot/types-codec';
|
|
@@ -13,6 +13,6 @@ export declare class AssetClient extends PolkadotApiClient {
|
|
|
13
13
|
private getTokenMetadata;
|
|
14
14
|
private getBondMetadata;
|
|
15
15
|
private getShareMetadata;
|
|
16
|
-
getOnChainMetadata(): Promise<
|
|
16
|
+
getOnChainMetadata(): Promise<Asset[]>;
|
|
17
17
|
private isSupportedType;
|
|
18
18
|
}
|
|
@@ -13,11 +13,11 @@ export declare abstract class PoolClient extends BalanceClient {
|
|
|
13
13
|
protected abstract subscribePoolChange(pool: PoolBase): UnsubscribePromise;
|
|
14
14
|
getPools(): Promise<PoolBase[]>;
|
|
15
15
|
subscribe(): Promise<VoidFn[]>;
|
|
16
|
+
private subscribeLog;
|
|
16
17
|
unsubscribe(): void;
|
|
17
18
|
private hasShareAsset;
|
|
18
|
-
private
|
|
19
|
-
private
|
|
20
|
-
private
|
|
19
|
+
private subscribeTokensPoolBalance;
|
|
20
|
+
private subscribeSharePoolBalance;
|
|
21
|
+
private subscribeSystemPoolBalance;
|
|
21
22
|
private updateBalanceCallback;
|
|
22
|
-
private updateBalanceLog;
|
|
23
23
|
}
|
|
@@ -3,7 +3,7 @@ import { OmniPoolClient } from './omni/OmniPoolClient';
|
|
|
3
3
|
import { XykPoolClient } from './xyk/XykPoolClient';
|
|
4
4
|
import { StableSwapClient } from './stable/StableSwapClient';
|
|
5
5
|
import { AssetClient } from '../client';
|
|
6
|
-
import { Hop, PoolBase, IPoolService, PoolType, Transaction, PoolFees, Pool,
|
|
6
|
+
import { Hop, PoolBase, IPoolService, PoolType, Transaction, PoolFees, Pool, Asset } from '../types';
|
|
7
7
|
import { BigNumber } from '../utils/bignumber';
|
|
8
8
|
import { ApiPromise } from '@polkadot/api';
|
|
9
9
|
export declare class PoolService implements IPoolService {
|
|
@@ -13,7 +13,7 @@ export declare class PoolService implements IPoolService {
|
|
|
13
13
|
protected readonly omniClient: OmniPoolClient;
|
|
14
14
|
protected readonly lbpClient: LbpPoolClient;
|
|
15
15
|
protected readonly stableClient: StableSwapClient;
|
|
16
|
-
protected metadata:
|
|
16
|
+
protected metadata: Asset[];
|
|
17
17
|
protected metadataLoaded: boolean;
|
|
18
18
|
constructor(api: ApiPromise);
|
|
19
19
|
getPools(includeOnly: PoolType[]): Promise<PoolBase[]>;
|
package/build/types/types.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type PoolBase = {
|
|
|
29
29
|
maxOutRatio: number;
|
|
30
30
|
minTradingLimit: number;
|
|
31
31
|
};
|
|
32
|
-
export interface PoolToken extends
|
|
32
|
+
export interface PoolToken extends Asset {
|
|
33
33
|
id: string;
|
|
34
34
|
balance: string;
|
|
35
35
|
tradeable?: number;
|
|
@@ -117,19 +117,13 @@ export type Amount = {
|
|
|
117
117
|
amount: BigNumber;
|
|
118
118
|
decimals: number;
|
|
119
119
|
};
|
|
120
|
-
export interface
|
|
121
|
-
free: BigNumber;
|
|
122
|
-
locked: BigNumber;
|
|
123
|
-
reserved: BigNumber;
|
|
124
|
-
available: BigNumber;
|
|
125
|
-
}
|
|
126
|
-
export interface AssetMetadata {
|
|
120
|
+
export interface Asset {
|
|
127
121
|
id: string;
|
|
128
122
|
decimals: number;
|
|
129
123
|
name: string;
|
|
130
124
|
symbol: string;
|
|
131
125
|
icon: string;
|
|
132
|
-
|
|
126
|
+
type: string;
|
|
133
127
|
existentialDeposit: string;
|
|
134
128
|
meta?: Record<string, string>;
|
|
135
129
|
}
|
package/package.json
CHANGED