forked from balancer/b-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
72 lines (65 loc) · 1.72 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { HumanAmount, MinimalToken, PoolTokenWithBalance } from '../data';
import { Address, Hex, PoolType } from '../types';
// Returned from API and used as input
export type PoolState = {
id: Hex;
address: Address;
type: string;
tokens: MinimalToken[];
protocolVersion: 1 | 2 | 3;
};
export type PoolStateWithBalances = {
id: Hex;
address: Address;
type: string;
tokens: PoolTokenWithBalance[];
totalShares: HumanAmount;
protocolVersion: 1 | 2 | 3;
};
export type PoolStateWithBalancesAndDynamicData = PoolStateWithBalances & {
volume24h: HumanAmount;
fees24h: HumanAmount;
aprItems: {
id: Hex;
apr: number;
}[];
};
export type AddLiquidityAmounts = {
maxAmountsIn: bigint[];
maxAmountsInWithoutBpt: bigint[];
tokenInIndex: number | undefined;
minimumBpt: bigint;
};
export type RemoveLiquidityAmounts = {
minAmountsOut: bigint[];
tokenOutIndex: number | undefined;
maxBptAmountIn: bigint;
};
export type NestedPool = {
id: Hex;
address: Address;
type: PoolType;
level: number; // 0 is the bottom and the highest level is the top
tokens: MinimalToken[]; // each token should have at least one
};
export type NestedPoolState = {
protocolVersion: 1 | 2 | 3;
pools: NestedPool[];
mainTokens: {
address: Address;
decimals: number;
}[];
};
export enum PoolKind {
WEIGHTED = 0,
LEGACY_STABLE = 1,
COMPOSABLE_STABLE = 2,
COMPOSABLE_STABLE_V2 = 3,
// (note only Weighted and COMPOSABLE_STABLE_V2 will support proportional exits)
}
export type InitPoolAmounts = {
maxAmountsIn: bigint[];
};
export type InitPoolAmountsComposableStable = InitPoolAmounts & {
amountsIn: bigint[];
};