@typus/typus-perp-sdk 1.0.67 → 1.0.69
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/src/api/sentio.js +8 -8
- package/dist/src/fetch.d.ts +4 -3
- package/dist/src/fetch.js +30 -34
- package/dist/src/index.js +13 -6
- package/dist/src/typus_perp/error/functions.d.ts +2 -0
- package/dist/src/typus_perp/error/functions.js +10 -0
- package/dist/src/typus_perp/lp-pool/functions.d.ts +60 -27
- package/dist/src/typus_perp/lp-pool/functions.js +92 -52
- package/dist/src/typus_perp/lp-pool/structs.d.ts +161 -210
- package/dist/src/typus_perp/lp-pool/structs.js +384 -284
- package/dist/src/typus_perp/trading/functions.d.ts +6 -0
- package/dist/src/typus_perp/trading/functions.js +9 -0
- package/dist/src/typus_stake_pool/stake-pool/functions.d.ts +9 -0
- package/dist/src/typus_stake_pool/stake-pool/functions.js +20 -0
- package/dist/src/user/tlp.d.ts +23 -9
- package/dist/src/user/tlp.js +148 -61
- package/package.json +2 -2
|
@@ -408,6 +408,12 @@ export interface ManagerCloseOptionPositionV2Args {
|
|
|
408
408
|
positionId: bigint | TransactionArgument;
|
|
409
409
|
}
|
|
410
410
|
export declare function managerCloseOptionPositionV2(tx: Transaction, typeArgs: [string, string, string], args: ManagerCloseOptionPositionV2Args, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
411
|
+
export interface ManagerHotfixRemoveMarketSymbolArgs {
|
|
412
|
+
version: TransactionObjectInput;
|
|
413
|
+
registry: TransactionObjectInput;
|
|
414
|
+
marketIndex: bigint | TransactionArgument;
|
|
415
|
+
}
|
|
416
|
+
export declare function managerHotfixRemoveMarketSymbol(tx: Transaction, typeArg: string, args: ManagerHotfixRemoveMarketSymbolArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
411
417
|
export interface ManagerReducePositionArgs {
|
|
412
418
|
version: TransactionObjectInput;
|
|
413
419
|
registry: TransactionObjectInput;
|
|
@@ -36,6 +36,7 @@ exports.liquidate = liquidate;
|
|
|
36
36
|
exports.managerCancelOrderByOpenInterestLimit = managerCancelOrderByOpenInterestLimit;
|
|
37
37
|
exports.managerCloseOptionPosition = managerCloseOptionPosition;
|
|
38
38
|
exports.managerCloseOptionPositionV2 = managerCloseOptionPositionV2;
|
|
39
|
+
exports.managerHotfixRemoveMarketSymbol = managerHotfixRemoveMarketSymbol;
|
|
39
40
|
exports.managerReducePosition = managerReducePosition;
|
|
40
41
|
exports.managerReducePositionV2 = managerReducePositionV2;
|
|
41
42
|
exports.managerRemoveOrder = managerRemoveOrder;
|
|
@@ -641,6 +642,14 @@ function managerCloseOptionPositionV2(tx, typeArgs, args, published_at) {
|
|
|
641
642
|
],
|
|
642
643
|
});
|
|
643
644
|
}
|
|
645
|
+
function managerHotfixRemoveMarketSymbol(tx, typeArg, args, published_at) {
|
|
646
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
647
|
+
return tx.moveCall({
|
|
648
|
+
target: "".concat(published_at, "::trading::manager_hotfix_remove_market_symbol"),
|
|
649
|
+
typeArguments: [typeArg],
|
|
650
|
+
arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.registry), (0, util_1.pure)(tx, args.marketIndex, "u64")],
|
|
651
|
+
});
|
|
652
|
+
}
|
|
644
653
|
function managerReducePosition(tx, typeArgs, args, published_at) {
|
|
645
654
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
646
655
|
return tx.moveCall({
|
|
@@ -45,6 +45,7 @@ export interface DepositIncentiveArgs {
|
|
|
45
45
|
coin: TransactionObjectInput;
|
|
46
46
|
}
|
|
47
47
|
export declare function depositIncentive(tx: Transaction, typeArg: string, args: DepositIncentiveArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
48
|
+
export declare function deprecated(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
48
49
|
export interface GetIncentiveArgs {
|
|
49
50
|
stakePool: TransactionObjectInput;
|
|
50
51
|
tokenType: TransactionObjectInput;
|
|
@@ -196,3 +197,11 @@ export interface WithdrawIncentiveArgs {
|
|
|
196
197
|
amount: bigint | TransactionArgument | TransactionArgument | null;
|
|
197
198
|
}
|
|
198
199
|
export declare function withdrawIncentive(tx: Transaction, typeArg: string, args: WithdrawIncentiveArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
200
|
+
export interface WithdrawIncentiveV2Args {
|
|
201
|
+
version: TransactionObjectInput;
|
|
202
|
+
registry: TransactionObjectInput;
|
|
203
|
+
index: bigint | TransactionArgument;
|
|
204
|
+
amount: bigint | TransactionArgument | TransactionArgument | null;
|
|
205
|
+
clock: TransactionObjectInput;
|
|
206
|
+
}
|
|
207
|
+
export declare function withdrawIncentiveV2(tx: Transaction, typeArg: string, args: WithdrawIncentiveV2Args, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -7,6 +7,7 @@ exports.calculateIncentive = calculateIncentive;
|
|
|
7
7
|
exports.createUserLastIncentiveTsMs = createUserLastIncentiveTsMs;
|
|
8
8
|
exports.deactivateIncentiveToken = deactivateIncentiveToken;
|
|
9
9
|
exports.depositIncentive = depositIncentive;
|
|
10
|
+
exports.deprecated = deprecated;
|
|
10
11
|
exports.getIncentive = getIncentive;
|
|
11
12
|
exports.getIncentiveTokens = getIncentiveTokens;
|
|
12
13
|
exports.getLastIncentivePriceIndex = getLastIncentivePriceIndex;
|
|
@@ -33,6 +34,7 @@ exports.updateIncentiveConfig = updateIncentiveConfig;
|
|
|
33
34
|
exports.updatePoolInfoU64Padding = updatePoolInfoU64Padding;
|
|
34
35
|
exports.updateUnlockCountdownTsMs = updateUnlockCountdownTsMs;
|
|
35
36
|
exports.withdrawIncentive = withdrawIncentive;
|
|
37
|
+
exports.withdrawIncentiveV2 = withdrawIncentiveV2;
|
|
36
38
|
var __1 = require("..");
|
|
37
39
|
var structs_1 = require("../../_dependencies/source/0x1/option/structs");
|
|
38
40
|
var util_1 = require("../../_framework/util");
|
|
@@ -97,6 +99,10 @@ function depositIncentive(tx, typeArg, args, published_at) {
|
|
|
97
99
|
arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.registry), (0, util_1.pure)(tx, args.index, "u64"), (0, util_1.obj)(tx, args.coin)],
|
|
98
100
|
});
|
|
99
101
|
}
|
|
102
|
+
function deprecated(tx, published_at) {
|
|
103
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
104
|
+
return tx.moveCall({ target: "".concat(published_at, "::stake_pool::deprecated"), arguments: [] });
|
|
105
|
+
}
|
|
100
106
|
function getIncentive(tx, args, published_at) {
|
|
101
107
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
102
108
|
return tx.moveCall({
|
|
@@ -329,3 +335,17 @@ function withdrawIncentive(tx, typeArg, args, published_at) {
|
|
|
329
335
|
],
|
|
330
336
|
});
|
|
331
337
|
}
|
|
338
|
+
function withdrawIncentiveV2(tx, typeArg, args, published_at) {
|
|
339
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
340
|
+
return tx.moveCall({
|
|
341
|
+
target: "".concat(published_at, "::stake_pool::withdraw_incentive_v2"),
|
|
342
|
+
typeArguments: [typeArg],
|
|
343
|
+
arguments: [
|
|
344
|
+
(0, util_1.obj)(tx, args.version),
|
|
345
|
+
(0, util_1.obj)(tx, args.registry),
|
|
346
|
+
(0, util_1.pure)(tx, args.index, "u64"),
|
|
347
|
+
(0, util_1.pure)(tx, args.amount, "".concat(structs_1.Option.$typeName, "<u64>")),
|
|
348
|
+
(0, util_1.obj)(tx, args.clock),
|
|
349
|
+
],
|
|
350
|
+
});
|
|
351
|
+
}
|
package/dist/src/user/tlp.d.ts
CHANGED
|
@@ -14,23 +14,41 @@ export declare function mintStakeLp(config: TypusConfig, tx: Transaction, pythCl
|
|
|
14
14
|
amount: string;
|
|
15
15
|
userShareId: string | null;
|
|
16
16
|
user: string;
|
|
17
|
+
stake: boolean;
|
|
17
18
|
}): Promise<Transaction>;
|
|
18
|
-
export declare function
|
|
19
|
+
export declare function stakeLp(config: TypusConfig, tx: Transaction, input: {
|
|
20
|
+
stakePool: StakePool;
|
|
21
|
+
lpCoins: string[];
|
|
22
|
+
amount: string;
|
|
23
|
+
userShareId: string | null;
|
|
24
|
+
user: string;
|
|
25
|
+
}): Promise<Transaction>;
|
|
26
|
+
export declare function unstake(config: TypusConfig, tx: Transaction, input: {
|
|
19
27
|
lpPool: LiquidityPool;
|
|
20
28
|
stakePool: StakePool;
|
|
21
|
-
cTOKEN: TOKEN;
|
|
22
29
|
userShareId: string;
|
|
23
30
|
share: string | null;
|
|
24
31
|
user: string;
|
|
25
32
|
}): Promise<Transaction>;
|
|
26
|
-
export declare function
|
|
33
|
+
export declare function unstakeRedeem(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
27
34
|
lpPool: LiquidityPool;
|
|
28
35
|
stakePool: StakePool;
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
userShareId: string;
|
|
37
|
+
share: string | null;
|
|
38
|
+
user: string;
|
|
39
|
+
}): Promise<Transaction>;
|
|
40
|
+
export declare function redeemTlp(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
41
|
+
lpPool: LiquidityPool;
|
|
42
|
+
lpCoins: string[];
|
|
31
43
|
share: string | null;
|
|
32
44
|
user: string;
|
|
33
45
|
}): Promise<Transaction>;
|
|
46
|
+
export declare function claim(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
47
|
+
lpPool: LiquidityPool;
|
|
48
|
+
stakePool: StakePool;
|
|
49
|
+
cTOKEN: TOKEN;
|
|
50
|
+
user: string;
|
|
51
|
+
}): Promise<Transaction>;
|
|
34
52
|
export declare function swap(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
35
53
|
coins: string[];
|
|
36
54
|
FROM_TOKEN: TOKEN;
|
|
@@ -38,10 +56,6 @@ export declare function swap(config: TypusConfig, tx: Transaction, pythClient: P
|
|
|
38
56
|
amount: string;
|
|
39
57
|
user: string;
|
|
40
58
|
}): Promise<Transaction>;
|
|
41
|
-
export declare function unsubscribe(config: TypusConfig, tx: Transaction, input: {
|
|
42
|
-
userShareId: string;
|
|
43
|
-
share: string | null;
|
|
44
|
-
}): Promise<Transaction>;
|
|
45
59
|
export declare function harvestStakeReward(config: TypusConfig, tx: Transaction, input: {
|
|
46
60
|
stakePool: StakePool;
|
|
47
61
|
userShareId: string;
|
package/dist/src/user/tlp.js
CHANGED
|
@@ -65,10 +65,12 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
65
65
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
66
|
exports.snapshot = snapshot;
|
|
67
67
|
exports.mintStakeLp = mintStakeLp;
|
|
68
|
-
exports.
|
|
69
|
-
exports.
|
|
68
|
+
exports.stakeLp = stakeLp;
|
|
69
|
+
exports.unstake = unstake;
|
|
70
|
+
exports.unstakeRedeem = unstakeRedeem;
|
|
71
|
+
exports.redeemTlp = redeemTlp;
|
|
72
|
+
exports.claim = claim;
|
|
70
73
|
exports.swap = swap;
|
|
71
|
-
exports.unsubscribe = unsubscribe;
|
|
72
74
|
exports.harvestStakeReward = harvestStakeReward;
|
|
73
75
|
var functions_1 = require("../typus_perp/lp-pool/functions");
|
|
74
76
|
var functions_2 = require("../typus_stake_pool/stake-pool/functions");
|
|
@@ -148,22 +150,78 @@ function mintStakeLp(config, tx, pythClient, input) {
|
|
|
148
150
|
coin: coin,
|
|
149
151
|
clock: constants_1.CLOCK,
|
|
150
152
|
});
|
|
151
|
-
(
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
153
|
+
if (input.stake) {
|
|
154
|
+
(0, functions_2.stake)(tx, __1.TLP_TOKEN, {
|
|
155
|
+
version: __1.STAKE_POOL_VERSION,
|
|
156
|
+
registry: __1.STAKE_POOL,
|
|
157
|
+
index: BigInt(0),
|
|
158
|
+
lpToken: lpCoin,
|
|
159
|
+
clock: constants_1.CLOCK,
|
|
160
|
+
userShareId: input.userShareId ? BigInt(input.userShareId) : null,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
tx.transferObjects([lpCoin], input.user);
|
|
165
|
+
}
|
|
159
166
|
return [2 /*return*/, tx];
|
|
160
167
|
}
|
|
161
168
|
});
|
|
162
169
|
});
|
|
163
170
|
}
|
|
164
|
-
function
|
|
171
|
+
function stakeLp(config, tx, input) {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
173
|
+
var coin, destination;
|
|
174
|
+
var _a;
|
|
175
|
+
return __generator(this, function (_b) {
|
|
176
|
+
destination = input.lpCoins.pop();
|
|
177
|
+
if (input.lpCoins.length > 0) {
|
|
178
|
+
tx.mergeCoins(destination, input.lpCoins);
|
|
179
|
+
}
|
|
180
|
+
_a = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _a[0];
|
|
181
|
+
// console.log(iToken);
|
|
182
|
+
if (input.userShareId) {
|
|
183
|
+
harvestStakeReward(config, tx, { stakePool: input.stakePool, userShareId: input.userShareId, user: input.user });
|
|
184
|
+
}
|
|
185
|
+
(0, functions_2.stake)(tx, __1.TLP_TOKEN, {
|
|
186
|
+
version: __1.STAKE_POOL_VERSION,
|
|
187
|
+
registry: __1.STAKE_POOL,
|
|
188
|
+
index: BigInt(0),
|
|
189
|
+
lpToken: coin,
|
|
190
|
+
clock: constants_1.CLOCK,
|
|
191
|
+
userShareId: input.userShareId ? BigInt(input.userShareId) : null,
|
|
192
|
+
});
|
|
193
|
+
return [2 /*return*/, tx];
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function unstake(config, tx, input) {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
199
|
+
var lpCoin;
|
|
200
|
+
return __generator(this, function (_a) {
|
|
201
|
+
harvestStakeReward(config, tx, { stakePool: input.stakePool, userShareId: input.userShareId, user: input.user });
|
|
202
|
+
(0, functions_2.unsubscribe)(tx, __1.TLP_TOKEN, {
|
|
203
|
+
version: __1.STAKE_POOL_VERSION,
|
|
204
|
+
registry: __1.STAKE_POOL,
|
|
205
|
+
index: BigInt(0),
|
|
206
|
+
userShareId: BigInt(input.userShareId),
|
|
207
|
+
clock: constants_1.CLOCK,
|
|
208
|
+
unsubscribedShares: input.share ? BigInt(input.share) : null,
|
|
209
|
+
});
|
|
210
|
+
lpCoin = (0, functions_2.unstake)(tx, __1.TLP_TOKEN, {
|
|
211
|
+
version: __1.STAKE_POOL_VERSION,
|
|
212
|
+
registry: __1.STAKE_POOL,
|
|
213
|
+
index: BigInt(0),
|
|
214
|
+
userShareId: BigInt(input.userShareId),
|
|
215
|
+
clock: constants_1.CLOCK,
|
|
216
|
+
});
|
|
217
|
+
tx.transferObjects([lpCoin], input.user);
|
|
218
|
+
return [2 /*return*/, tx];
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function unstakeRedeem(config, tx, pythClient, input) {
|
|
165
223
|
return __awaiter(this, void 0, void 0, function () {
|
|
166
|
-
var tokens, tokens_2, tokens_2_1, token, lpCoin,
|
|
224
|
+
var tokens, tokens_2, tokens_2_1, token, lpCoin, balance;
|
|
167
225
|
var e_2, _a;
|
|
168
226
|
return __generator(this, function (_b) {
|
|
169
227
|
switch (_b.label) {
|
|
@@ -193,6 +251,14 @@ function unstakeBurn(config, tx, pythClient, input) {
|
|
|
193
251
|
finally { if (e_2) throw e_2.error; }
|
|
194
252
|
}
|
|
195
253
|
harvestStakeReward(config, tx, { stakePool: input.stakePool, userShareId: input.userShareId, user: input.user });
|
|
254
|
+
(0, functions_2.unsubscribe)(tx, __1.TLP_TOKEN, {
|
|
255
|
+
version: __1.STAKE_POOL_VERSION,
|
|
256
|
+
registry: __1.STAKE_POOL,
|
|
257
|
+
index: BigInt(0),
|
|
258
|
+
userShareId: BigInt(input.userShareId),
|
|
259
|
+
clock: constants_1.CLOCK,
|
|
260
|
+
unsubscribedShares: input.share ? BigInt(input.share) : null,
|
|
261
|
+
});
|
|
196
262
|
lpCoin = (0, functions_2.unstake)(tx, __1.TLP_TOKEN, {
|
|
197
263
|
version: __1.STAKE_POOL_VERSION,
|
|
198
264
|
registry: __1.STAKE_POOL,
|
|
@@ -200,32 +266,26 @@ function unstakeBurn(config, tx, pythClient, input) {
|
|
|
200
266
|
userShareId: BigInt(input.userShareId),
|
|
201
267
|
clock: constants_1.CLOCK,
|
|
202
268
|
});
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
cToken = constants_1.tokenType[__1.NETWORK][input.cTOKEN];
|
|
211
|
-
coin = (0, functions_1.burnLp)(tx, [cToken, __1.TLP_TOKEN], {
|
|
269
|
+
balance = tx.moveCall({
|
|
270
|
+
target: "0x2::coin::into_balance",
|
|
271
|
+
typeArguments: [__1.TLP_TOKEN],
|
|
272
|
+
arguments: [lpCoin],
|
|
273
|
+
});
|
|
274
|
+
(0, functions_1.redeem)(tx, __1.TLP_TOKEN, {
|
|
212
275
|
version: __1.PERP_VERSION,
|
|
213
276
|
registry: __1.LP_POOL,
|
|
214
|
-
treasuryCaps: __1.TLP_TREASURY_CAP,
|
|
215
277
|
index: BigInt(0),
|
|
216
|
-
oracle: constants_1.oracle[__1.NETWORK][input.cTOKEN],
|
|
217
|
-
coin: burnCoin,
|
|
218
278
|
clock: constants_1.CLOCK,
|
|
279
|
+
balance: balance,
|
|
219
280
|
});
|
|
220
|
-
tx.transferObjects([coin], input.user);
|
|
221
281
|
return [2 /*return*/, tx];
|
|
222
282
|
}
|
|
223
283
|
});
|
|
224
284
|
});
|
|
225
285
|
}
|
|
226
|
-
function
|
|
286
|
+
function redeemTlp(config, tx, pythClient, input) {
|
|
227
287
|
return __awaiter(this, void 0, void 0, function () {
|
|
228
|
-
var tokens, tokens_3, tokens_3_1, token, lpCoin, burnCoin,
|
|
288
|
+
var tokens, tokens_3, tokens_3_1, token, destination, lpCoin, burnCoin, balance;
|
|
229
289
|
var e_3, _a;
|
|
230
290
|
return __generator(this, function (_b) {
|
|
231
291
|
switch (_b.label) {
|
|
@@ -254,24 +314,75 @@ function burnTlp(config, tx, pythClient, input) {
|
|
|
254
314
|
}
|
|
255
315
|
finally { if (e_3) throw e_3.error; }
|
|
256
316
|
}
|
|
257
|
-
|
|
317
|
+
destination = input.lpCoins.pop();
|
|
318
|
+
if (input.lpCoins.length > 0) {
|
|
319
|
+
tx.mergeCoins(destination, input.lpCoins);
|
|
320
|
+
}
|
|
321
|
+
lpCoin = tx.object(destination);
|
|
258
322
|
if (input.share) {
|
|
259
323
|
burnCoin = tx.splitCoins(lpCoin, [input.share]);
|
|
260
324
|
}
|
|
261
325
|
else {
|
|
262
326
|
burnCoin = lpCoin;
|
|
263
327
|
}
|
|
328
|
+
balance = tx.moveCall({
|
|
329
|
+
target: "0x2::coin::into_balance",
|
|
330
|
+
typeArguments: [__1.TLP_TOKEN],
|
|
331
|
+
arguments: [burnCoin],
|
|
332
|
+
});
|
|
333
|
+
(0, functions_1.redeem)(tx, __1.TLP_TOKEN, {
|
|
334
|
+
version: __1.PERP_VERSION,
|
|
335
|
+
registry: __1.LP_POOL,
|
|
336
|
+
index: BigInt(0),
|
|
337
|
+
clock: constants_1.CLOCK,
|
|
338
|
+
balance: balance,
|
|
339
|
+
});
|
|
340
|
+
return [2 /*return*/, tx];
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
function claim(config, tx, pythClient, input) {
|
|
346
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
347
|
+
var tokens, tokens_4, tokens_4_1, token_1, cToken, token;
|
|
348
|
+
var e_4, _a;
|
|
349
|
+
return __generator(this, function (_b) {
|
|
350
|
+
switch (_b.label) {
|
|
351
|
+
case 0:
|
|
352
|
+
tokens = input.lpPool.tokenPools.map(function (p) { return (0, constants_1.typeArgToAsset)("0x" + p.tokenType.name); });
|
|
353
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens)];
|
|
354
|
+
case 1:
|
|
355
|
+
_b.sent();
|
|
356
|
+
try {
|
|
357
|
+
for (tokens_4 = __values(tokens), tokens_4_1 = tokens_4.next(); !tokens_4_1.done; tokens_4_1 = tokens_4.next()) {
|
|
358
|
+
token_1 = tokens_4_1.value;
|
|
359
|
+
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token_1);
|
|
360
|
+
(0, functions_1.updateLiquidityValue)(tx, constants_1.tokenType[__1.NETWORK][token_1], {
|
|
361
|
+
version: __1.PERP_VERSION,
|
|
362
|
+
registry: __1.LP_POOL,
|
|
363
|
+
index: BigInt(0),
|
|
364
|
+
oracle: constants_1.oracle[__1.NETWORK][token_1],
|
|
365
|
+
clock: constants_1.CLOCK,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
370
|
+
finally {
|
|
371
|
+
try {
|
|
372
|
+
if (tokens_4_1 && !tokens_4_1.done && (_a = tokens_4.return)) _a.call(tokens_4);
|
|
373
|
+
}
|
|
374
|
+
finally { if (e_4) throw e_4.error; }
|
|
375
|
+
}
|
|
264
376
|
cToken = constants_1.tokenType[__1.NETWORK][input.cTOKEN];
|
|
265
|
-
|
|
377
|
+
token = (0, functions_1.claim)(tx, [__1.TLP_TOKEN, cToken], {
|
|
266
378
|
version: __1.PERP_VERSION,
|
|
267
379
|
registry: __1.LP_POOL,
|
|
268
|
-
treasuryCaps: __1.TLP_TREASURY_CAP,
|
|
269
380
|
index: BigInt(0),
|
|
270
|
-
oracle: constants_1.oracle[__1.NETWORK][input.cTOKEN],
|
|
271
|
-
coin: burnCoin,
|
|
272
381
|
clock: constants_1.CLOCK,
|
|
382
|
+
treasuryCaps: __1.TLP_TREASURY_CAP,
|
|
383
|
+
oracle: constants_1.oracle[__1.NETWORK][input.cTOKEN],
|
|
273
384
|
});
|
|
274
|
-
tx.transferObjects([
|
|
385
|
+
tx.transferObjects([token], input.user);
|
|
275
386
|
return [2 /*return*/, tx];
|
|
276
387
|
}
|
|
277
388
|
});
|
|
@@ -316,34 +427,10 @@ function swap(config, tx, pythClient, input) {
|
|
|
316
427
|
});
|
|
317
428
|
});
|
|
318
429
|
}
|
|
319
|
-
function unsubscribe(config, tx, input) {
|
|
320
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
321
|
-
return __generator(this, function (_a) {
|
|
322
|
-
(0, functions_2.snapshot)(tx, {
|
|
323
|
-
version: __1.STAKE_POOL_VERSION,
|
|
324
|
-
registry: __1.STAKE_POOL,
|
|
325
|
-
index: BigInt(0),
|
|
326
|
-
clock: constants_1.CLOCK,
|
|
327
|
-
userShareId: BigInt(input.userShareId),
|
|
328
|
-
typusEcosystemVersion: config.version.typus,
|
|
329
|
-
typusUserRegistry: config.registry.typus.user,
|
|
330
|
-
});
|
|
331
|
-
(0, functions_2.unsubscribe)(tx, __1.TLP_TOKEN, {
|
|
332
|
-
version: __1.STAKE_POOL_VERSION,
|
|
333
|
-
registry: __1.STAKE_POOL,
|
|
334
|
-
index: BigInt(0),
|
|
335
|
-
userShareId: BigInt(input.userShareId),
|
|
336
|
-
clock: constants_1.CLOCK,
|
|
337
|
-
unsubscribedShares: input.share ? BigInt(input.share) : null,
|
|
338
|
-
});
|
|
339
|
-
return [2 /*return*/, tx];
|
|
340
|
-
});
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
430
|
function harvestStakeReward(config, tx, input) {
|
|
344
431
|
return __awaiter(this, void 0, void 0, function () {
|
|
345
432
|
var iTokens, iTokens_1, iTokens_1_1, iToken, iCoin;
|
|
346
|
-
var
|
|
433
|
+
var e_5, _a;
|
|
347
434
|
return __generator(this, function (_b) {
|
|
348
435
|
iTokens = input.stakePool.incentives.map(function (i) { return i.tokenType.name; });
|
|
349
436
|
(0, functions_2.snapshot)(tx, {
|
|
@@ -381,12 +468,12 @@ function harvestStakeReward(config, tx, input) {
|
|
|
381
468
|
}
|
|
382
469
|
}
|
|
383
470
|
}
|
|
384
|
-
catch (
|
|
471
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
385
472
|
finally {
|
|
386
473
|
try {
|
|
387
474
|
if (iTokens_1_1 && !iTokens_1_1.done && (_a = iTokens_1.return)) _a.call(iTokens_1);
|
|
388
475
|
}
|
|
389
|
-
finally { if (
|
|
476
|
+
finally { if (e_5) throw e_5.error; }
|
|
390
477
|
}
|
|
391
478
|
return [2 /*return*/, tx];
|
|
392
479
|
});
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typus/typus-perp-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.69",
|
|
4
4
|
"repository": "https://github.com/Typus-Lab/typus-perp-sdk.git",
|
|
5
5
|
"author": "Typus",
|
|
6
6
|
"description": "typus perp sdk",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@typus/typus-sdk": "1.7.
|
|
9
|
+
"@typus/typus-sdk": "1.7.2"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@types/bs58": "^4.0.1",
|