@typus/typus-perp-sdk 1.0.61-ut-upgrade → 1.0.62
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/fetch.d.ts +0 -6
- package/dist/src/fetch.js +0 -46
- package/dist/src/index.js +4 -6
- package/dist/src/typus_perp/error/functions.d.ts +0 -2
- package/dist/src/typus_perp/error/functions.js +0 -10
- package/dist/src/typus_perp/lp-pool/functions.d.ts +31 -44
- package/dist/src/typus_perp/lp-pool/functions.js +56 -69
- package/dist/src/typus_perp/lp-pool/structs.d.ts +210 -161
- package/dist/src/typus_perp/lp-pool/structs.js +284 -384
- package/dist/src/typus_perp/trading/functions.d.ts +0 -30
- package/dist/src/typus_perp/trading/functions.js +0 -47
- package/dist/src/typus_stake_pool/stake-pool/functions.d.ts +0 -9
- package/dist/src/typus_stake_pool/stake-pool/functions.js +0 -20
- package/dist/src/user/tlp.d.ts +9 -16
- package/dist/src/user/tlp.js +61 -121
- package/package.json +2 -2
|
@@ -13,11 +13,6 @@ export interface AddTradingSymbolArgs {
|
|
|
13
13
|
basicFundingRate: bigint | TransactionArgument;
|
|
14
14
|
fundingIntervalTsMs: bigint | TransactionArgument;
|
|
15
15
|
expMultiplier: bigint | TransactionArgument;
|
|
16
|
-
maxBuyOpenInterest: bigint | TransactionArgument;
|
|
17
|
-
maxSellOpenInterest: bigint | TransactionArgument;
|
|
18
|
-
maintenanceMarginRateBp: bigint | TransactionArgument;
|
|
19
|
-
optionMaintenanceMarginRateBp: bigint | TransactionArgument;
|
|
20
|
-
optionTradingFeeConfig: Array<bigint | TransactionArgument> | TransactionArgument;
|
|
21
16
|
clock: TransactionObjectInput;
|
|
22
17
|
}
|
|
23
18
|
export declare function addTradingSymbol(tx: Transaction, typeArg: string, args: AddTradingSymbolArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -243,14 +238,6 @@ export interface GetActiveOrdersByOrderTagAndCtokenArgs {
|
|
|
243
238
|
orderTypeTag: number | TransactionArgument;
|
|
244
239
|
}
|
|
245
240
|
export declare function getActiveOrdersByOrderTagAndCtoken(tx: Transaction, typeArgs: [string, string], args: GetActiveOrdersByOrderTagAndCtokenArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
246
|
-
export interface GetAllPositionsArgs {
|
|
247
|
-
version: TransactionObjectInput;
|
|
248
|
-
registry: TransactionObjectInput;
|
|
249
|
-
marketIndex: bigint | TransactionArgument;
|
|
250
|
-
slice: bigint | TransactionArgument;
|
|
251
|
-
page: bigint | TransactionArgument;
|
|
252
|
-
}
|
|
253
|
-
export declare function getAllPositions(tx: Transaction, typeArg: string, args: GetAllPositionsArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
254
241
|
export interface GetEstimatedLiquidationPriceAndPnlArgs {
|
|
255
242
|
version: TransactionObjectInput;
|
|
256
243
|
registry: TransactionObjectInput;
|
|
@@ -408,12 +395,6 @@ export interface ManagerCloseOptionPositionV2Args {
|
|
|
408
395
|
positionId: bigint | TransactionArgument;
|
|
409
396
|
}
|
|
410
397
|
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;
|
|
417
398
|
export interface ManagerReducePositionArgs {
|
|
418
399
|
version: TransactionObjectInput;
|
|
419
400
|
registry: TransactionObjectInput;
|
|
@@ -611,14 +592,6 @@ export interface ReleaseCollateralArgs {
|
|
|
611
592
|
releaseAmount: bigint | TransactionArgument;
|
|
612
593
|
}
|
|
613
594
|
export declare function releaseCollateral(tx: Transaction, typeArgs: [string, string], args: ReleaseCollateralArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
614
|
-
export interface RemoveLinkedOrder_Args {
|
|
615
|
-
version: TransactionObjectInput;
|
|
616
|
-
marketIndex: bigint | TransactionArgument;
|
|
617
|
-
symbolMarket: TransactionObjectInput;
|
|
618
|
-
order: TransactionObjectInput;
|
|
619
|
-
user: string | TransactionArgument;
|
|
620
|
-
}
|
|
621
|
-
export declare function removeLinkedOrder_(tx: Transaction, typeArg: string, args: RemoveLinkedOrder_Args, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
622
595
|
export interface RemoveLinkedOrdersArgs {
|
|
623
596
|
version: TransactionObjectInput;
|
|
624
597
|
marketIndex: bigint | TransactionArgument;
|
|
@@ -703,9 +676,6 @@ export interface UpdateMarketConfigArgs {
|
|
|
703
676
|
expMultiplier: bigint | TransactionArgument | TransactionArgument | null;
|
|
704
677
|
maxBuyOpenInterest: bigint | TransactionArgument | TransactionArgument | null;
|
|
705
678
|
maxSellOpenInterest: bigint | TransactionArgument | TransactionArgument | null;
|
|
706
|
-
maintenanceMarginRateBp: bigint | TransactionArgument | TransactionArgument | null;
|
|
707
|
-
optionCollateralMaintenanceMarginRateBp: bigint | TransactionArgument | TransactionArgument | null;
|
|
708
|
-
optionCollateralTradingFeeConfig: Array<bigint | TransactionArgument> | TransactionArgument | TransactionArgument | null;
|
|
709
679
|
}
|
|
710
680
|
export declare function updateMarketConfig(tx: Transaction, typeArg: string, args: UpdateMarketConfigArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
711
681
|
export interface UpdateProtocolFeeShareBpArgs {
|
|
@@ -19,7 +19,6 @@ exports.executeOrder_ = executeOrder_;
|
|
|
19
19
|
exports.exerciseBidReceipts = exerciseBidReceipts;
|
|
20
20
|
exports.getActiveOrdersByOrderTag = getActiveOrdersByOrderTag;
|
|
21
21
|
exports.getActiveOrdersByOrderTagAndCtoken = getActiveOrdersByOrderTagAndCtoken;
|
|
22
|
-
exports.getAllPositions = getAllPositions;
|
|
23
22
|
exports.getEstimatedLiquidationPriceAndPnl = getEstimatedLiquidationPriceAndPnl;
|
|
24
23
|
exports.getExpiredPositionInfo = getExpiredPositionInfo;
|
|
25
24
|
exports.getLinkedPosition = getLinkedPosition;
|
|
@@ -36,7 +35,6 @@ exports.liquidate = liquidate;
|
|
|
36
35
|
exports.managerCancelOrderByOpenInterestLimit = managerCancelOrderByOpenInterestLimit;
|
|
37
36
|
exports.managerCloseOptionPosition = managerCloseOptionPosition;
|
|
38
37
|
exports.managerCloseOptionPositionV2 = managerCloseOptionPositionV2;
|
|
39
|
-
exports.managerHotfixRemoveMarketSymbol = managerHotfixRemoveMarketSymbol;
|
|
40
38
|
exports.managerReducePosition = managerReducePosition;
|
|
41
39
|
exports.managerReducePositionV2 = managerReducePositionV2;
|
|
42
40
|
exports.managerRemoveOrder = managerRemoveOrder;
|
|
@@ -50,7 +48,6 @@ exports.newMarkets = newMarkets;
|
|
|
50
48
|
exports.reduceOptionCollateralPositionSize = reduceOptionCollateralPositionSize;
|
|
51
49
|
exports.reduceOptionCollateralPositionSizeV2 = reduceOptionCollateralPositionSizeV2;
|
|
52
50
|
exports.releaseCollateral = releaseCollateral;
|
|
53
|
-
exports.removeLinkedOrder_ = removeLinkedOrder_;
|
|
54
51
|
exports.removeLinkedOrders = removeLinkedOrders;
|
|
55
52
|
exports.removeTradingSymbol = removeTradingSymbol;
|
|
56
53
|
exports.resumeMarket = resumeMarket;
|
|
@@ -86,11 +83,6 @@ function addTradingSymbol(tx, typeArg, args, published_at) {
|
|
|
86
83
|
(0, util_1.pure)(tx, args.basicFundingRate, "u64"),
|
|
87
84
|
(0, util_1.pure)(tx, args.fundingIntervalTsMs, "u64"),
|
|
88
85
|
(0, util_1.pure)(tx, args.expMultiplier, "u64"),
|
|
89
|
-
(0, util_1.pure)(tx, args.maxBuyOpenInterest, "u64"),
|
|
90
|
-
(0, util_1.pure)(tx, args.maxSellOpenInterest, "u64"),
|
|
91
|
-
(0, util_1.pure)(tx, args.maintenanceMarginRateBp, "u64"),
|
|
92
|
-
(0, util_1.pure)(tx, args.optionMaintenanceMarginRateBp, "u64"),
|
|
93
|
-
(0, util_1.pure)(tx, args.optionTradingFeeConfig, "vector<u64>"),
|
|
94
86
|
(0, util_1.obj)(tx, args.clock),
|
|
95
87
|
],
|
|
96
88
|
});
|
|
@@ -406,20 +398,6 @@ function getActiveOrdersByOrderTagAndCtoken(tx, typeArgs, args, published_at) {
|
|
|
406
398
|
arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.registry), (0, util_1.pure)(tx, args.marketIndex, "u64"), (0, util_1.pure)(tx, args.orderTypeTag, "u8")],
|
|
407
399
|
});
|
|
408
400
|
}
|
|
409
|
-
function getAllPositions(tx, typeArg, args, published_at) {
|
|
410
|
-
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
411
|
-
return tx.moveCall({
|
|
412
|
-
target: "".concat(published_at, "::trading::get_all_positions"),
|
|
413
|
-
typeArguments: [typeArg],
|
|
414
|
-
arguments: [
|
|
415
|
-
(0, util_1.obj)(tx, args.version),
|
|
416
|
-
(0, util_1.obj)(tx, args.registry),
|
|
417
|
-
(0, util_1.pure)(tx, args.marketIndex, "u64"),
|
|
418
|
-
(0, util_1.pure)(tx, args.slice, "u64"),
|
|
419
|
-
(0, util_1.pure)(tx, args.page, "u64"),
|
|
420
|
-
],
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
401
|
function getEstimatedLiquidationPriceAndPnl(tx, typeArgs, args, published_at) {
|
|
424
402
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
425
403
|
return tx.moveCall({
|
|
@@ -642,14 +620,6 @@ function managerCloseOptionPositionV2(tx, typeArgs, args, published_at) {
|
|
|
642
620
|
],
|
|
643
621
|
});
|
|
644
622
|
}
|
|
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
|
-
}
|
|
653
623
|
function managerReducePosition(tx, typeArgs, args, published_at) {
|
|
654
624
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
655
625
|
return tx.moveCall({
|
|
@@ -921,20 +891,6 @@ function releaseCollateral(tx, typeArgs, args, published_at) {
|
|
|
921
891
|
],
|
|
922
892
|
});
|
|
923
893
|
}
|
|
924
|
-
function removeLinkedOrder_(tx, typeArg, args, published_at) {
|
|
925
|
-
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
926
|
-
return tx.moveCall({
|
|
927
|
-
target: "".concat(published_at, "::trading::remove_linked_order_"),
|
|
928
|
-
typeArguments: [typeArg],
|
|
929
|
-
arguments: [
|
|
930
|
-
(0, util_1.obj)(tx, args.version),
|
|
931
|
-
(0, util_1.pure)(tx, args.marketIndex, "u64"),
|
|
932
|
-
(0, util_1.obj)(tx, args.symbolMarket),
|
|
933
|
-
(0, util_1.obj)(tx, args.order),
|
|
934
|
-
(0, util_1.pure)(tx, args.user, "address"),
|
|
935
|
-
],
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
894
|
function removeLinkedOrders(tx, typeArg, args, published_at) {
|
|
939
895
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
940
896
|
return tx.moveCall({
|
|
@@ -1062,9 +1018,6 @@ function updateMarketConfig(tx, typeArg, args, published_at) {
|
|
|
1062
1018
|
(0, util_1.pure)(tx, args.expMultiplier, "".concat(structs_1.Option.$typeName, "<u64>")),
|
|
1063
1019
|
(0, util_1.pure)(tx, args.maxBuyOpenInterest, "".concat(structs_1.Option.$typeName, "<u64>")),
|
|
1064
1020
|
(0, util_1.pure)(tx, args.maxSellOpenInterest, "".concat(structs_1.Option.$typeName, "<u64>")),
|
|
1065
|
-
(0, util_1.pure)(tx, args.maintenanceMarginRateBp, "".concat(structs_1.Option.$typeName, "<u64>")),
|
|
1066
|
-
(0, util_1.pure)(tx, args.optionCollateralMaintenanceMarginRateBp, "".concat(structs_1.Option.$typeName, "<u64>")),
|
|
1067
|
-
(0, util_1.pure)(tx, args.optionCollateralTradingFeeConfig, "".concat(structs_1.Option.$typeName, "<vector<u64>>")),
|
|
1068
1021
|
],
|
|
1069
1022
|
});
|
|
1070
1023
|
}
|
|
@@ -45,7 +45,6 @@ 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;
|
|
49
48
|
export interface GetIncentiveArgs {
|
|
50
49
|
stakePool: TransactionObjectInput;
|
|
51
50
|
tokenType: TransactionObjectInput;
|
|
@@ -197,11 +196,3 @@ export interface WithdrawIncentiveArgs {
|
|
|
197
196
|
amount: bigint | TransactionArgument | TransactionArgument | null;
|
|
198
197
|
}
|
|
199
198
|
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,7 +7,6 @@ exports.calculateIncentive = calculateIncentive;
|
|
|
7
7
|
exports.createUserLastIncentiveTsMs = createUserLastIncentiveTsMs;
|
|
8
8
|
exports.deactivateIncentiveToken = deactivateIncentiveToken;
|
|
9
9
|
exports.depositIncentive = depositIncentive;
|
|
10
|
-
exports.deprecated = deprecated;
|
|
11
10
|
exports.getIncentive = getIncentive;
|
|
12
11
|
exports.getIncentiveTokens = getIncentiveTokens;
|
|
13
12
|
exports.getLastIncentivePriceIndex = getLastIncentivePriceIndex;
|
|
@@ -34,7 +33,6 @@ exports.updateIncentiveConfig = updateIncentiveConfig;
|
|
|
34
33
|
exports.updatePoolInfoU64Padding = updatePoolInfoU64Padding;
|
|
35
34
|
exports.updateUnlockCountdownTsMs = updateUnlockCountdownTsMs;
|
|
36
35
|
exports.withdrawIncentive = withdrawIncentive;
|
|
37
|
-
exports.withdrawIncentiveV2 = withdrawIncentiveV2;
|
|
38
36
|
var __1 = require("..");
|
|
39
37
|
var structs_1 = require("../../_dependencies/source/0x1/option/structs");
|
|
40
38
|
var util_1 = require("../../_framework/util");
|
|
@@ -99,10 +97,6 @@ function depositIncentive(tx, typeArg, args, published_at) {
|
|
|
99
97
|
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)],
|
|
100
98
|
});
|
|
101
99
|
}
|
|
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
|
-
}
|
|
106
100
|
function getIncentive(tx, args, published_at) {
|
|
107
101
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
108
102
|
return tx.moveCall({
|
|
@@ -335,17 +329,3 @@ function withdrawIncentive(tx, typeArg, args, published_at) {
|
|
|
335
329
|
],
|
|
336
330
|
});
|
|
337
331
|
}
|
|
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,32 +14,21 @@ 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;
|
|
18
17
|
}): Promise<Transaction>;
|
|
19
|
-
export declare function
|
|
18
|
+
export declare function unstakeBurn(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
20
19
|
lpPool: LiquidityPool;
|
|
21
20
|
stakePool: StakePool;
|
|
21
|
+
cTOKEN: TOKEN;
|
|
22
22
|
userShareId: string;
|
|
23
23
|
share: string | null;
|
|
24
24
|
user: string;
|
|
25
25
|
}): Promise<Transaction>;
|
|
26
|
-
export declare function
|
|
27
|
-
lpPool: LiquidityPool;
|
|
28
|
-
stakePool: StakePool;
|
|
29
|
-
userShareId: string;
|
|
30
|
-
share: string | null;
|
|
31
|
-
user: string;
|
|
32
|
-
}): Promise<Transaction>;
|
|
33
|
-
export declare function redeemTlp(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
34
|
-
lpPool: LiquidityPool;
|
|
35
|
-
lpCoins: string[];
|
|
36
|
-
share: string | null;
|
|
37
|
-
user: string;
|
|
38
|
-
}): Promise<Transaction>;
|
|
39
|
-
export declare function claim(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
26
|
+
export declare function burnTlp(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
40
27
|
lpPool: LiquidityPool;
|
|
41
28
|
stakePool: StakePool;
|
|
42
29
|
cTOKEN: TOKEN;
|
|
30
|
+
lpCoin: string;
|
|
31
|
+
share: string | null;
|
|
43
32
|
user: string;
|
|
44
33
|
}): Promise<Transaction>;
|
|
45
34
|
export declare function swap(config: TypusConfig, tx: Transaction, pythClient: PythClient, input: {
|
|
@@ -49,6 +38,10 @@ export declare function swap(config: TypusConfig, tx: Transaction, pythClient: P
|
|
|
49
38
|
amount: string;
|
|
50
39
|
user: string;
|
|
51
40
|
}): Promise<Transaction>;
|
|
41
|
+
export declare function unsubscribe(config: TypusConfig, tx: Transaction, input: {
|
|
42
|
+
userShareId: string;
|
|
43
|
+
share: string | null;
|
|
44
|
+
}): Promise<Transaction>;
|
|
52
45
|
export declare function harvestStakeReward(config: TypusConfig, tx: Transaction, input: {
|
|
53
46
|
stakePool: StakePool;
|
|
54
47
|
userShareId: string;
|
package/dist/src/user/tlp.js
CHANGED
|
@@ -65,11 +65,10 @@ 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.
|
|
70
|
-
exports.redeemTlp = redeemTlp;
|
|
71
|
-
exports.claim = claim;
|
|
68
|
+
exports.unstakeBurn = unstakeBurn;
|
|
69
|
+
exports.burnTlp = burnTlp;
|
|
72
70
|
exports.swap = swap;
|
|
71
|
+
exports.unsubscribe = unsubscribe;
|
|
73
72
|
exports.harvestStakeReward = harvestStakeReward;
|
|
74
73
|
var functions_1 = require("../typus_perp/lp-pool/functions");
|
|
75
74
|
var functions_2 = require("../typus_stake_pool/stake-pool/functions");
|
|
@@ -149,52 +148,22 @@ function mintStakeLp(config, tx, pythClient, input) {
|
|
|
149
148
|
coin: coin,
|
|
150
149
|
clock: constants_1.CLOCK,
|
|
151
150
|
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
tx.transferObjects([lpCoin], input.user);
|
|
164
|
-
}
|
|
151
|
+
(0, functions_2.stake)(tx, __1.TLP_TOKEN, {
|
|
152
|
+
version: __1.STAKE_POOL_VERSION,
|
|
153
|
+
registry: __1.STAKE_POOL,
|
|
154
|
+
index: BigInt(0),
|
|
155
|
+
lpToken: lpCoin,
|
|
156
|
+
clock: constants_1.CLOCK,
|
|
157
|
+
userShareId: input.userShareId ? BigInt(input.userShareId) : null,
|
|
158
|
+
});
|
|
165
159
|
return [2 /*return*/, tx];
|
|
166
160
|
}
|
|
167
161
|
});
|
|
168
162
|
});
|
|
169
163
|
}
|
|
170
|
-
function
|
|
171
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
172
|
-
var lpCoin;
|
|
173
|
-
return __generator(this, function (_a) {
|
|
174
|
-
harvestStakeReward(config, tx, { stakePool: input.stakePool, userShareId: input.userShareId, user: input.user });
|
|
175
|
-
(0, functions_2.unsubscribe)(tx, __1.TLP_TOKEN, {
|
|
176
|
-
version: __1.STAKE_POOL_VERSION,
|
|
177
|
-
registry: __1.STAKE_POOL,
|
|
178
|
-
index: BigInt(0),
|
|
179
|
-
userShareId: BigInt(input.userShareId),
|
|
180
|
-
clock: constants_1.CLOCK,
|
|
181
|
-
unsubscribedShares: input.share ? BigInt(input.share) : null,
|
|
182
|
-
});
|
|
183
|
-
lpCoin = (0, functions_2.unstake)(tx, __1.TLP_TOKEN, {
|
|
184
|
-
version: __1.STAKE_POOL_VERSION,
|
|
185
|
-
registry: __1.STAKE_POOL,
|
|
186
|
-
index: BigInt(0),
|
|
187
|
-
userShareId: BigInt(input.userShareId),
|
|
188
|
-
clock: constants_1.CLOCK,
|
|
189
|
-
});
|
|
190
|
-
tx.transferObjects([lpCoin], input.user);
|
|
191
|
-
return [2 /*return*/, tx];
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
function unstakeRedeem(config, tx, pythClient, input) {
|
|
164
|
+
function unstakeBurn(config, tx, pythClient, input) {
|
|
196
165
|
return __awaiter(this, void 0, void 0, function () {
|
|
197
|
-
var tokens, tokens_2, tokens_2_1, token, lpCoin,
|
|
166
|
+
var tokens, tokens_2, tokens_2_1, token, lpCoin, burnCoin, cToken, coin;
|
|
198
167
|
var e_2, _a;
|
|
199
168
|
return __generator(this, function (_b) {
|
|
200
169
|
switch (_b.label) {
|
|
@@ -224,14 +193,6 @@ function unstakeRedeem(config, tx, pythClient, input) {
|
|
|
224
193
|
finally { if (e_2) throw e_2.error; }
|
|
225
194
|
}
|
|
226
195
|
harvestStakeReward(config, tx, { stakePool: input.stakePool, userShareId: input.userShareId, user: input.user });
|
|
227
|
-
(0, functions_2.unsubscribe)(tx, __1.TLP_TOKEN, {
|
|
228
|
-
version: __1.STAKE_POOL_VERSION,
|
|
229
|
-
registry: __1.STAKE_POOL,
|
|
230
|
-
index: BigInt(0),
|
|
231
|
-
userShareId: BigInt(input.userShareId),
|
|
232
|
-
clock: constants_1.CLOCK,
|
|
233
|
-
unsubscribedShares: input.share ? BigInt(input.share) : null,
|
|
234
|
-
});
|
|
235
196
|
lpCoin = (0, functions_2.unstake)(tx, __1.TLP_TOKEN, {
|
|
236
197
|
version: __1.STAKE_POOL_VERSION,
|
|
237
198
|
registry: __1.STAKE_POOL,
|
|
@@ -239,26 +200,32 @@ function unstakeRedeem(config, tx, pythClient, input) {
|
|
|
239
200
|
userShareId: BigInt(input.userShareId),
|
|
240
201
|
clock: constants_1.CLOCK,
|
|
241
202
|
});
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
203
|
+
if (input.share) {
|
|
204
|
+
burnCoin = tx.splitCoins(lpCoin, [input.share]);
|
|
205
|
+
tx.transferObjects([lpCoin], input.user);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
burnCoin = lpCoin;
|
|
209
|
+
}
|
|
210
|
+
cToken = constants_1.tokenType[__1.NETWORK][input.cTOKEN];
|
|
211
|
+
coin = (0, functions_1.burnLp)(tx, [cToken, __1.TLP_TOKEN], {
|
|
248
212
|
version: __1.PERP_VERSION,
|
|
249
213
|
registry: __1.LP_POOL,
|
|
214
|
+
treasuryCaps: __1.TLP_TREASURY_CAP,
|
|
250
215
|
index: BigInt(0),
|
|
216
|
+
oracle: constants_1.oracle[__1.NETWORK][input.cTOKEN],
|
|
217
|
+
coin: burnCoin,
|
|
251
218
|
clock: constants_1.CLOCK,
|
|
252
|
-
balance: balance,
|
|
253
219
|
});
|
|
220
|
+
tx.transferObjects([coin], input.user);
|
|
254
221
|
return [2 /*return*/, tx];
|
|
255
222
|
}
|
|
256
223
|
});
|
|
257
224
|
});
|
|
258
225
|
}
|
|
259
|
-
function
|
|
226
|
+
function burnTlp(config, tx, pythClient, input) {
|
|
260
227
|
return __awaiter(this, void 0, void 0, function () {
|
|
261
|
-
var tokens, tokens_3, tokens_3_1, token,
|
|
228
|
+
var tokens, tokens_3, tokens_3_1, token, lpCoin, burnCoin, cToken, coin;
|
|
262
229
|
var e_3, _a;
|
|
263
230
|
return __generator(this, function (_b) {
|
|
264
231
|
switch (_b.label) {
|
|
@@ -287,75 +254,24 @@ function redeemTlp(config, tx, pythClient, input) {
|
|
|
287
254
|
}
|
|
288
255
|
finally { if (e_3) throw e_3.error; }
|
|
289
256
|
}
|
|
290
|
-
|
|
291
|
-
if (input.lpCoins.length > 0) {
|
|
292
|
-
tx.mergeCoins(destination, input.lpCoins);
|
|
293
|
-
}
|
|
294
|
-
lpCoin = tx.object(destination);
|
|
257
|
+
lpCoin = tx.object(input.lpCoin);
|
|
295
258
|
if (input.share) {
|
|
296
259
|
burnCoin = tx.splitCoins(lpCoin, [input.share]);
|
|
297
260
|
}
|
|
298
261
|
else {
|
|
299
262
|
burnCoin = lpCoin;
|
|
300
263
|
}
|
|
301
|
-
balance = tx.moveCall({
|
|
302
|
-
target: "0x2::coin::into_balance",
|
|
303
|
-
typeArguments: [__1.TLP_TOKEN],
|
|
304
|
-
arguments: [burnCoin],
|
|
305
|
-
});
|
|
306
|
-
(0, functions_1.redeem)(tx, __1.TLP_TOKEN, {
|
|
307
|
-
version: __1.PERP_VERSION,
|
|
308
|
-
registry: __1.LP_POOL,
|
|
309
|
-
index: BigInt(0),
|
|
310
|
-
clock: constants_1.CLOCK,
|
|
311
|
-
balance: balance,
|
|
312
|
-
});
|
|
313
|
-
return [2 /*return*/, tx];
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
function claim(config, tx, pythClient, input) {
|
|
319
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
320
|
-
var tokens, tokens_4, tokens_4_1, token_1, cToken, token;
|
|
321
|
-
var e_4, _a;
|
|
322
|
-
return __generator(this, function (_b) {
|
|
323
|
-
switch (_b.label) {
|
|
324
|
-
case 0:
|
|
325
|
-
tokens = input.lpPool.tokenPools.map(function (p) { return (0, constants_1.typeArgToAsset)("0x" + p.tokenType.name); });
|
|
326
|
-
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens)];
|
|
327
|
-
case 1:
|
|
328
|
-
_b.sent();
|
|
329
|
-
try {
|
|
330
|
-
for (tokens_4 = __values(tokens), tokens_4_1 = tokens_4.next(); !tokens_4_1.done; tokens_4_1 = tokens_4.next()) {
|
|
331
|
-
token_1 = tokens_4_1.value;
|
|
332
|
-
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token_1);
|
|
333
|
-
(0, functions_1.updateLiquidityValue)(tx, constants_1.tokenType[__1.NETWORK][token_1], {
|
|
334
|
-
version: __1.PERP_VERSION,
|
|
335
|
-
registry: __1.LP_POOL,
|
|
336
|
-
index: BigInt(0),
|
|
337
|
-
oracle: constants_1.oracle[__1.NETWORK][token_1],
|
|
338
|
-
clock: constants_1.CLOCK,
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
343
|
-
finally {
|
|
344
|
-
try {
|
|
345
|
-
if (tokens_4_1 && !tokens_4_1.done && (_a = tokens_4.return)) _a.call(tokens_4);
|
|
346
|
-
}
|
|
347
|
-
finally { if (e_4) throw e_4.error; }
|
|
348
|
-
}
|
|
349
264
|
cToken = constants_1.tokenType[__1.NETWORK][input.cTOKEN];
|
|
350
|
-
|
|
265
|
+
coin = (0, functions_1.burnLp)(tx, [cToken, __1.TLP_TOKEN], {
|
|
351
266
|
version: __1.PERP_VERSION,
|
|
352
267
|
registry: __1.LP_POOL,
|
|
353
|
-
index: BigInt(0),
|
|
354
|
-
clock: constants_1.CLOCK,
|
|
355
268
|
treasuryCaps: __1.TLP_TREASURY_CAP,
|
|
269
|
+
index: BigInt(0),
|
|
356
270
|
oracle: constants_1.oracle[__1.NETWORK][input.cTOKEN],
|
|
271
|
+
coin: burnCoin,
|
|
272
|
+
clock: constants_1.CLOCK,
|
|
357
273
|
});
|
|
358
|
-
tx.transferObjects([
|
|
274
|
+
tx.transferObjects([coin], input.user);
|
|
359
275
|
return [2 /*return*/, tx];
|
|
360
276
|
}
|
|
361
277
|
});
|
|
@@ -400,10 +316,34 @@ function swap(config, tx, pythClient, input) {
|
|
|
400
316
|
});
|
|
401
317
|
});
|
|
402
318
|
}
|
|
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
|
+
}
|
|
403
343
|
function harvestStakeReward(config, tx, input) {
|
|
404
344
|
return __awaiter(this, void 0, void 0, function () {
|
|
405
345
|
var iTokens, iTokens_1, iTokens_1_1, iToken, iCoin;
|
|
406
|
-
var
|
|
346
|
+
var e_4, _a;
|
|
407
347
|
return __generator(this, function (_b) {
|
|
408
348
|
iTokens = input.stakePool.incentives.map(function (i) { return i.tokenType.name; });
|
|
409
349
|
(0, functions_2.snapshot)(tx, {
|
|
@@ -441,12 +381,12 @@ function harvestStakeReward(config, tx, input) {
|
|
|
441
381
|
}
|
|
442
382
|
}
|
|
443
383
|
}
|
|
444
|
-
catch (
|
|
384
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
445
385
|
finally {
|
|
446
386
|
try {
|
|
447
387
|
if (iTokens_1_1 && !iTokens_1_1.done && (_a = iTokens_1.return)) _a.call(iTokens_1);
|
|
448
388
|
}
|
|
449
|
-
finally { if (
|
|
389
|
+
finally { if (e_4) throw e_4.error; }
|
|
450
390
|
}
|
|
451
391
|
return [2 /*return*/, tx];
|
|
452
392
|
});
|
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.62",
|
|
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.6.
|
|
9
|
+
"@typus/typus-sdk": "1.6.30"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@types/bs58": "^4.0.1",
|