@typus/typus-perp-sdk 1.0.61-ut-upgrade-b → 1.0.61-ut-upgrade-c
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 +12 -0
- package/dist/src/fetch.js +119 -0
- package/dist/src/index.js +6 -4
- 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 +44 -31
- package/dist/src/typus_perp/lp-pool/functions.js +69 -56
- 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 +30 -0
- package/dist/src/typus_perp/trading/functions.js +47 -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 +1 -1
package/dist/src/fetch.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Markets, SymbolMarket } from "./typus_perp/trading/structs";
|
|
|
2
2
|
import { LiquidityPool } from "./typus_perp/lp-pool/structs";
|
|
3
3
|
import { TradingOrder, Position } from "./typus_perp/position/structs";
|
|
4
4
|
import { LpUserShare, StakePool } from "./typus_stake_pool/stake-pool/structs";
|
|
5
|
+
import { TOKEN } from "@typus/typus-sdk/dist/src/constants";
|
|
5
6
|
import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
|
|
6
7
|
import { TypusBidReceipt } from "./_dependencies/source/0xb4f25230ba74837d8299e92951306100c4a532e8c48cc3d8828abe9b91c8b274/vault/structs";
|
|
7
8
|
export declare function getLpPools(config: TypusConfig): Promise<LiquidityPool[]>;
|
|
@@ -29,3 +30,14 @@ export declare function getLiquidationPriceAndPnl(config: TypusConfig, pythClien
|
|
|
29
30
|
positions: Position[];
|
|
30
31
|
user: string;
|
|
31
32
|
}): Promise<(string | number)[][] | undefined>;
|
|
33
|
+
export declare function getPositionCount(config: TypusConfig, input: {
|
|
34
|
+
baseToken: TOKEN;
|
|
35
|
+
}): Promise<number>;
|
|
36
|
+
export declare function getAllPositions(config: TypusConfig, input: {
|
|
37
|
+
baseToken: TOKEN;
|
|
38
|
+
slice: string;
|
|
39
|
+
page: string;
|
|
40
|
+
}): Promise<Position[]>;
|
|
41
|
+
export declare function getAllPositionsWithTradingSymbol(config: TypusConfig, input: {
|
|
42
|
+
baseToken: TOKEN;
|
|
43
|
+
}): Promise<Position[]>;
|
package/dist/src/fetch.js
CHANGED
|
@@ -57,6 +57,9 @@ exports.getUserPositions = getUserPositions;
|
|
|
57
57
|
exports.parseOptionBidReceipts = parseOptionBidReceipts;
|
|
58
58
|
exports.getUserStake = getUserStake;
|
|
59
59
|
exports.getLiquidationPriceAndPnl = getLiquidationPriceAndPnl;
|
|
60
|
+
exports.getPositionCount = getPositionCount;
|
|
61
|
+
exports.getAllPositions = getAllPositions;
|
|
62
|
+
exports.getAllPositionsWithTradingSymbol = getAllPositionsWithTradingSymbol;
|
|
60
63
|
var client_1 = require("@mysten/sui/client");
|
|
61
64
|
var transactions_1 = require("@mysten/sui/transactions");
|
|
62
65
|
var bcs_1 = require("@mysten/bcs");
|
|
@@ -493,3 +496,119 @@ function getLiquidationPriceAndPnl(config, pythClient, input) {
|
|
|
493
496
|
});
|
|
494
497
|
});
|
|
495
498
|
}
|
|
499
|
+
function getPositionCount(config, input) {
|
|
500
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
501
|
+
var provider, tx, res, raw, maxPageBytes, view, maxPage;
|
|
502
|
+
var _a, _b, _c, _d;
|
|
503
|
+
return __generator(this, function (_e) {
|
|
504
|
+
switch (_e.label) {
|
|
505
|
+
case 0:
|
|
506
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
507
|
+
tx = new transactions_1.Transaction();
|
|
508
|
+
// Rust 實作是呼叫 get_all_positions(slice = 1, page = 1) 然後取最後 8 bytes。
|
|
509
|
+
// 這裡直接複用相同邏輯,只需要 max_page。
|
|
510
|
+
(0, functions_1.getAllPositions)(tx, constants_1.tokenType[_1.NETWORK][input.baseToken], {
|
|
511
|
+
version: _1.PERP_VERSION,
|
|
512
|
+
registry: _1.MARKET,
|
|
513
|
+
marketIndex: BigInt(0),
|
|
514
|
+
slice: BigInt(1),
|
|
515
|
+
page: BigInt(1),
|
|
516
|
+
});
|
|
517
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({
|
|
518
|
+
sender: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
519
|
+
transactionBlock: tx,
|
|
520
|
+
})];
|
|
521
|
+
case 1:
|
|
522
|
+
res = _e.sent();
|
|
523
|
+
// 沒有資料時,回傳 0
|
|
524
|
+
if (!((_d = (_c = (_b = (_a = res.results) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.returnValues) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d[0])) {
|
|
525
|
+
return [2 /*return*/, 0];
|
|
526
|
+
}
|
|
527
|
+
raw = new Uint8Array(res.results[0].returnValues[0][0]);
|
|
528
|
+
// 至少要含 8 bytes 的 max_page;不足代表無 Position
|
|
529
|
+
if (raw.length < 8)
|
|
530
|
+
return [2 /*return*/, 0];
|
|
531
|
+
maxPageBytes = raw.slice(raw.length - 8);
|
|
532
|
+
view = new DataView(maxPageBytes.buffer, maxPageBytes.byteOffset, 8);
|
|
533
|
+
maxPage = Number(view.getBigUint64(0, true));
|
|
534
|
+
return [2 /*return*/, maxPage];
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
function getAllPositions(config, input) {
|
|
540
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
541
|
+
var provider, tx, res, raw, withoutMaxPage, reader, userPositionsLen, positions, i, fields, pos;
|
|
542
|
+
var _a, _b, _c, _d;
|
|
543
|
+
return __generator(this, function (_e) {
|
|
544
|
+
switch (_e.label) {
|
|
545
|
+
case 0:
|
|
546
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
547
|
+
tx = new transactions_1.Transaction();
|
|
548
|
+
(0, functions_1.getAllPositions)(tx, constants_1.tokenType[_1.NETWORK][input.baseToken], {
|
|
549
|
+
version: _1.PERP_VERSION,
|
|
550
|
+
registry: _1.MARKET,
|
|
551
|
+
marketIndex: BigInt(0),
|
|
552
|
+
slice: BigInt(input.slice),
|
|
553
|
+
page: BigInt(input.page),
|
|
554
|
+
});
|
|
555
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({
|
|
556
|
+
sender: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
557
|
+
transactionBlock: tx,
|
|
558
|
+
})];
|
|
559
|
+
case 1:
|
|
560
|
+
res = _e.sent();
|
|
561
|
+
console.log(res);
|
|
562
|
+
if (!((_d = (_c = (_b = (_a = res.results) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.returnValues) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d[0])) {
|
|
563
|
+
return [2 /*return*/, []];
|
|
564
|
+
}
|
|
565
|
+
raw = new Uint8Array(res.results[0].returnValues[0][0]);
|
|
566
|
+
// 1) 至少要有 8 bytes 的 max_page
|
|
567
|
+
if (raw.length < 8)
|
|
568
|
+
return [2 /*return*/, []];
|
|
569
|
+
withoutMaxPage = raw.slice(0, raw.length - 8);
|
|
570
|
+
reader = new bcs_1.BcsReader(withoutMaxPage);
|
|
571
|
+
userPositionsLen = reader.read8() - 1;
|
|
572
|
+
positions = [];
|
|
573
|
+
for (i = 0; i < userPositionsLen; i++) {
|
|
574
|
+
reader.read16();
|
|
575
|
+
fields = structs_3.Position.bcs.read(reader);
|
|
576
|
+
pos = structs_3.Position.fromFields(fields);
|
|
577
|
+
positions.push(pos);
|
|
578
|
+
}
|
|
579
|
+
return [2 /*return*/, positions];
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
function getAllPositionsWithTradingSymbol(config, input) {
|
|
585
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
586
|
+
var total, slice, pages, pagePromises, page, results;
|
|
587
|
+
return __generator(this, function (_a) {
|
|
588
|
+
switch (_a.label) {
|
|
589
|
+
case 0: return [4 /*yield*/, getPositionCount(config, { baseToken: input.baseToken })];
|
|
590
|
+
case 1:
|
|
591
|
+
total = _a.sent();
|
|
592
|
+
// 2) 若無倉位直接回傳 []
|
|
593
|
+
if (total === 0) {
|
|
594
|
+
return [2 /*return*/, []];
|
|
595
|
+
}
|
|
596
|
+
slice = Math.min(total, 100);
|
|
597
|
+
pages = Math.ceil(total / slice);
|
|
598
|
+
pagePromises = [];
|
|
599
|
+
for (page = 1; page <= pages; page++) {
|
|
600
|
+
pagePromises.push(getAllPositions(config, {
|
|
601
|
+
baseToken: input.baseToken,
|
|
602
|
+
slice: slice.toString(),
|
|
603
|
+
page: page.toString(),
|
|
604
|
+
}));
|
|
605
|
+
}
|
|
606
|
+
return [4 /*yield*/, Promise.all(pagePromises)];
|
|
607
|
+
case 2:
|
|
608
|
+
results = _a.sent();
|
|
609
|
+
// 5) 扁平化後回傳
|
|
610
|
+
return [2 /*return*/, results.flat()];
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
});
|
|
614
|
+
}
|
package/dist/src/index.js
CHANGED
|
@@ -30,8 +30,8 @@ exports.PERP_PACKAGE_ID = exports.NETWORK == "MAINNET"
|
|
|
30
30
|
? "0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5"
|
|
31
31
|
: "0x585924f160f83ef16f8927ec117e4d740abb6f4e571ecfa89ff3e973042cb1b9";
|
|
32
32
|
exports.PERP_PUBLISHED_AT = exports.NETWORK == "MAINNET"
|
|
33
|
-
? "
|
|
34
|
-
: "
|
|
33
|
+
? "0xeb018055af198e99a368ccda030e9aef07ffb86aa5de83e98734913064b0cff4"
|
|
34
|
+
: "0x102c88cd633046520d1a5bc77f7e90bcf466e5a74660cead86710d60696eb997";
|
|
35
35
|
exports.PERP_PKG_V1 = exports.NETWORK == "MAINNET"
|
|
36
36
|
? "0xe27969a70f93034de9ce16e6ad661b480324574e68d15a64b513fd90eb2423e5"
|
|
37
37
|
: "0x585924f160f83ef16f8927ec117e4d740abb6f4e571ecfa89ff3e973042cb1b9";
|
|
@@ -40,7 +40,7 @@ exports.STAKE_PACKAGE_ID = exports.NETWORK == "MAINNET"
|
|
|
40
40
|
: "0x220e7ba8923c0c30b57c0baab3bc15d781a39bb294cf7af318c0fc816b5cf7e6";
|
|
41
41
|
exports.STAKE_PUBLISHED_AT = exports.NETWORK == "MAINNET"
|
|
42
42
|
? "0xd9965c09d5ad7d69306b7c550b3b135d94b34f98c3adc379a7333fff2f05808b"
|
|
43
|
-
: "
|
|
43
|
+
: "0xf8fa4a303118328de2fb53f49a043fa5bf58b84f372db0d1e7cf7b1f1a47d10e";
|
|
44
44
|
exports.STAKE_PKG_V1 = exports.NETWORK == "MAINNET"
|
|
45
45
|
? "0xc427209145715a00a93d7e674a95c556a7147d79fda1bbaeb1a1cac5f9923966"
|
|
46
46
|
: "0x220e7ba8923c0c30b57c0baab3bc15d781a39bb294cf7af318c0fc816b5cf7e6";
|
|
@@ -81,4 +81,6 @@ exports.STAKE_POOL_0 = exports.NETWORK == "MAINNET"
|
|
|
81
81
|
exports.STAKE_POOL_VERSION = exports.NETWORK == "MAINNET"
|
|
82
82
|
? "0xdf3ed1599218b2415b2cd7fa06296f7f647676019b2873ec18e55a626c584f1b"
|
|
83
83
|
: "0xafb81680b9ac3d627eb733154c43d34e3ec758cf8e00a55c384df2c8150f7881";
|
|
84
|
-
exports.COMPETITION_CONFIG = exports.NETWORK == "MAINNET"
|
|
84
|
+
exports.COMPETITION_CONFIG = exports.NETWORK == "MAINNET"
|
|
85
|
+
? "0x36056abf9adde86f81667dad680a8ac98868c9fc1cb4d519fd2222d5d4522906"
|
|
86
|
+
: "0xbc3914cd777d009afc05e81cd6d006428ce742569c795b0bac493c1b0ef58559";
|
|
@@ -12,6 +12,7 @@ export declare function bidReceiptNotExpired(tx: Transaction, published_at?: str
|
|
|
12
12
|
export declare function bidReceiptNotItm(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
13
13
|
export declare function bidTokenMismatched(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
14
14
|
export declare function collateralTokenTypeMismatched(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
15
|
+
export declare function deactivatingSharesAlreadyExisted(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
15
16
|
export declare function depositAmountInsufficient(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
16
17
|
export declare function depositTokenMismatched(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
17
18
|
export declare function exceedMaxLeverage(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -65,6 +66,7 @@ export declare function tvlNotYetUpdated(tx: Transaction, published_at?: string)
|
|
|
65
66
|
export declare function unauthorized(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
66
67
|
export declare function unsupportedOrderTypeTag(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
67
68
|
export declare function unsupportedProcessStatusCode(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
69
|
+
export declare function userDeactivatingSharesNotExisted(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
68
70
|
export declare function userMismatched(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
69
71
|
export declare function wrongCollateralType(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
70
72
|
export declare function zeroPrice(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -13,6 +13,7 @@ exports.bidReceiptNotExpired = bidReceiptNotExpired;
|
|
|
13
13
|
exports.bidReceiptNotItm = bidReceiptNotItm;
|
|
14
14
|
exports.bidTokenMismatched = bidTokenMismatched;
|
|
15
15
|
exports.collateralTokenTypeMismatched = collateralTokenTypeMismatched;
|
|
16
|
+
exports.deactivatingSharesAlreadyExisted = deactivatingSharesAlreadyExisted;
|
|
16
17
|
exports.depositAmountInsufficient = depositAmountInsufficient;
|
|
17
18
|
exports.depositTokenMismatched = depositTokenMismatched;
|
|
18
19
|
exports.exceedMaxLeverage = exceedMaxLeverage;
|
|
@@ -66,6 +67,7 @@ exports.tvlNotYetUpdated = tvlNotYetUpdated;
|
|
|
66
67
|
exports.unauthorized = unauthorized;
|
|
67
68
|
exports.unsupportedOrderTypeTag = unsupportedOrderTypeTag;
|
|
68
69
|
exports.unsupportedProcessStatusCode = unsupportedProcessStatusCode;
|
|
70
|
+
exports.userDeactivatingSharesNotExisted = userDeactivatingSharesNotExisted;
|
|
69
71
|
exports.userMismatched = userMismatched;
|
|
70
72
|
exports.wrongCollateralType = wrongCollateralType;
|
|
71
73
|
exports.zeroPrice = zeroPrice;
|
|
@@ -123,6 +125,10 @@ function collateralTokenTypeMismatched(tx, published_at) {
|
|
|
123
125
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
124
126
|
return tx.moveCall({ target: "".concat(published_at, "::error::collateral_token_type_mismatched"), arguments: [] });
|
|
125
127
|
}
|
|
128
|
+
function deactivatingSharesAlreadyExisted(tx, published_at) {
|
|
129
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
130
|
+
return tx.moveCall({ target: "".concat(published_at, "::error::deactivating_shares_already_existed"), arguments: [] });
|
|
131
|
+
}
|
|
126
132
|
function depositAmountInsufficient(tx, published_at) {
|
|
127
133
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
128
134
|
return tx.moveCall({ target: "".concat(published_at, "::error::deposit_amount_insufficient"), arguments: [] });
|
|
@@ -335,6 +341,10 @@ function unsupportedProcessStatusCode(tx, published_at) {
|
|
|
335
341
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
336
342
|
return tx.moveCall({ target: "".concat(published_at, "::error::unsupported_process_status_code"), arguments: [] });
|
|
337
343
|
}
|
|
344
|
+
function userDeactivatingSharesNotExisted(tx, published_at) {
|
|
345
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
346
|
+
return tx.moveCall({ target: "".concat(published_at, "::error::user_deactivating_shares_not_existed"), arguments: [] });
|
|
347
|
+
}
|
|
338
348
|
function userMismatched(tx, published_at) {
|
|
339
349
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
340
350
|
return tx.moveCall({ target: "".concat(published_at, "::error::user_mismatched"), arguments: [] });
|
|
@@ -35,6 +35,16 @@ export interface BurnLpArgs {
|
|
|
35
35
|
clock: TransactionObjectInput;
|
|
36
36
|
}
|
|
37
37
|
export declare function burnLp(tx: Transaction, typeArgs: [string, string], args: BurnLpArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
38
|
+
export interface BurnLp_Args {
|
|
39
|
+
version: TransactionObjectInput;
|
|
40
|
+
registry: TransactionObjectInput;
|
|
41
|
+
index: bigint | TransactionArgument;
|
|
42
|
+
treasuryCaps: TransactionObjectInput;
|
|
43
|
+
oracle: TransactionObjectInput;
|
|
44
|
+
burnLpBalance: TransactionObjectInput;
|
|
45
|
+
clock: TransactionObjectInput;
|
|
46
|
+
}
|
|
47
|
+
export declare function burnLp_(tx: Transaction, typeArgs: [string, string], args: BurnLp_Args, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
38
48
|
export interface CalculateBurnLpArgs {
|
|
39
49
|
registry: TransactionObjectInput;
|
|
40
50
|
index: bigint | TransactionArgument;
|
|
@@ -91,6 +101,15 @@ export interface CheckTvlUpdatedArgs {
|
|
|
91
101
|
clock: TransactionObjectInput;
|
|
92
102
|
}
|
|
93
103
|
export declare function checkTvlUpdated(tx: Transaction, args: CheckTvlUpdatedArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
104
|
+
export interface ClaimArgs {
|
|
105
|
+
version: TransactionObjectInput;
|
|
106
|
+
registry: TransactionObjectInput;
|
|
107
|
+
index: bigint | TransactionArgument;
|
|
108
|
+
treasuryCaps: TransactionObjectInput;
|
|
109
|
+
oracle: TransactionObjectInput;
|
|
110
|
+
clock: TransactionObjectInput;
|
|
111
|
+
}
|
|
112
|
+
export declare function claim(tx: Transaction, typeArgs: [string, string], args: ClaimArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
94
113
|
export interface CompleteRemoveLiquidityTokenProcessArgs {
|
|
95
114
|
version: TransactionObjectInput;
|
|
96
115
|
registry: TransactionObjectInput;
|
|
@@ -98,14 +117,13 @@ export interface CompleteRemoveLiquidityTokenProcessArgs {
|
|
|
98
117
|
process: TransactionObjectInput;
|
|
99
118
|
}
|
|
100
119
|
export declare function completeRemoveLiquidityTokenProcess(tx: Transaction, typeArg: string, args: CompleteRemoveLiquidityTokenProcessArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
101
|
-
export interface
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
clock: TransactionObjectInput;
|
|
106
|
-
depositAmount: bigint | TransactionArgument;
|
|
120
|
+
export interface CreateDeactivatingSharesArgs {
|
|
121
|
+
version: TransactionObjectInput;
|
|
122
|
+
registry: TransactionObjectInput;
|
|
123
|
+
index: bigint | TransactionArgument;
|
|
107
124
|
}
|
|
108
|
-
export declare function
|
|
125
|
+
export declare function createDeactivatingShares(tx: Transaction, typeArg: string, args: CreateDeactivatingSharesArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
126
|
+
export declare function deprecated(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
109
127
|
export declare function getBorrowRateDecimal(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
110
128
|
export interface GetCumulativeBorrowRateArgs {
|
|
111
129
|
liquidityPool: TransactionObjectInput;
|
|
@@ -173,16 +191,6 @@ export interface GetTokenPoolStateArgs {
|
|
|
173
191
|
export declare function getTokenPoolState(tx: Transaction, args: GetTokenPoolStateArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
174
192
|
export declare function getTvlUsd(tx: Transaction, liquidityPool: TransactionObjectInput, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
175
193
|
export declare function init(tx: Transaction, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
176
|
-
export interface ManagerDepositScallopArgs {
|
|
177
|
-
version: TransactionObjectInput;
|
|
178
|
-
registry: TransactionObjectInput;
|
|
179
|
-
index: bigint | TransactionArgument;
|
|
180
|
-
scallopVersion: TransactionObjectInput;
|
|
181
|
-
scallopMarket: TransactionObjectInput;
|
|
182
|
-
clock: TransactionObjectInput;
|
|
183
|
-
lendingAmount: bigint | TransactionArgument | TransactionArgument | null;
|
|
184
|
-
}
|
|
185
|
-
export declare function managerDepositScallop(tx: Transaction, typeArg: string, args: ManagerDepositScallopArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
186
194
|
export interface ManagerFlashRemoveLiquidityArgs {
|
|
187
195
|
version: TransactionObjectInput;
|
|
188
196
|
registry: TransactionObjectInput;
|
|
@@ -202,16 +210,14 @@ export interface ManagerFlashRepayLiquidityArgs {
|
|
|
202
210
|
clock: TransactionObjectInput;
|
|
203
211
|
}
|
|
204
212
|
export declare function managerFlashRepayLiquidity(tx: Transaction, typeArg: string, args: ManagerFlashRepayLiquidityArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
205
|
-
export interface
|
|
213
|
+
export interface ManagerHotfixBurnLpArgs {
|
|
206
214
|
version: TransactionObjectInput;
|
|
207
215
|
registry: TransactionObjectInput;
|
|
208
216
|
index: bigint | TransactionArgument;
|
|
209
|
-
|
|
210
|
-
scallopMarket: TransactionObjectInput;
|
|
217
|
+
oracle: TransactionObjectInput;
|
|
211
218
|
clock: TransactionObjectInput;
|
|
212
|
-
withdrawAmount: bigint | TransactionArgument | TransactionArgument | null;
|
|
213
219
|
}
|
|
214
|
-
export declare function
|
|
220
|
+
export declare function managerHotfixBurnLp(tx: Transaction, typeArg: string, args: ManagerHotfixBurnLpArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
215
221
|
export interface MintLpArgs {
|
|
216
222
|
version: TransactionObjectInput;
|
|
217
223
|
registry: TransactionObjectInput;
|
|
@@ -226,6 +232,7 @@ export interface NewLiquidityPoolArgs {
|
|
|
226
232
|
version: TransactionObjectInput;
|
|
227
233
|
registry: TransactionObjectInput;
|
|
228
234
|
lpTokenDecimal: bigint | TransactionArgument;
|
|
235
|
+
unlockCountdownTsMs: bigint | TransactionArgument;
|
|
229
236
|
}
|
|
230
237
|
export declare function newLiquidityPool(tx: Transaction, typeArg: string, args: NewLiquidityPoolArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
231
238
|
export interface OracleMatchedArgs {
|
|
@@ -253,6 +260,14 @@ export interface PutReceiptCollateralsArgs {
|
|
|
253
260
|
unsettledBidReceipts: Array<TransactionObjectInput> | TransactionArgument;
|
|
254
261
|
}
|
|
255
262
|
export declare function putReceiptCollaterals(tx: Transaction, args: PutReceiptCollateralsArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
263
|
+
export interface RedeemArgs {
|
|
264
|
+
version: TransactionObjectInput;
|
|
265
|
+
registry: TransactionObjectInput;
|
|
266
|
+
index: bigint | TransactionArgument;
|
|
267
|
+
balance: TransactionObjectInput;
|
|
268
|
+
clock: TransactionObjectInput;
|
|
269
|
+
}
|
|
270
|
+
export declare function redeem(tx: Transaction, typeArg: string, args: RedeemArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
256
271
|
export interface RequestCollateralArgs {
|
|
257
272
|
liquidityPool: TransactionObjectInput;
|
|
258
273
|
collateralAmount: bigint | TransactionArgument;
|
|
@@ -372,6 +387,13 @@ export interface UpdateTvlArgs {
|
|
|
372
387
|
clock: TransactionObjectInput;
|
|
373
388
|
}
|
|
374
389
|
export declare function updateTvl(tx: Transaction, args: UpdateTvlArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
390
|
+
export interface UpdateUnlockCountdownTsMsArgs {
|
|
391
|
+
version: TransactionObjectInput;
|
|
392
|
+
registry: TransactionObjectInput;
|
|
393
|
+
index: bigint | TransactionArgument;
|
|
394
|
+
unlockCountdownTsMs: bigint | TransactionArgument;
|
|
395
|
+
}
|
|
396
|
+
export declare function updateUnlockCountdownTsMs(tx: Transaction, args: UpdateUnlockCountdownTsMsArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
375
397
|
export interface ViewSwapResultArgs {
|
|
376
398
|
version: TransactionObjectInput;
|
|
377
399
|
registry: TransactionObjectInput;
|
|
@@ -382,12 +404,3 @@ export interface ViewSwapResultArgs {
|
|
|
382
404
|
clock: TransactionObjectInput;
|
|
383
405
|
}
|
|
384
406
|
export declare function viewSwapResult(tx: Transaction, typeArgs: [string, string], args: ViewSwapResultArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
385
|
-
export interface WithdrawScallopBasicArgs {
|
|
386
|
-
version: TransactionObjectInput;
|
|
387
|
-
liquidityPool: TransactionObjectInput;
|
|
388
|
-
scallopVersion: TransactionObjectInput;
|
|
389
|
-
scallopMarket: TransactionObjectInput;
|
|
390
|
-
clock: TransactionObjectInput;
|
|
391
|
-
withdrawAmount: bigint | TransactionArgument;
|
|
392
|
-
}
|
|
393
|
-
export declare function withdrawScallopBasic(tx: Transaction, typeArg: string, args: WithdrawScallopBasicArgs, published_at?: string): import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addLiquidityToken = addLiquidityToken;
|
|
4
4
|
exports.burnLp = burnLp;
|
|
5
|
+
exports.burnLp_ = burnLp_;
|
|
5
6
|
exports.calculateBurnLp = calculateBurnLp;
|
|
6
7
|
exports.calculateLpFee = calculateLpFee;
|
|
7
8
|
exports.calculateMintLp = calculateMintLp;
|
|
@@ -10,8 +11,10 @@ exports.checkRemoveLiquidityTokenProcessStatus = checkRemoveLiquidityTokenProces
|
|
|
10
11
|
exports.checkTokenPoolStatus = checkTokenPoolStatus;
|
|
11
12
|
exports.checkTradingOrderSizeValid = checkTradingOrderSizeValid;
|
|
12
13
|
exports.checkTvlUpdated = checkTvlUpdated;
|
|
14
|
+
exports.claim = claim;
|
|
13
15
|
exports.completeRemoveLiquidityTokenProcess = completeRemoveLiquidityTokenProcess;
|
|
14
|
-
exports.
|
|
16
|
+
exports.createDeactivatingShares = createDeactivatingShares;
|
|
17
|
+
exports.deprecated = deprecated;
|
|
15
18
|
exports.getBorrowRateDecimal = getBorrowRateDecimal;
|
|
16
19
|
exports.getCumulativeBorrowRate = getCumulativeBorrowRate;
|
|
17
20
|
exports.getExpiredReceiptCollateralBcs = getExpiredReceiptCollateralBcs;
|
|
@@ -28,16 +31,16 @@ exports.getTokenPool = getTokenPool;
|
|
|
28
31
|
exports.getTokenPoolState = getTokenPoolState;
|
|
29
32
|
exports.getTvlUsd = getTvlUsd;
|
|
30
33
|
exports.init = init;
|
|
31
|
-
exports.managerDepositScallop = managerDepositScallop;
|
|
32
34
|
exports.managerFlashRemoveLiquidity = managerFlashRemoveLiquidity;
|
|
33
35
|
exports.managerFlashRepayLiquidity = managerFlashRepayLiquidity;
|
|
34
|
-
exports.
|
|
36
|
+
exports.managerHotfixBurnLp = managerHotfixBurnLp;
|
|
35
37
|
exports.mintLp = mintLp;
|
|
36
38
|
exports.newLiquidityPool = newLiquidityPool;
|
|
37
39
|
exports.oracleMatched = oracleMatched;
|
|
38
40
|
exports.orderFilled = orderFilled;
|
|
39
41
|
exports.putCollateral = putCollateral;
|
|
40
42
|
exports.putReceiptCollaterals = putReceiptCollaterals;
|
|
43
|
+
exports.redeem = redeem;
|
|
41
44
|
exports.requestCollateral = requestCollateral;
|
|
42
45
|
exports.resumePool = resumePool;
|
|
43
46
|
exports.resumeTokenPool = resumeTokenPool;
|
|
@@ -55,8 +58,8 @@ exports.updateRemoveLiquidityTokenProcessToken = updateRemoveLiquidityTokenProce
|
|
|
55
58
|
exports.updateReserveAmount = updateReserveAmount;
|
|
56
59
|
exports.updateSpotConfig = updateSpotConfig;
|
|
57
60
|
exports.updateTvl = updateTvl;
|
|
61
|
+
exports.updateUnlockCountdownTsMs = updateUnlockCountdownTsMs;
|
|
58
62
|
exports.viewSwapResult = viewSwapResult;
|
|
59
|
-
exports.withdrawScallopBasic = withdrawScallopBasic;
|
|
60
63
|
var __1 = require("..");
|
|
61
64
|
var structs_1 = require("../../_dependencies/source/0x1/option/structs");
|
|
62
65
|
var util_1 = require("../../_framework/util");
|
|
@@ -109,6 +112,22 @@ function burnLp(tx, typeArgs, args, published_at) {
|
|
|
109
112
|
],
|
|
110
113
|
});
|
|
111
114
|
}
|
|
115
|
+
function burnLp_(tx, typeArgs, args, published_at) {
|
|
116
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
117
|
+
return tx.moveCall({
|
|
118
|
+
target: "".concat(published_at, "::lp_pool::burn_lp_"),
|
|
119
|
+
typeArguments: typeArgs,
|
|
120
|
+
arguments: [
|
|
121
|
+
(0, util_1.obj)(tx, args.version),
|
|
122
|
+
(0, util_1.obj)(tx, args.registry),
|
|
123
|
+
(0, util_1.pure)(tx, args.index, "u64"),
|
|
124
|
+
(0, util_1.obj)(tx, args.treasuryCaps),
|
|
125
|
+
(0, util_1.obj)(tx, args.oracle),
|
|
126
|
+
(0, util_1.obj)(tx, args.burnLpBalance),
|
|
127
|
+
(0, util_1.obj)(tx, args.clock),
|
|
128
|
+
],
|
|
129
|
+
});
|
|
130
|
+
}
|
|
112
131
|
function calculateBurnLp(tx, args, published_at) {
|
|
113
132
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
114
133
|
return tx.moveCall({
|
|
@@ -192,6 +211,21 @@ function checkTvlUpdated(tx, args, published_at) {
|
|
|
192
211
|
arguments: [(0, util_1.obj)(tx, args.liquidityPool), (0, util_1.obj)(tx, args.clock)],
|
|
193
212
|
});
|
|
194
213
|
}
|
|
214
|
+
function claim(tx, typeArgs, args, published_at) {
|
|
215
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
216
|
+
return tx.moveCall({
|
|
217
|
+
target: "".concat(published_at, "::lp_pool::claim"),
|
|
218
|
+
typeArguments: typeArgs,
|
|
219
|
+
arguments: [
|
|
220
|
+
(0, util_1.obj)(tx, args.version),
|
|
221
|
+
(0, util_1.obj)(tx, args.registry),
|
|
222
|
+
(0, util_1.pure)(tx, args.index, "u64"),
|
|
223
|
+
(0, util_1.obj)(tx, args.treasuryCaps),
|
|
224
|
+
(0, util_1.obj)(tx, args.oracle),
|
|
225
|
+
(0, util_1.obj)(tx, args.clock),
|
|
226
|
+
],
|
|
227
|
+
});
|
|
228
|
+
}
|
|
195
229
|
function completeRemoveLiquidityTokenProcess(tx, typeArg, args, published_at) {
|
|
196
230
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
197
231
|
return tx.moveCall({
|
|
@@ -200,20 +234,18 @@ function completeRemoveLiquidityTokenProcess(tx, typeArg, args, published_at) {
|
|
|
200
234
|
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.process)],
|
|
201
235
|
});
|
|
202
236
|
}
|
|
203
|
-
function
|
|
237
|
+
function createDeactivatingShares(tx, typeArg, args, published_at) {
|
|
204
238
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
205
239
|
return tx.moveCall({
|
|
206
|
-
target: "".concat(published_at, "::lp_pool::
|
|
240
|
+
target: "".concat(published_at, "::lp_pool::create_deactivating_shares"),
|
|
207
241
|
typeArguments: [typeArg],
|
|
208
|
-
arguments: [
|
|
209
|
-
(0, util_1.obj)(tx, args.liquidityPool),
|
|
210
|
-
(0, util_1.obj)(tx, args.scallopVersion),
|
|
211
|
-
(0, util_1.obj)(tx, args.scallopMarket),
|
|
212
|
-
(0, util_1.obj)(tx, args.clock),
|
|
213
|
-
(0, util_1.pure)(tx, args.depositAmount, "u64"),
|
|
214
|
-
],
|
|
242
|
+
arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.registry), (0, util_1.pure)(tx, args.index, "u64")],
|
|
215
243
|
});
|
|
216
244
|
}
|
|
245
|
+
function deprecated(tx, published_at) {
|
|
246
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
247
|
+
return tx.moveCall({ target: "".concat(published_at, "::lp_pool::deprecated"), arguments: [] });
|
|
248
|
+
}
|
|
217
249
|
function getBorrowRateDecimal(tx, published_at) {
|
|
218
250
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
219
251
|
return tx.moveCall({ target: "".concat(published_at, "::lp_pool::get_borrow_rate_decimal"), arguments: [] });
|
|
@@ -314,22 +346,6 @@ function init(tx, published_at) {
|
|
|
314
346
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
315
347
|
return tx.moveCall({ target: "".concat(published_at, "::lp_pool::init"), arguments: [] });
|
|
316
348
|
}
|
|
317
|
-
function managerDepositScallop(tx, typeArg, args, published_at) {
|
|
318
|
-
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
319
|
-
return tx.moveCall({
|
|
320
|
-
target: "".concat(published_at, "::lp_pool::manager_deposit_scallop"),
|
|
321
|
-
typeArguments: [typeArg],
|
|
322
|
-
arguments: [
|
|
323
|
-
(0, util_1.obj)(tx, args.version),
|
|
324
|
-
(0, util_1.obj)(tx, args.registry),
|
|
325
|
-
(0, util_1.pure)(tx, args.index, "u64"),
|
|
326
|
-
(0, util_1.obj)(tx, args.scallopVersion),
|
|
327
|
-
(0, util_1.obj)(tx, args.scallopMarket),
|
|
328
|
-
(0, util_1.obj)(tx, args.clock),
|
|
329
|
-
(0, util_1.pure)(tx, args.lendingAmount, "".concat(structs_1.Option.$typeName, "<u64>")),
|
|
330
|
-
],
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
349
|
function managerFlashRemoveLiquidity(tx, typeArg, args, published_at) {
|
|
334
350
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
335
351
|
return tx.moveCall({
|
|
@@ -361,20 +377,12 @@ function managerFlashRepayLiquidity(tx, typeArg, args, published_at) {
|
|
|
361
377
|
],
|
|
362
378
|
});
|
|
363
379
|
}
|
|
364
|
-
function
|
|
380
|
+
function managerHotfixBurnLp(tx, typeArg, args, published_at) {
|
|
365
381
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
366
382
|
return tx.moveCall({
|
|
367
|
-
target: "".concat(published_at, "::lp_pool::
|
|
383
|
+
target: "".concat(published_at, "::lp_pool::manager_hotfix_burn_lp"),
|
|
368
384
|
typeArguments: [typeArg],
|
|
369
|
-
arguments: [
|
|
370
|
-
(0, util_1.obj)(tx, args.version),
|
|
371
|
-
(0, util_1.obj)(tx, args.registry),
|
|
372
|
-
(0, util_1.pure)(tx, args.index, "u64"),
|
|
373
|
-
(0, util_1.obj)(tx, args.scallopVersion),
|
|
374
|
-
(0, util_1.obj)(tx, args.scallopMarket),
|
|
375
|
-
(0, util_1.obj)(tx, args.clock),
|
|
376
|
-
(0, util_1.pure)(tx, args.withdrawAmount, "".concat(structs_1.Option.$typeName, "<u64>")),
|
|
377
|
-
],
|
|
385
|
+
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.oracle), (0, util_1.obj)(tx, args.clock)],
|
|
378
386
|
});
|
|
379
387
|
}
|
|
380
388
|
function mintLp(tx, typeArgs, args, published_at) {
|
|
@@ -398,7 +406,12 @@ function newLiquidityPool(tx, typeArg, args, published_at) {
|
|
|
398
406
|
return tx.moveCall({
|
|
399
407
|
target: "".concat(published_at, "::lp_pool::new_liquidity_pool"),
|
|
400
408
|
typeArguments: [typeArg],
|
|
401
|
-
arguments: [
|
|
409
|
+
arguments: [
|
|
410
|
+
(0, util_1.obj)(tx, args.version),
|
|
411
|
+
(0, util_1.obj)(tx, args.registry),
|
|
412
|
+
(0, util_1.pure)(tx, args.lpTokenDecimal, "u64"),
|
|
413
|
+
(0, util_1.pure)(tx, args.unlockCountdownTsMs, "u64"),
|
|
414
|
+
],
|
|
402
415
|
});
|
|
403
416
|
}
|
|
404
417
|
function oracleMatched(tx, args, published_at) {
|
|
@@ -441,6 +454,14 @@ function putReceiptCollaterals(tx, args, published_at) {
|
|
|
441
454
|
arguments: [(0, util_1.obj)(tx, args.liquidityPool), (0, util_1.vector)(tx, "".concat(structs_2.UnsettledBidReceipt.$typeName), args.unsettledBidReceipts)],
|
|
442
455
|
});
|
|
443
456
|
}
|
|
457
|
+
function redeem(tx, typeArg, args, published_at) {
|
|
458
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
459
|
+
return tx.moveCall({
|
|
460
|
+
target: "".concat(published_at, "::lp_pool::redeem"),
|
|
461
|
+
typeArguments: [typeArg],
|
|
462
|
+
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.balance), (0, util_1.obj)(tx, args.clock)],
|
|
463
|
+
});
|
|
464
|
+
}
|
|
444
465
|
function requestCollateral(tx, typeArg, args, published_at) {
|
|
445
466
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
446
467
|
return tx.moveCall({
|
|
@@ -603,6 +624,13 @@ function updateTvl(tx, args, published_at) {
|
|
|
603
624
|
arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.liquidityPool), (0, util_1.obj)(tx, args.tokenType), (0, util_1.obj)(tx, args.oracle), (0, util_1.obj)(tx, args.clock)],
|
|
604
625
|
});
|
|
605
626
|
}
|
|
627
|
+
function updateUnlockCountdownTsMs(tx, args, published_at) {
|
|
628
|
+
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
629
|
+
return tx.moveCall({
|
|
630
|
+
target: "".concat(published_at, "::lp_pool::update_unlock_countdown_ts_ms"),
|
|
631
|
+
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.pure)(tx, args.unlockCountdownTsMs, "u64")],
|
|
632
|
+
});
|
|
633
|
+
}
|
|
606
634
|
function viewSwapResult(tx, typeArgs, args, published_at) {
|
|
607
635
|
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
608
636
|
return tx.moveCall({
|
|
@@ -619,18 +647,3 @@ function viewSwapResult(tx, typeArgs, args, published_at) {
|
|
|
619
647
|
],
|
|
620
648
|
});
|
|
621
649
|
}
|
|
622
|
-
function withdrawScallopBasic(tx, typeArg, args, published_at) {
|
|
623
|
-
if (published_at === void 0) { published_at = __1.PUBLISHED_AT; }
|
|
624
|
-
return tx.moveCall({
|
|
625
|
-
target: "".concat(published_at, "::lp_pool::withdraw_scallop_basic"),
|
|
626
|
-
typeArguments: [typeArg],
|
|
627
|
-
arguments: [
|
|
628
|
-
(0, util_1.obj)(tx, args.version),
|
|
629
|
-
(0, util_1.obj)(tx, args.liquidityPool),
|
|
630
|
-
(0, util_1.obj)(tx, args.scallopVersion),
|
|
631
|
-
(0, util_1.obj)(tx, args.scallopMarket),
|
|
632
|
-
(0, util_1.obj)(tx, args.clock),
|
|
633
|
-
(0, util_1.pure)(tx, args.withdrawAmount, "u64"),
|
|
634
|
-
],
|
|
635
|
-
});
|
|
636
|
-
}
|