@typus/typus-sdk 1.4.14 → 1.4.16
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/dist/config-mainnet.json +97 -0
- package/dist/config-testnet.json +93 -0
- package/dist/src/typus-dov-single-v2/function/bidding.d.ts +4 -3
- package/dist/src/typus-dov-single-v2/function/bidding.js +14 -9
- package/dist/src/typus-perp/fetch.d.ts +8 -47
- package/dist/src/typus-perp/fetch.js +11 -11
- package/dist/src/typus-perp/index.js +4 -3
- package/dist/src/typus-perp/user/order.d.ts +5 -39
- package/dist/src/typus-perp/user/order.js +14 -14
- package/dist/src/typus-perp/user/orderWithBidReceipt.d.ts +3 -43
- package/dist/src/typus-perp/user/orderWithBidReceipt.js +24 -24
- package/dist/src/typus-perp/user/tlp.d.ts +6 -58
- package/dist/src/typus-perp/user/tlp.js +25 -25
- package/dist/src/typus-safu/view-function.d.ts +35 -5
- package/dist/src/typus-safu/view-function.js +50 -9
- package/dist/src/utils/typusConfig.d.ts +4 -2
- package/dist/src/utils/typusConfig.js +13 -0
- package/package.json +1 -2
- package/dist/config.json +0 -194
|
@@ -57,13 +57,13 @@ function createTradingOrderWithBidReceipt(config, input) {
|
|
|
57
57
|
cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
58
58
|
bToken = constants_1.tokenType[__1.NETWORK][input.bToken];
|
|
59
59
|
baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
60
|
-
(0, utils_1.updateOracleWithPyth)(input.pythClient, input.tx, config.
|
|
60
|
+
(0, utils_1.updateOracleWithPyth)(input.pythClient, input.tx, config.package.oracle, config.oracle[BASE_TOKEN.toLocaleLowerCase()], BASE_TOKEN, "USDC");
|
|
61
61
|
if (input.share) {
|
|
62
62
|
collateralBidReceipt = (0, typus_dov_single_v2_1.getSplitBidReceiptTx)({
|
|
63
63
|
tx: input.tx,
|
|
64
|
-
typusFrameworkOriginPackageId: config.
|
|
65
|
-
typusDovSinglePackageId: config.
|
|
66
|
-
typusDovSingleRegistry: config.
|
|
64
|
+
typusFrameworkOriginPackageId: config.packageOrigin.framework,
|
|
65
|
+
typusDovSinglePackageId: config.package.dovSingle,
|
|
66
|
+
typusDovSingleRegistry: config.registry.dov.dovSingle,
|
|
67
67
|
index: input.index,
|
|
68
68
|
receipts: [input.bidReceipt],
|
|
69
69
|
share: input.share,
|
|
@@ -74,21 +74,21 @@ function createTradingOrderWithBidReceipt(config, input) {
|
|
|
74
74
|
collateralBidReceipt = input.bidReceipt;
|
|
75
75
|
}
|
|
76
76
|
(0, functions_1.createTradingOrderWithBidReceipt)(input.tx, [cToken, bToken, baseToken], {
|
|
77
|
-
version: config.
|
|
78
|
-
registry: config.
|
|
79
|
-
poolRegistry: config.
|
|
77
|
+
version: config.version.perp,
|
|
78
|
+
registry: config.registry.perp.market,
|
|
79
|
+
poolRegistry: config.registry.perp.lpPool,
|
|
80
80
|
marketIndex: BigInt(0),
|
|
81
81
|
poolIndex: BigInt(0),
|
|
82
82
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
83
83
|
oracleCToken: utils_1.priceInfoObjectIds[__1.NETWORK][TOKEN],
|
|
84
84
|
oracleTradingSymbol: utils_1.priceInfoObjectIds[__1.NETWORK][BASE_TOKEN],
|
|
85
85
|
clock: constants_1.CLOCK,
|
|
86
|
-
typusEcosystemVersion: config.
|
|
87
|
-
typusUserRegistry: config.
|
|
88
|
-
typusLeaderboardRegistry: config.
|
|
86
|
+
typusEcosystemVersion: config.version.typus,
|
|
87
|
+
typusUserRegistry: config.registry.typus.user,
|
|
88
|
+
typusLeaderboardRegistry: config.registry.typus.leaderboard,
|
|
89
89
|
isLong: input.isLong,
|
|
90
|
-
dovRegistry: config.
|
|
91
|
-
typusOracle: config.
|
|
90
|
+
dovRegistry: config.registry.dov.dovSingle,
|
|
91
|
+
typusOracle: config.oracle[BASE_TOKEN.toLocaleLowerCase()],
|
|
92
92
|
collateralBidReceipt: collateralBidReceipt,
|
|
93
93
|
user: input.user,
|
|
94
94
|
});
|
|
@@ -106,15 +106,15 @@ function reduceOptionCollateralPositionSize(config, input) {
|
|
|
106
106
|
// const cToken = tokenType[NETWORK][TOKEN];
|
|
107
107
|
// const bToken = tokenType[NETWORK][input.bToken];
|
|
108
108
|
// const baseToken = tokenType[NETWORK][BASE_TOKEN];
|
|
109
|
-
// updateOracleWithPyth(input.pythClient, input.tx, config.
|
|
109
|
+
// updateOracleWithPyth(input.pythClient, input.tx, config.package.oracle, config.oracle[BASE_TOKEN.toLocaleLowerCase()], BASE_TOKEN, "USDC");
|
|
110
110
|
// // split bid receipt
|
|
111
111
|
// var collateralBidReceipt;
|
|
112
112
|
// if (input.share) {
|
|
113
113
|
// collateralBidReceipt = getSplitBidReceiptTx({
|
|
114
114
|
// tx: input.tx,
|
|
115
|
-
// typusFrameworkOriginPackageId: config.
|
|
116
|
-
// typusDovSinglePackageId: config.
|
|
117
|
-
// typusDovSingleRegistry: config.
|
|
115
|
+
// typusFrameworkOriginPackageId: config.packageOrigin.framework,
|
|
116
|
+
// typusDovSinglePackageId: config.package.dovSingle,
|
|
117
|
+
// typusDovSingleRegistry: config.registry.dov.dovSingle,
|
|
118
118
|
// index: input.index,
|
|
119
119
|
// receipts: [input.bidReceipt],
|
|
120
120
|
// share: input.share,
|
|
@@ -124,20 +124,20 @@ function reduceOptionCollateralPositionSize(config, input) {
|
|
|
124
124
|
// collateralBidReceipt = input.bidReceipt;
|
|
125
125
|
// }
|
|
126
126
|
// _reduceOptionCollateralPositionSize(input.tx, [cToken, bToken, baseToken], {
|
|
127
|
-
// version: config.
|
|
128
|
-
// registry: config.
|
|
129
|
-
// poolRegistry: config.
|
|
127
|
+
// version: config.version.perp,
|
|
128
|
+
// registry: config.registry.perp.market,
|
|
129
|
+
// poolRegistry: config.registry.perp.lpPool,
|
|
130
130
|
// marketIndex: BigInt(0),
|
|
131
131
|
// poolIndex: BigInt(0),
|
|
132
132
|
// pythState: pythStateId[NETWORK],
|
|
133
133
|
// oracleCToken: priceInfoObjectIds[NETWORK][TOKEN],
|
|
134
134
|
// oracleTradingSymbol: priceInfoObjectIds[NETWORK][BASE_TOKEN],
|
|
135
135
|
// clock: CLOCK,
|
|
136
|
-
// typusEcosystemVersion: config.
|
|
137
|
-
// typusUserRegistry: config.
|
|
138
|
-
// typusLeaderboardRegistry: config.
|
|
139
|
-
// dovRegistry: config.
|
|
140
|
-
// typusOracle: config.
|
|
136
|
+
// typusEcosystemVersion: config.version.typus,
|
|
137
|
+
// typusUserRegistry: config.registry.typus.user,
|
|
138
|
+
// typusLeaderboardRegistry: config.registry.typus.leaderboard,
|
|
139
|
+
// dovRegistry: config.registry.dov.dovSingle,
|
|
140
|
+
// typusOracle: config.oracle[BASE_TOKEN.toLocaleLowerCase()],
|
|
141
141
|
// positionId: BigInt(123),
|
|
142
142
|
// orderSize: null,
|
|
143
143
|
// });
|
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
2
|
import { LiquidityPool } from "../lp-pool/structs";
|
|
3
|
-
import { PythClient } from "../../utils";
|
|
3
|
+
import { PythClient, TypusConfig } from "../../utils";
|
|
4
4
|
import { TOKEN } from "../../constants";
|
|
5
|
-
export declare function mintStakeLp(config: {
|
|
6
|
-
REGISTRY: {
|
|
7
|
-
LP_POOL: string;
|
|
8
|
-
STAKE_POOL: string;
|
|
9
|
-
};
|
|
10
|
-
OBJECT: {
|
|
11
|
-
TYPUS_PERP_VERSION: string;
|
|
12
|
-
TLP_TREASURY_CAP: string;
|
|
13
|
-
};
|
|
14
|
-
TOKEN: {
|
|
15
|
-
TLP: string;
|
|
16
|
-
};
|
|
17
|
-
}, input: {
|
|
5
|
+
export declare function mintStakeLp(config: TypusConfig, input: {
|
|
18
6
|
pythClient: PythClient;
|
|
19
7
|
tx: TransactionBlock;
|
|
20
8
|
lpPool: LiquidityPool;
|
|
@@ -23,19 +11,7 @@ export declare function mintStakeLp(config: {
|
|
|
23
11
|
amount: string;
|
|
24
12
|
userShareId: string | null;
|
|
25
13
|
}): Promise<TransactionBlock>;
|
|
26
|
-
export declare function unstakeBurn(config: {
|
|
27
|
-
REGISTRY: {
|
|
28
|
-
LP_POOL: string;
|
|
29
|
-
STAKE_POOL: string;
|
|
30
|
-
};
|
|
31
|
-
OBJECT: {
|
|
32
|
-
TYPUS_PERP_VERSION: string;
|
|
33
|
-
TLP_TREASURY_CAP: string;
|
|
34
|
-
};
|
|
35
|
-
TOKEN: {
|
|
36
|
-
TLP: string;
|
|
37
|
-
};
|
|
38
|
-
}, input: {
|
|
14
|
+
export declare function unstakeBurn(config: TypusConfig, input: {
|
|
39
15
|
pythClient: PythClient;
|
|
40
16
|
tx: TransactionBlock;
|
|
41
17
|
lpPool: LiquidityPool;
|
|
@@ -44,18 +20,7 @@ export declare function unstakeBurn(config: {
|
|
|
44
20
|
share: string | null;
|
|
45
21
|
user: string;
|
|
46
22
|
}): Promise<TransactionBlock>;
|
|
47
|
-
export declare function swap(config: {
|
|
48
|
-
REGISTRY: {
|
|
49
|
-
LP_POOL: string;
|
|
50
|
-
STAKE_POOL: string;
|
|
51
|
-
};
|
|
52
|
-
OBJECT: {
|
|
53
|
-
TYPUS_PERP_VERSION: string;
|
|
54
|
-
};
|
|
55
|
-
TOKEN: {
|
|
56
|
-
TLP: string;
|
|
57
|
-
};
|
|
58
|
-
}, input: {
|
|
23
|
+
export declare function swap(config: TypusConfig, input: {
|
|
59
24
|
pythClient: PythClient;
|
|
60
25
|
tx: TransactionBlock;
|
|
61
26
|
coins: string[];
|
|
@@ -64,29 +29,12 @@ export declare function swap(config: {
|
|
|
64
29
|
amount: string;
|
|
65
30
|
user: string;
|
|
66
31
|
}): Promise<TransactionBlock>;
|
|
67
|
-
export declare function unsubscribe(config: {
|
|
68
|
-
REGISTRY: {
|
|
69
|
-
STAKE_POOL: string;
|
|
70
|
-
};
|
|
71
|
-
OBJECT: {
|
|
72
|
-
TYPUS_PERP_VERSION: string;
|
|
73
|
-
};
|
|
74
|
-
TOKEN: {
|
|
75
|
-
TLP: string;
|
|
76
|
-
};
|
|
77
|
-
}, input: {
|
|
32
|
+
export declare function unsubscribe(config: TypusConfig, input: {
|
|
78
33
|
tx: TransactionBlock;
|
|
79
34
|
userShareId: string;
|
|
80
35
|
share: string | null;
|
|
81
36
|
}): Promise<TransactionBlock>;
|
|
82
|
-
export declare function harvest(config: {
|
|
83
|
-
REGISTRY: {
|
|
84
|
-
STAKE_POOL: string;
|
|
85
|
-
};
|
|
86
|
-
OBJECT: {
|
|
87
|
-
TYPUS_PERP_VERSION: string;
|
|
88
|
-
};
|
|
89
|
-
}, input: {
|
|
37
|
+
export declare function harvest(config: TypusConfig, input: {
|
|
90
38
|
tx: TransactionBlock;
|
|
91
39
|
userShareId: string;
|
|
92
40
|
}): Promise<TransactionBlock>;
|
|
@@ -90,8 +90,8 @@ function mintStakeLp(config, input) {
|
|
|
90
90
|
for (tokens_1 = __values(tokens), tokens_1_1 = tokens_1.next(); !tokens_1_1.done; tokens_1_1 = tokens_1.next()) {
|
|
91
91
|
token = tokens_1_1.value;
|
|
92
92
|
(0, functions_1.updateLiquidityValue)(input.tx, constants_2.tokenType[__1.NETWORK][token], {
|
|
93
|
-
version: config.
|
|
94
|
-
registry: config.
|
|
93
|
+
version: config.version.perp,
|
|
94
|
+
registry: config.registry.perp.lpPool,
|
|
95
95
|
index: BigInt(0),
|
|
96
96
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
97
97
|
oracle: utils_1.priceInfoObjectIds[__1.NETWORK][token],
|
|
@@ -116,19 +116,19 @@ function mintStakeLp(config, input) {
|
|
|
116
116
|
}
|
|
117
117
|
_c = __read(input.tx.splitCoins(destination, [input.amount]), 1), coin = _c[0];
|
|
118
118
|
}
|
|
119
|
-
lpCoin = (0, functions_1.mintLp)(input.tx, [cToken, config.
|
|
120
|
-
version: config.
|
|
121
|
-
registry: config.
|
|
122
|
-
treasuryCaps: config.
|
|
119
|
+
lpCoin = (0, functions_1.mintLp)(input.tx, [cToken, config.token.tlp], {
|
|
120
|
+
version: config.version.perp,
|
|
121
|
+
registry: config.registry.perp.lpPool,
|
|
122
|
+
treasuryCaps: config.object.tlpTreasuryCap,
|
|
123
123
|
index: BigInt(0),
|
|
124
124
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
125
125
|
oracle: utils_1.priceInfoObjectIds[__1.NETWORK][input.cTOKEN],
|
|
126
126
|
coin: coin,
|
|
127
127
|
clock: constants_1.CLOCK,
|
|
128
128
|
});
|
|
129
|
-
(0, functions_2.stake)(input.tx, config.
|
|
130
|
-
version: config.
|
|
131
|
-
registry: config.
|
|
129
|
+
(0, functions_2.stake)(input.tx, config.token.tlp, {
|
|
130
|
+
version: config.version.perp,
|
|
131
|
+
registry: config.registry.perp.stakePool,
|
|
132
132
|
index: BigInt(0),
|
|
133
133
|
lpToken: lpCoin,
|
|
134
134
|
clock: constants_1.CLOCK,
|
|
@@ -156,8 +156,8 @@ function unstakeBurn(config, input) {
|
|
|
156
156
|
for (tokens_2 = __values(tokens), tokens_2_1 = tokens_2.next(); !tokens_2_1.done; tokens_2_1 = tokens_2.next()) {
|
|
157
157
|
token = tokens_2_1.value;
|
|
158
158
|
(0, functions_1.updateLiquidityValue)(input.tx, constants_2.tokenType[__1.NETWORK][token], {
|
|
159
|
-
version: config.
|
|
160
|
-
registry: config.
|
|
159
|
+
version: config.version.perp,
|
|
160
|
+
registry: config.registry.perp.lpPool,
|
|
161
161
|
index: BigInt(0),
|
|
162
162
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
163
163
|
oracle: utils_1.priceInfoObjectIds[__1.NETWORK][token],
|
|
@@ -172,18 +172,18 @@ function unstakeBurn(config, input) {
|
|
|
172
172
|
}
|
|
173
173
|
finally { if (e_2) throw e_2.error; }
|
|
174
174
|
}
|
|
175
|
-
lpCoin = (0, functions_2.unstake)(input.tx, config.
|
|
176
|
-
version: config.
|
|
177
|
-
registry: config.
|
|
175
|
+
lpCoin = (0, functions_2.unstake)(input.tx, config.token.tlp, {
|
|
176
|
+
version: config.version.perp,
|
|
177
|
+
registry: config.registry.perp.stakePool,
|
|
178
178
|
index: BigInt(0),
|
|
179
179
|
userShareId: BigInt(input.userShareId),
|
|
180
180
|
clock: constants_1.CLOCK,
|
|
181
181
|
unstakedShares: input.share ? BigInt(input.share) : null,
|
|
182
182
|
});
|
|
183
|
-
coin = (0, functions_1.burnLp)(input.tx, [cToken, config.
|
|
184
|
-
version: config.
|
|
185
|
-
registry: config.
|
|
186
|
-
treasuryCaps: config.
|
|
183
|
+
coin = (0, functions_1.burnLp)(input.tx, [cToken, config.token.tlp], {
|
|
184
|
+
version: config.version.perp,
|
|
185
|
+
registry: config.registry.perp.lpPool,
|
|
186
|
+
treasuryCaps: config.object.tlpTreasuryCap,
|
|
187
187
|
index: BigInt(0),
|
|
188
188
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
189
189
|
oracle: oracle,
|
|
@@ -218,8 +218,8 @@ function swap(config, input) {
|
|
|
218
218
|
_b = __read(input.tx.splitCoins(destination, [input.amount]), 1), coin = _b[0];
|
|
219
219
|
}
|
|
220
220
|
token = (0, functions_1.swap)(input.tx, [fromToken, toToken], {
|
|
221
|
-
version: config.
|
|
222
|
-
registry: config.
|
|
221
|
+
version: config.version.perp,
|
|
222
|
+
registry: config.registry.perp.lpPool,
|
|
223
223
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
224
224
|
clock: constants_1.CLOCK,
|
|
225
225
|
index: BigInt(0),
|
|
@@ -237,9 +237,9 @@ function swap(config, input) {
|
|
|
237
237
|
function unsubscribe(config, input) {
|
|
238
238
|
return __awaiter(this, void 0, void 0, function () {
|
|
239
239
|
return __generator(this, function (_a) {
|
|
240
|
-
(0, functions_2.unsubscribe)(input.tx, config.
|
|
241
|
-
version: config.
|
|
242
|
-
registry: config.
|
|
240
|
+
(0, functions_2.unsubscribe)(input.tx, config.token.tlp, {
|
|
241
|
+
version: config.version.perp,
|
|
242
|
+
registry: config.registry.perp.stakePool,
|
|
243
243
|
index: BigInt(0),
|
|
244
244
|
userShareId: BigInt(input.userShareId),
|
|
245
245
|
clock: constants_1.CLOCK,
|
|
@@ -253,8 +253,8 @@ function harvest(config, input) {
|
|
|
253
253
|
return __awaiter(this, void 0, void 0, function () {
|
|
254
254
|
return __generator(this, function (_a) {
|
|
255
255
|
(0, functions_2.harvestPerUserShare)(input.tx, "0x2::sui::SUI", {
|
|
256
|
-
version: config.
|
|
257
|
-
registry: config.
|
|
256
|
+
version: config.version.perp,
|
|
257
|
+
registry: config.registry.perp.stakePool,
|
|
258
258
|
index: BigInt(0),
|
|
259
259
|
userShareId: BigInt(input.userShareId),
|
|
260
260
|
clock: constants_1.CLOCK,
|
|
@@ -4,12 +4,42 @@ export interface Vault {
|
|
|
4
4
|
id: string;
|
|
5
5
|
depositToken: string;
|
|
6
6
|
rewardToken: string[];
|
|
7
|
-
info:
|
|
8
|
-
config:
|
|
9
|
-
shareSupply:
|
|
7
|
+
info: Info;
|
|
8
|
+
config: Config;
|
|
9
|
+
shareSupply: ShareSupply;
|
|
10
10
|
u64Padding: string[];
|
|
11
11
|
bcsPadding: string[];
|
|
12
12
|
}
|
|
13
|
+
export interface Info {
|
|
14
|
+
index: string;
|
|
15
|
+
round: string;
|
|
16
|
+
portfolio_vault_index: string;
|
|
17
|
+
refresh_ts_ms: string;
|
|
18
|
+
status: string;
|
|
19
|
+
lending_enabled: string;
|
|
20
|
+
price_bp: string;
|
|
21
|
+
bp_incentivised: string;
|
|
22
|
+
fixed_incentivised: string;
|
|
23
|
+
token_decimal: string;
|
|
24
|
+
}
|
|
25
|
+
export interface Config {
|
|
26
|
+
capacity: string;
|
|
27
|
+
lot_size: string;
|
|
28
|
+
min_size: string;
|
|
29
|
+
fee_bp: string;
|
|
30
|
+
utilization_rate_bp: string;
|
|
31
|
+
point_per_hour_bp: string;
|
|
32
|
+
incentive_bp: string;
|
|
33
|
+
incentive_fixed: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ShareSupply {
|
|
36
|
+
active_share: string;
|
|
37
|
+
deactivating_share: string;
|
|
38
|
+
inactive_share: string;
|
|
39
|
+
warmup_share: string;
|
|
40
|
+
snapshot_share: string;
|
|
41
|
+
reward_share: string[];
|
|
42
|
+
}
|
|
13
43
|
export declare function getVaultData(config: TypusConfig, input: {
|
|
14
44
|
provider: SuiClient;
|
|
15
45
|
indexes: string[];
|
|
@@ -18,7 +48,7 @@ export declare function getVaultData(config: TypusConfig, input: {
|
|
|
18
48
|
}>;
|
|
19
49
|
export interface Share {
|
|
20
50
|
user: string;
|
|
21
|
-
share:
|
|
51
|
+
share: ShareSupply;
|
|
22
52
|
u64Padding: string[];
|
|
23
53
|
bcsPadding: string[];
|
|
24
54
|
}
|
|
@@ -27,5 +57,5 @@ export declare function getShareData(config: TypusConfig, input: {
|
|
|
27
57
|
user: string;
|
|
28
58
|
indexes: string[];
|
|
29
59
|
}): Promise<{
|
|
30
|
-
[key: string]: Share;
|
|
60
|
+
[key: string]: Share[];
|
|
31
61
|
}>;
|
|
@@ -67,28 +67,58 @@ function getVaultData(config, input) {
|
|
|
67
67
|
var rewardToken = reader.readVec(function (reader) {
|
|
68
68
|
return String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.read8())));
|
|
69
69
|
});
|
|
70
|
-
var
|
|
70
|
+
var infoArray = reader.readVec(function (reader) {
|
|
71
71
|
return reader.read64();
|
|
72
72
|
});
|
|
73
|
-
var
|
|
73
|
+
var configArray = reader.readVec(function (reader) {
|
|
74
74
|
return reader.read64();
|
|
75
75
|
});
|
|
76
|
+
var info = {
|
|
77
|
+
index: infoArray[0],
|
|
78
|
+
round: infoArray[1],
|
|
79
|
+
portfolio_vault_index: infoArray[2],
|
|
80
|
+
refresh_ts_ms: infoArray[3],
|
|
81
|
+
status: infoArray[4],
|
|
82
|
+
lending_enabled: infoArray[5],
|
|
83
|
+
price_bp: infoArray[6],
|
|
84
|
+
bp_incentivised: infoArray[7],
|
|
85
|
+
fixed_incentivised: infoArray[8],
|
|
86
|
+
token_decimal: infoArray[9],
|
|
87
|
+
};
|
|
88
|
+
var config = {
|
|
89
|
+
capacity: configArray[0],
|
|
90
|
+
lot_size: configArray[1],
|
|
91
|
+
min_size: configArray[2],
|
|
92
|
+
fee_bp: configArray[3],
|
|
93
|
+
utilization_rate_bp: configArray[4],
|
|
94
|
+
point_per_hour_bp: configArray[5],
|
|
95
|
+
incentive_bp: configArray[6],
|
|
96
|
+
incentive_fixed: configArray[7],
|
|
97
|
+
};
|
|
76
98
|
// skip BigVector
|
|
77
99
|
reader.readBytes(32); // id
|
|
78
100
|
reader.readBytes(reader.read8()); // element_type
|
|
79
101
|
reader.read64(); // slice_idx
|
|
80
102
|
reader.read32(); // slice_size
|
|
81
103
|
reader.read64(); // length
|
|
82
|
-
var
|
|
104
|
+
var shareSupplyArray = reader.readVec(function (reader) {
|
|
83
105
|
return reader.read64();
|
|
84
106
|
});
|
|
107
|
+
var shareSupply = {
|
|
108
|
+
active_share: shareSupplyArray[0],
|
|
109
|
+
deactivating_share: shareSupplyArray[1],
|
|
110
|
+
inactive_share: shareSupplyArray[2],
|
|
111
|
+
warmup_share: shareSupplyArray[3],
|
|
112
|
+
snapshot_share: shareSupplyArray[4],
|
|
113
|
+
reward_share: shareSupplyArray.slice(5)
|
|
114
|
+
};
|
|
85
115
|
var u64Padding = reader.readVec(function (reader) {
|
|
86
116
|
return reader.read64();
|
|
87
117
|
});
|
|
88
118
|
var bcsPadding = reader.readVec(function (reader) {
|
|
89
119
|
return reader.read8();
|
|
90
120
|
});
|
|
91
|
-
result[info
|
|
121
|
+
result[info.index] = {
|
|
92
122
|
id: id,
|
|
93
123
|
depositToken: depositToken,
|
|
94
124
|
rewardToken: rewardToken,
|
|
@@ -129,11 +159,21 @@ function getShareData(config, input) {
|
|
|
129
159
|
reader.readVec(function (reader, i) {
|
|
130
160
|
reader.read8();
|
|
131
161
|
var share = reader.readVec(function (reader) {
|
|
162
|
+
var user = (0, utils_1.AddressFromBytes)(reader.readBytes(32));
|
|
163
|
+
var shareSupplyArray = reader.readVec(function (reader) {
|
|
164
|
+
return reader.read64();
|
|
165
|
+
});
|
|
166
|
+
var shareSupply = {
|
|
167
|
+
active_share: shareSupplyArray[0],
|
|
168
|
+
deactivating_share: shareSupplyArray[1],
|
|
169
|
+
inactive_share: shareSupplyArray[2],
|
|
170
|
+
warmup_share: shareSupplyArray[3],
|
|
171
|
+
snapshot_share: shareSupplyArray[4],
|
|
172
|
+
reward_share: shareSupplyArray.slice(5)
|
|
173
|
+
};
|
|
132
174
|
return {
|
|
133
|
-
user:
|
|
134
|
-
share:
|
|
135
|
-
return reader.read64();
|
|
136
|
-
}),
|
|
175
|
+
user: user,
|
|
176
|
+
share: shareSupply,
|
|
137
177
|
u64Padding: reader.readVec(function (reader) {
|
|
138
178
|
return reader.read64();
|
|
139
179
|
}),
|
|
@@ -142,7 +182,8 @@ function getShareData(config, input) {
|
|
|
142
182
|
}),
|
|
143
183
|
};
|
|
144
184
|
});
|
|
145
|
-
|
|
185
|
+
var index = input.indexes.pop();
|
|
186
|
+
result[index] = share;
|
|
146
187
|
});
|
|
147
188
|
return [2 /*return*/, result];
|
|
148
189
|
}
|
|
@@ -8,6 +8,7 @@ export declare class TypusConfig {
|
|
|
8
8
|
oracle: Oracle;
|
|
9
9
|
token: Token;
|
|
10
10
|
static parse(json: any): TypusConfig;
|
|
11
|
+
static default(network: "MAINNET" | "TESTNET"): TypusConfig;
|
|
11
12
|
}
|
|
12
13
|
export interface Package {
|
|
13
14
|
dice: string;
|
|
@@ -78,8 +79,8 @@ export interface Oracle {
|
|
|
78
79
|
sui: string;
|
|
79
80
|
turbos: string;
|
|
80
81
|
usdy: string;
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
btc: string;
|
|
83
|
+
eth: string;
|
|
83
84
|
}
|
|
84
85
|
export interface Token {
|
|
85
86
|
afsui: string;
|
|
@@ -88,6 +89,7 @@ export interface Token {
|
|
|
88
89
|
sui: string;
|
|
89
90
|
tgld: string;
|
|
90
91
|
tlp: string;
|
|
92
|
+
usdc: string;
|
|
91
93
|
usd: string;
|
|
92
94
|
usdt: string;
|
|
93
95
|
}
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.TypusConfig = void 0;
|
|
4
7
|
var camelcaseKeysDeep = require("camelcase-keys-deep");
|
|
8
|
+
var config_mainnet_json_1 = __importDefault(require("config-mainnet.json"));
|
|
9
|
+
var config_testnet_json_1 = __importDefault(require("config-testnet.json"));
|
|
5
10
|
var TypusConfig = /** @class */ (function () {
|
|
6
11
|
function TypusConfig() {
|
|
7
12
|
}
|
|
8
13
|
TypusConfig.parse = function (json) {
|
|
9
14
|
return JSON.parse(JSON.stringify(camelcaseKeysDeep(json)));
|
|
10
15
|
};
|
|
16
|
+
TypusConfig.default = function (network) {
|
|
17
|
+
switch (network) {
|
|
18
|
+
case "MAINNET":
|
|
19
|
+
return JSON.parse(JSON.stringify(camelcaseKeysDeep(config_mainnet_json_1.default)));
|
|
20
|
+
case "TESTNET":
|
|
21
|
+
return JSON.parse(JSON.stringify(camelcaseKeysDeep(config_testnet_json_1.default)));
|
|
22
|
+
}
|
|
23
|
+
};
|
|
11
24
|
return TypusConfig;
|
|
12
25
|
}());
|
|
13
26
|
exports.TypusConfig = TypusConfig;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typus/typus-sdk",
|
|
3
3
|
"author": "Typus",
|
|
4
4
|
"description": "typus sdk",
|
|
5
|
-
"version": "1.4.
|
|
5
|
+
"version": "1.4.16",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@mysten/bcs": "^0.11.1",
|
|
8
8
|
"@mysten/kiosk": "0.8.10",
|
|
@@ -84,7 +84,6 @@
|
|
|
84
84
|
"dist"
|
|
85
85
|
],
|
|
86
86
|
"scripts": {
|
|
87
|
-
"ts-node": "ts-node -r tsconfig-paths/register",
|
|
88
87
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
89
88
|
"test": "rm -rf dist && tsc -p tsconfig.build.json && ts-mocha test/test*.ts"
|
|
90
89
|
},
|