@typus/typus-perp-sdk 1.0.5 → 1.0.6
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 +2 -2
- package/dist/src/fetch.js +30 -19
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.js +12 -2
- package/dist/src/typus_perp/index.js +1 -1
- package/dist/src/typus_perp/position/functions.d.ts +1 -1
- package/dist/src/typus_perp/position/functions.js +4 -1
- package/dist/src/typus_perp/tlp/structs.d.ts +1 -1
- package/dist/src/typus_perp/trading/functions.d.ts +13 -13
- package/dist/src/typus_perp/trading/functions.js +19 -19
- package/dist/src/user/history.js +24 -7
- package/dist/src/user/order.d.ts +1 -0
- package/dist/src/user/order.js +33 -19
- package/dist/src/user/orderWithBidReceipt.js +6 -6
- package/dist/src/user/tlp.js +25 -25
- package/package.json +1 -1
package/dist/src/fetch.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare function getUserOrders(config: TypusConfig, user: string): Promis
|
|
|
17
17
|
export declare function getUserPositions(config: TypusConfig, user: string): Promise<Position[]>;
|
|
18
18
|
export declare function parseOptionBidReceipts(positions: Position[]): (TypusBidReceipt | null)[];
|
|
19
19
|
export declare function getUserStake(config: TypusConfig, user: string): Promise<LpUserShare[]>;
|
|
20
|
-
export declare function
|
|
20
|
+
export declare function getLiquidationPriceAndPnl(config: TypusConfig, pythClient: PythClient, input: {
|
|
21
21
|
positions: Position[];
|
|
22
22
|
user: string;
|
|
23
|
-
}): Promise<string[] | undefined>;
|
|
23
|
+
}): Promise<(string | number)[][] | undefined>;
|
package/dist/src/fetch.js
CHANGED
|
@@ -54,7 +54,7 @@ exports.getUserOrders = getUserOrders;
|
|
|
54
54
|
exports.getUserPositions = getUserPositions;
|
|
55
55
|
exports.parseOptionBidReceipts = parseOptionBidReceipts;
|
|
56
56
|
exports.getUserStake = getUserStake;
|
|
57
|
-
exports.
|
|
57
|
+
exports.getLiquidationPriceAndPnl = getLiquidationPriceAndPnl;
|
|
58
58
|
var client_1 = require("@mysten/sui/client");
|
|
59
59
|
var transactions_1 = require("@mysten/sui/transactions");
|
|
60
60
|
var bcs_1 = require("@mysten/bcs");
|
|
@@ -78,7 +78,7 @@ function getLpPools(config) {
|
|
|
78
78
|
case 0:
|
|
79
79
|
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
80
80
|
return [4 /*yield*/, provider.getDynamicFields({
|
|
81
|
-
parentId:
|
|
81
|
+
parentId: _1.LIQUIDITY_POOL,
|
|
82
82
|
})];
|
|
83
83
|
case 1:
|
|
84
84
|
dynamicFields = _d.sent();
|
|
@@ -125,7 +125,7 @@ function getStakePools(config) {
|
|
|
125
125
|
case 0:
|
|
126
126
|
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
127
127
|
return [4 /*yield*/, provider.getDynamicFields({
|
|
128
|
-
parentId:
|
|
128
|
+
parentId: _1.STAKE_POOL,
|
|
129
129
|
})];
|
|
130
130
|
case 1:
|
|
131
131
|
dynamicFields = _d.sent();
|
|
@@ -173,7 +173,7 @@ function getMarkets(config, input) {
|
|
|
173
173
|
transaction = new transactions_1.Transaction();
|
|
174
174
|
transaction.moveCall({
|
|
175
175
|
target: "".concat(typus_perp_1.PUBLISHED_AT, "::trading::get_markets_bcs"),
|
|
176
|
-
arguments: [transaction.object(
|
|
176
|
+
arguments: [transaction.object(_1.MARKET), transaction.pure.vector("u64", input.indexes)],
|
|
177
177
|
});
|
|
178
178
|
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
|
|
179
179
|
case 1:
|
|
@@ -204,7 +204,7 @@ function getMarkets(config, input) {
|
|
|
204
204
|
}
|
|
205
205
|
// export async function getMarkets(config: TypusConfig): Promise<Markets[]> {
|
|
206
206
|
// let provider = new SuiClient({ url: config.rpcEndpoint });
|
|
207
|
-
// // const marketRegistry = await MarketRegistry.fetch(provider,
|
|
207
|
+
// // const marketRegistry = await MarketRegistry.fetch(provider, MARKET);
|
|
208
208
|
// // console.log(marketRegistry.markets.vid);
|
|
209
209
|
// let dynamicFields = await provider.getDynamicFields({
|
|
210
210
|
// // @ts-ignore
|
|
@@ -242,8 +242,8 @@ function getUserOrders(config, user) {
|
|
|
242
242
|
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
243
243
|
tx = new transactions_1.Transaction();
|
|
244
244
|
(0, functions_1.getUserOrders)(tx, {
|
|
245
|
-
version:
|
|
246
|
-
registry:
|
|
245
|
+
version: _1.PERP_VERSION,
|
|
246
|
+
registry: _1.MARKET,
|
|
247
247
|
marketIndex: BigInt(0),
|
|
248
248
|
user: user,
|
|
249
249
|
});
|
|
@@ -275,8 +275,8 @@ function getUserPositions(config, user) {
|
|
|
275
275
|
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
276
276
|
tx = new transactions_1.Transaction();
|
|
277
277
|
(0, functions_1.getUserPositions)(tx, {
|
|
278
|
-
version:
|
|
279
|
-
registry:
|
|
278
|
+
version: _1.PERP_VERSION,
|
|
279
|
+
registry: _1.MARKET,
|
|
280
280
|
marketIndex: BigInt(0),
|
|
281
281
|
user: user,
|
|
282
282
|
});
|
|
@@ -320,7 +320,7 @@ function getUserStake(config, user) {
|
|
|
320
320
|
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
321
321
|
tx = new transactions_1.Transaction();
|
|
322
322
|
(0, functions_2.getUserShares)(tx, {
|
|
323
|
-
registry:
|
|
323
|
+
registry: _1.STAKE_POOL,
|
|
324
324
|
index: BigInt(0),
|
|
325
325
|
user: user,
|
|
326
326
|
});
|
|
@@ -352,9 +352,10 @@ function getUserStake(config, user) {
|
|
|
352
352
|
});
|
|
353
353
|
});
|
|
354
354
|
}
|
|
355
|
-
|
|
355
|
+
/// returns [liquidationPrice, pnl(in USD)]
|
|
356
|
+
function getLiquidationPriceAndPnl(config, pythClient, input) {
|
|
356
357
|
return __awaiter(this, void 0, void 0, function () {
|
|
357
|
-
var provider, tx, pythTokens, _a, _b, position, TOKEN, BASE_TOKEN, _c, _d, position, TOKEN, BASE_TOKEN, res,
|
|
358
|
+
var provider, tx, pythTokens, _a, _b, position, TOKEN, BASE_TOKEN, _c, _d, position, TOKEN, BASE_TOKEN, res, results;
|
|
358
359
|
var e_3, _e, e_4, _f;
|
|
359
360
|
var _g;
|
|
360
361
|
return __generator(this, function (_h) {
|
|
@@ -387,10 +388,10 @@ function getLiquidationPrice(config, pythClient, input) {
|
|
|
387
388
|
position = _d.value;
|
|
388
389
|
TOKEN = (0, constants_1.typeArgToToken)(position.collateralToken.name);
|
|
389
390
|
BASE_TOKEN = (0, constants_1.typeArgToToken)(position.symbol.baseToken.name);
|
|
390
|
-
(0, functions_1.
|
|
391
|
-
version:
|
|
392
|
-
registry:
|
|
393
|
-
poolRegistry:
|
|
391
|
+
(0, functions_1.getEstimatedLiquidationPriceAndPnl)(tx, [position.collateralToken.name, position.symbol.baseToken.name], {
|
|
392
|
+
version: _1.PERP_VERSION,
|
|
393
|
+
registry: _1.MARKET,
|
|
394
|
+
poolRegistry: _1.LP_POOL,
|
|
394
395
|
marketIndex: BigInt(0),
|
|
395
396
|
poolIndex: BigInt(0),
|
|
396
397
|
pythState: utils_1.pythStateId[_1.NETWORK],
|
|
@@ -411,9 +412,19 @@ function getLiquidationPrice(config, pythClient, input) {
|
|
|
411
412
|
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: input.user, transactionBlock: tx })];
|
|
412
413
|
case 2:
|
|
413
414
|
res = _h.sent();
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
415
|
+
results = (_g = res.results) === null || _g === void 0 ? void 0 : _g.slice(-input.positions.length).map(function (x) {
|
|
416
|
+
// console.log(x);
|
|
417
|
+
var liquidationPrice = bcs_1.bcs.u64().parse(Uint8Array.from(x.returnValues[0][0]));
|
|
418
|
+
var isProfit = bcs_1.bcs.bool().parse(Uint8Array.from(x.returnValues[1][0]));
|
|
419
|
+
var pnl = Number(bcs_1.bcs.u64().parse(Uint8Array.from(x.returnValues[2][0])));
|
|
420
|
+
pnl = isProfit ? pnl : -pnl;
|
|
421
|
+
var isCost = bcs_1.bcs.bool().parse(Uint8Array.from(x.returnValues[3][0]));
|
|
422
|
+
var cost = Number(bcs_1.bcs.u64().parse(Uint8Array.from(x.returnValues[4][0])));
|
|
423
|
+
cost = isCost ? cost : -cost;
|
|
424
|
+
return [liquidationPrice, pnl - cost];
|
|
425
|
+
});
|
|
426
|
+
// console.log(results);
|
|
427
|
+
return [2 /*return*/, results];
|
|
417
428
|
}
|
|
418
429
|
});
|
|
419
430
|
});
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
export * from "./fetch";
|
|
2
2
|
export * from "./user";
|
|
3
3
|
export declare const NETWORK: string;
|
|
4
|
+
export declare const LP_POOL: string;
|
|
5
|
+
export declare const LIQUIDITY_POOL: string;
|
|
6
|
+
export declare const MARKET: string;
|
|
7
|
+
export declare const TLP: string;
|
|
8
|
+
export declare const TLP_TOKEN: string;
|
|
9
|
+
export declare const TLP_TREASURY_CAP: string;
|
|
10
|
+
export declare const STAKE_POOL: string;
|
|
11
|
+
export declare const PERP_VERSION: string;
|
|
12
|
+
export declare const STAKE_POOL_VERSION: string;
|
package/dist/src/index.js
CHANGED
|
@@ -17,11 +17,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.NETWORK = void 0;
|
|
20
|
+
exports.STAKE_POOL_VERSION = exports.PERP_VERSION = exports.STAKE_POOL = exports.TLP_TREASURY_CAP = exports.TLP_TOKEN = exports.TLP = exports.MARKET = exports.LIQUIDITY_POOL = exports.LP_POOL = exports.NETWORK = void 0;
|
|
21
21
|
__exportStar(require("./fetch"), exports);
|
|
22
22
|
__exportStar(require("./user"), exports);
|
|
23
23
|
var dotenv_1 = __importDefault(require("dotenv"));
|
|
24
24
|
// import .env file if exists
|
|
25
25
|
dotenv_1.default.config();
|
|
26
|
-
exports.NETWORK = process.env.
|
|
26
|
+
exports.NETWORK = process.env.NEXT_PUBLIC_CLUSTER == "mainnet" ? "MAINNET" : "TESTNET";
|
|
27
|
+
console.log("Load .env NEXT_PUBLIC_CLUSTER: ".concat(process.env.NEXT_PUBLIC_CLUSTER));
|
|
27
28
|
console.log("Initializing Typus Perp SDK for ".concat(exports.NETWORK));
|
|
29
|
+
exports.LP_POOL = exports.NETWORK == "MAINNET" ? "" : "0xf85bb9b6bbe877e43e9a79f9c59d57331884f7519825f1116d8634806cd167e1";
|
|
30
|
+
exports.LIQUIDITY_POOL = exports.NETWORK == "MAINNET" ? "" : "0x93bc498e59e97c93820c14687a9a340bc794eada7f7ce0f458bb25190bdd395e";
|
|
31
|
+
exports.MARKET = exports.NETWORK == "MAINNET" ? "" : "0xb73983f279effad13b455846c192a2eb402ed453f84a1e627c9e34cfd329bf92";
|
|
32
|
+
exports.TLP = exports.NETWORK == "MAINNET" ? "" : "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509";
|
|
33
|
+
exports.TLP_TOKEN = exports.NETWORK == "MAINNET" ? "" : "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509::tlp::TLP";
|
|
34
|
+
exports.TLP_TREASURY_CAP = exports.NETWORK == "MAINNET" ? "" : "0x7d9c6f9dfceb4788c21388f77e4ccf83e1b3f10282ae272b379402e92c97bbf6";
|
|
35
|
+
exports.STAKE_POOL = exports.NETWORK == "MAINNET" ? "" : "0x27efed0157eea40aa1a8483622edeb48ca8c3fa3073f9e662503280a22a4e51b";
|
|
36
|
+
exports.PERP_VERSION = exports.NETWORK == "MAINNET" ? "" : "0xa3066f440d0e2fa74b1c98e55c316ce63b208be87b018b089bf39d5dd11e8dfd";
|
|
37
|
+
exports.STAKE_POOL_VERSION = exports.NETWORK == "MAINNET" ? "" : "0x25868624d2254a14eb513ae2b276fb56ca355ffd6cdd8ee05c5a51620f3f1bf3";
|
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PKG_V1 = exports.PUBLISHED_AT = exports.PACKAGE_ID = void 0;
|
|
4
4
|
var index_1 = require("../index");
|
|
5
5
|
exports.PACKAGE_ID = index_1.NETWORK == "MAINNET" ? "" : "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509";
|
|
6
|
-
exports.PUBLISHED_AT = index_1.NETWORK == "MAINNET" ? "" : "
|
|
6
|
+
exports.PUBLISHED_AT = index_1.NETWORK == "MAINNET" ? "" : "0x002be1fdabc2d7e0de0244d55cc967a2a9bbd19e8fb7e9e97c6118576d2ce767";
|
|
7
7
|
exports.PKG_V1 = index_1.NETWORK == "MAINNET" ? "" : "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509";
|
|
@@ -73,6 +73,7 @@ export interface CalculateTradingFeeArgs {
|
|
|
73
73
|
collateralTokenDecimal: bigint | TransactionArgument;
|
|
74
74
|
}
|
|
75
75
|
export declare function calculateTradingFee(tx: Transaction, args: CalculateTradingFeeArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
76
|
+
export declare function calculateUnrealizedCost(tx: Transaction, position: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
|
|
76
77
|
export interface CalculateUnrealizedPnlArgs {
|
|
77
78
|
position: TransactionObjectInput;
|
|
78
79
|
tradingPairOraclePrice: bigint | TransactionArgument;
|
|
@@ -178,7 +179,6 @@ export interface GetEstimatedLiquidationPriceArgs {
|
|
|
178
179
|
tradingPairOraclePrice: bigint | TransactionArgument;
|
|
179
180
|
tradingPairOraclePriceDecimal: bigint | TransactionArgument;
|
|
180
181
|
tradingFeeMbp: bigint | TransactionArgument;
|
|
181
|
-
cumulativeBorrowRate: bigint | TransactionArgument;
|
|
182
182
|
}
|
|
183
183
|
export declare function getEstimatedLiquidationPrice(tx: Transaction, args: GetEstimatedLiquidationPriceArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
184
184
|
export declare function getMaxOrderTypeTag(tx: Transaction): import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -8,6 +8,7 @@ exports.calculateIntrinsicValue = calculateIntrinsicValue;
|
|
|
8
8
|
exports.calculatePositionFundingRate = calculatePositionFundingRate;
|
|
9
9
|
exports.calculateRealizedPnlUsd = calculateRealizedPnlUsd;
|
|
10
10
|
exports.calculateTradingFee = calculateTradingFee;
|
|
11
|
+
exports.calculateUnrealizedCost = calculateUnrealizedCost;
|
|
11
12
|
exports.calculateUnrealizedPnl = calculateUnrealizedPnl;
|
|
12
13
|
exports.checkOptionCollateralPositionLiquidated = checkOptionCollateralPositionLiquidated;
|
|
13
14
|
exports.checkOrderFilled = checkOrderFilled;
|
|
@@ -169,6 +170,9 @@ function calculateTradingFee(tx, args) {
|
|
|
169
170
|
],
|
|
170
171
|
});
|
|
171
172
|
}
|
|
173
|
+
function calculateUnrealizedCost(tx, position) {
|
|
174
|
+
return tx.moveCall({ target: "".concat(__1.PUBLISHED_AT, "::position::calculate_unrealized_cost"), arguments: [(0, util_1.obj)(tx, position)] });
|
|
175
|
+
}
|
|
172
176
|
function calculateUnrealizedPnl(tx, args) {
|
|
173
177
|
return tx.moveCall({
|
|
174
178
|
target: "".concat(__1.PUBLISHED_AT, "::position::calculate_unrealized_pnl"),
|
|
@@ -308,7 +312,6 @@ function getEstimatedLiquidationPrice(tx, args) {
|
|
|
308
312
|
(0, util_1.pure)(tx, args.tradingPairOraclePrice, "u64"),
|
|
309
313
|
(0, util_1.pure)(tx, args.tradingPairOraclePriceDecimal, "u64"),
|
|
310
314
|
(0, util_1.pure)(tx, args.tradingFeeMbp, "u64"),
|
|
311
|
-
(0, util_1.pure)(tx, args.cumulativeBorrowRate, "u64"),
|
|
312
315
|
],
|
|
313
316
|
});
|
|
314
317
|
}
|
|
@@ -72,7 +72,7 @@ export declare class TLP implements StructClass {
|
|
|
72
72
|
static reified(): TLPReified;
|
|
73
73
|
static get r(): import("../../_framework/reified").StructClassReified<TLP, TLPFields>;
|
|
74
74
|
static phantom(): PhantomReified<ToTypeStr<TLP>>;
|
|
75
|
-
static get p(): PhantomReified<"::tlp::TLP" | "
|
|
75
|
+
static get p(): PhantomReified<"0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509::tlp::TLP" | "::tlp::TLP">;
|
|
76
76
|
static get bcs(): import("@mysten/sui/bcs").BcsType<{
|
|
77
77
|
dummy_field: boolean;
|
|
78
78
|
}, {
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import { Transaction, TransactionArgument, TransactionObjectInput } from "@mysten/sui/transactions";
|
|
2
2
|
export declare function init(tx: Transaction): import("@mysten/sui/transactions").TransactionResult;
|
|
3
|
-
export interface GetEstimatedLiquidationPriceArgs {
|
|
4
|
-
version: TransactionObjectInput;
|
|
5
|
-
registry: TransactionObjectInput;
|
|
6
|
-
poolRegistry: TransactionObjectInput;
|
|
7
|
-
marketIndex: bigint | TransactionArgument;
|
|
8
|
-
poolIndex: bigint | TransactionArgument;
|
|
9
|
-
pythState: TransactionObjectInput;
|
|
10
|
-
oracleCToken: TransactionObjectInput;
|
|
11
|
-
oracleTradingSymbol: TransactionObjectInput;
|
|
12
|
-
clock: TransactionObjectInput;
|
|
13
|
-
positionId: bigint | TransactionArgument;
|
|
14
|
-
}
|
|
15
|
-
export declare function getEstimatedLiquidationPrice(tx: Transaction, typeArgs: [string, string], args: GetEstimatedLiquidationPriceArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
16
3
|
export interface IncreaseCollateralArgs {
|
|
17
4
|
version: TransactionObjectInput;
|
|
18
5
|
registry: TransactionObjectInput;
|
|
@@ -232,6 +219,19 @@ export interface GetActiveOrdersByOrderTagAndCtokenArgs {
|
|
|
232
219
|
orderTypeTag: number | TransactionArgument;
|
|
233
220
|
}
|
|
234
221
|
export declare function getActiveOrdersByOrderTagAndCtoken(tx: Transaction, typeArgs: [string, string], args: GetActiveOrdersByOrderTagAndCtokenArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
222
|
+
export interface GetEstimatedLiquidationPriceAndPnlArgs {
|
|
223
|
+
version: TransactionObjectInput;
|
|
224
|
+
registry: TransactionObjectInput;
|
|
225
|
+
poolRegistry: TransactionObjectInput;
|
|
226
|
+
marketIndex: bigint | TransactionArgument;
|
|
227
|
+
poolIndex: bigint | TransactionArgument;
|
|
228
|
+
pythState: TransactionObjectInput;
|
|
229
|
+
oracleCToken: TransactionObjectInput;
|
|
230
|
+
oracleTradingSymbol: TransactionObjectInput;
|
|
231
|
+
clock: TransactionObjectInput;
|
|
232
|
+
positionId: bigint | TransactionArgument;
|
|
233
|
+
}
|
|
234
|
+
export declare function getEstimatedLiquidationPriceAndPnl(tx: Transaction, typeArgs: [string, string], args: GetEstimatedLiquidationPriceAndPnlArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
235
235
|
export interface GetExpiredPositionInfoArgs {
|
|
236
236
|
version: TransactionObjectInput;
|
|
237
237
|
registry: TransactionObjectInput;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.init = init;
|
|
4
|
-
exports.getEstimatedLiquidationPrice = getEstimatedLiquidationPrice;
|
|
5
4
|
exports.increaseCollateral = increaseCollateral;
|
|
6
5
|
exports.releaseCollateral = releaseCollateral;
|
|
7
6
|
exports.addTradingSymbol = addTradingSymbol;
|
|
@@ -20,6 +19,7 @@ exports.executeOrder_ = executeOrder_;
|
|
|
20
19
|
exports.exerciseBidReceipts = exerciseBidReceipts;
|
|
21
20
|
exports.getActiveOrdersByOrderTag = getActiveOrdersByOrderTag;
|
|
22
21
|
exports.getActiveOrdersByOrderTagAndCtoken = getActiveOrdersByOrderTagAndCtoken;
|
|
22
|
+
exports.getEstimatedLiquidationPriceAndPnl = getEstimatedLiquidationPriceAndPnl;
|
|
23
23
|
exports.getExpiredPositionInfo = getExpiredPositionInfo;
|
|
24
24
|
exports.getLinkedPosition = getLinkedPosition;
|
|
25
25
|
exports.getLiquidationInfo = getLiquidationInfo;
|
|
@@ -58,24 +58,6 @@ var util_1 = require("../../_framework/util");
|
|
|
58
58
|
function init(tx) {
|
|
59
59
|
return tx.moveCall({ target: "".concat(__1.PUBLISHED_AT, "::trading::init"), arguments: [] });
|
|
60
60
|
}
|
|
61
|
-
function getEstimatedLiquidationPrice(tx, typeArgs, args) {
|
|
62
|
-
return tx.moveCall({
|
|
63
|
-
target: "".concat(__1.PUBLISHED_AT, "::trading::get_estimated_liquidation_price"),
|
|
64
|
-
typeArguments: typeArgs,
|
|
65
|
-
arguments: [
|
|
66
|
-
(0, util_1.obj)(tx, args.version),
|
|
67
|
-
(0, util_1.obj)(tx, args.registry),
|
|
68
|
-
(0, util_1.obj)(tx, args.poolRegistry),
|
|
69
|
-
(0, util_1.pure)(tx, args.marketIndex, "u64"),
|
|
70
|
-
(0, util_1.pure)(tx, args.poolIndex, "u64"),
|
|
71
|
-
(0, util_1.obj)(tx, args.pythState),
|
|
72
|
-
(0, util_1.obj)(tx, args.oracleCToken),
|
|
73
|
-
(0, util_1.obj)(tx, args.oracleTradingSymbol),
|
|
74
|
-
(0, util_1.obj)(tx, args.clock),
|
|
75
|
-
(0, util_1.pure)(tx, args.positionId, "u64"),
|
|
76
|
-
],
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
61
|
function increaseCollateral(tx, typeArgs, args) {
|
|
80
62
|
return tx.moveCall({
|
|
81
63
|
target: "".concat(__1.PUBLISHED_AT, "::trading::increase_collateral"),
|
|
@@ -369,6 +351,24 @@ function getActiveOrdersByOrderTagAndCtoken(tx, typeArgs, args) {
|
|
|
369
351
|
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")],
|
|
370
352
|
});
|
|
371
353
|
}
|
|
354
|
+
function getEstimatedLiquidationPriceAndPnl(tx, typeArgs, args) {
|
|
355
|
+
return tx.moveCall({
|
|
356
|
+
target: "".concat(__1.PUBLISHED_AT, "::trading::get_estimated_liquidation_price_and_pnl"),
|
|
357
|
+
typeArguments: typeArgs,
|
|
358
|
+
arguments: [
|
|
359
|
+
(0, util_1.obj)(tx, args.version),
|
|
360
|
+
(0, util_1.obj)(tx, args.registry),
|
|
361
|
+
(0, util_1.obj)(tx, args.poolRegistry),
|
|
362
|
+
(0, util_1.pure)(tx, args.marketIndex, "u64"),
|
|
363
|
+
(0, util_1.pure)(tx, args.poolIndex, "u64"),
|
|
364
|
+
(0, util_1.obj)(tx, args.pythState),
|
|
365
|
+
(0, util_1.obj)(tx, args.oracleCToken),
|
|
366
|
+
(0, util_1.obj)(tx, args.oracleTradingSymbol),
|
|
367
|
+
(0, util_1.obj)(tx, args.clock),
|
|
368
|
+
(0, util_1.pure)(tx, args.positionId, "u64"),
|
|
369
|
+
],
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
372
|
function getExpiredPositionInfo(tx, args) {
|
|
373
373
|
return tx.moveCall({
|
|
374
374
|
target: "".concat(__1.PUBLISHED_AT, "::trading::get_expired_position_info"),
|
package/dist/src/user/history.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -55,7 +66,7 @@ function getUserHistory(sender) {
|
|
|
55
66
|
console.log(pageInfo);
|
|
56
67
|
events = [];
|
|
57
68
|
raw_events.nodes.forEach(function (event) {
|
|
58
|
-
var _a;
|
|
69
|
+
var _a, _b;
|
|
59
70
|
var type = event.contents.type.repr;
|
|
60
71
|
if (type.endsWith("PythPrice")) {
|
|
61
72
|
return;
|
|
@@ -64,6 +75,7 @@ function getUserHistory(sender) {
|
|
|
64
75
|
var timestamp = event.timestamp;
|
|
65
76
|
var tx_digest = event.transactionBlock.digest;
|
|
66
77
|
// console.log(type);
|
|
78
|
+
// console.log(tx_digest);
|
|
67
79
|
// console.log(json);
|
|
68
80
|
// console.log(timestamp);
|
|
69
81
|
switch (type) {
|
|
@@ -128,8 +140,10 @@ function getUserHistory(sender) {
|
|
|
128
140
|
action = "Order Filled (Open Position)";
|
|
129
141
|
related = events.findLast(function (e) { return e.order_id === json.order_id && e.market === market; });
|
|
130
142
|
}
|
|
131
|
-
|
|
143
|
+
var realized_trading_fee = Number(json.realized_trading_fee) + Number(json.realized_borrow_fee);
|
|
132
144
|
var realized_fee_in_usd = Number(json.realized_fee_in_usd) / Math.pow(10, 9);
|
|
145
|
+
var realized_amount = json.realized_amount_sign ? Number(json.realized_amount) : -Number(json.realized_amount);
|
|
146
|
+
var realized_pnl = ((realized_amount - realized_trading_fee) * realized_fee_in_usd) / realized_trading_fee;
|
|
133
147
|
var e = {
|
|
134
148
|
action: action,
|
|
135
149
|
order_id: json.order_id,
|
|
@@ -143,7 +157,7 @@ function getUserHistory(sender) {
|
|
|
143
157
|
collateral: related === null || related === void 0 ? void 0 : related.collateral,
|
|
144
158
|
collateral_token: collateral_token,
|
|
145
159
|
price: Number(price) / Math.pow(10, 8), // WARNING: fixed decimal
|
|
146
|
-
realized_pnl:
|
|
160
|
+
realized_pnl: realized_pnl,
|
|
147
161
|
timestamp: timestamp,
|
|
148
162
|
tx_digest: tx_digest,
|
|
149
163
|
};
|
|
@@ -151,11 +165,14 @@ function getUserHistory(sender) {
|
|
|
151
165
|
break;
|
|
152
166
|
case structs_1.RealizeFundingEvent.$typeName:
|
|
153
167
|
// same tx with order filled
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
168
|
+
var index = events.findLastIndex(function (e) { return e.tx_digest == tx_digest; });
|
|
169
|
+
// console.log(index);
|
|
170
|
+
if (index !== -1) {
|
|
171
|
+
// true => user paid to pool
|
|
172
|
+
var x = json.realized_funding_sign ? json.realized_funding_fee_usd / Math.pow(10, 9) : -json.realized_funding_fee_usd / Math.pow(10, 9);
|
|
173
|
+
events[index] = __assign(__assign({}, events[index]), { realized_pnl: ((_b = events[index].realized_pnl) !== null && _b !== void 0 ? _b : 0) - x });
|
|
158
174
|
}
|
|
175
|
+
break;
|
|
159
176
|
case structs_2.CancelTradingOrderEvent.$typeName:
|
|
160
177
|
var base_token = (0, constants_1.typeArgToToken)(json.base_token.name);
|
|
161
178
|
var collateral_token = (0, constants_1.typeArgToToken)(json.collateral_token.name);
|
package/dist/src/user/order.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare function createTradingOrder(config: TypusConfig, tx: Transaction,
|
|
|
14
14
|
reduceOnly: boolean;
|
|
15
15
|
linkedPositionId: string | null;
|
|
16
16
|
}): Promise<Transaction>;
|
|
17
|
+
export declare function zeroCoin(tx: Transaction, typeArgs: [string]): import("@mysten/sui/transactions").TransactionResult;
|
|
17
18
|
export declare function cancelTradingOrder(config: TypusConfig, tx: Transaction, input: {
|
|
18
19
|
order: TradingOrder;
|
|
19
20
|
user: string;
|
package/dist/src/user/order.js
CHANGED
|
@@ -53,6 +53,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
53
53
|
};
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
55
|
exports.createTradingOrder = createTradingOrder;
|
|
56
|
+
exports.zeroCoin = zeroCoin;
|
|
56
57
|
exports.cancelTradingOrder = cancelTradingOrder;
|
|
57
58
|
exports.increaseCollateral = increaseCollateral;
|
|
58
59
|
exports.releaseCollateral = releaseCollateral;
|
|
@@ -63,31 +64,37 @@ var constants_1 = require("@typus/typus-sdk/dist/src/constants");
|
|
|
63
64
|
function createTradingOrder(config, tx, pythClient, input) {
|
|
64
65
|
return __awaiter(this, void 0, void 0, function () {
|
|
65
66
|
var TOKEN, BASE_TOKEN, cToken, baseToken, coin, destination;
|
|
66
|
-
var _a, _b;
|
|
67
|
-
return __generator(this, function (
|
|
68
|
-
switch (
|
|
67
|
+
var _a, _b, _c;
|
|
68
|
+
return __generator(this, function (_d) {
|
|
69
|
+
switch (_d.label) {
|
|
69
70
|
case 0:
|
|
70
71
|
TOKEN = input.cToken;
|
|
71
72
|
BASE_TOKEN = input.tradingToken;
|
|
72
73
|
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, [TOKEN, BASE_TOKEN])];
|
|
73
74
|
case 1:
|
|
74
|
-
|
|
75
|
+
_d.sent();
|
|
75
76
|
cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
76
77
|
baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
77
78
|
if (TOKEN == "SUI") {
|
|
78
79
|
_a = __read(tx.splitCoins(tx.gas, [input.amount]), 1), coin = _a[0];
|
|
79
80
|
}
|
|
80
81
|
else {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
tx
|
|
82
|
+
if (input.coins.length == 0) {
|
|
83
|
+
// support zero coin input for closing position
|
|
84
|
+
_b = __read(zeroCoin(tx, [cToken]), 1), coin = _b[0];
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
destination = input.coins.pop();
|
|
88
|
+
if (input.coins.length > 0) {
|
|
89
|
+
tx.mergeCoins(destination, input.coins);
|
|
90
|
+
}
|
|
91
|
+
_c = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _c[0];
|
|
84
92
|
}
|
|
85
|
-
_b = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _b[0];
|
|
86
93
|
}
|
|
87
94
|
(0, functions_1.createTradingOrder)(tx, [cToken, baseToken], {
|
|
88
|
-
version:
|
|
89
|
-
registry:
|
|
90
|
-
poolRegistry:
|
|
95
|
+
version: __1.PERP_VERSION,
|
|
96
|
+
registry: __1.MARKET,
|
|
97
|
+
poolRegistry: __1.LP_POOL,
|
|
91
98
|
marketIndex: BigInt(0),
|
|
92
99
|
poolIndex: BigInt(0),
|
|
93
100
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
@@ -110,6 +117,13 @@ function createTradingOrder(config, tx, pythClient, input) {
|
|
|
110
117
|
});
|
|
111
118
|
});
|
|
112
119
|
}
|
|
120
|
+
function zeroCoin(tx, typeArgs) {
|
|
121
|
+
return tx.moveCall({
|
|
122
|
+
target: "0x2::coin::zero",
|
|
123
|
+
typeArguments: typeArgs,
|
|
124
|
+
arguments: [],
|
|
125
|
+
});
|
|
126
|
+
}
|
|
113
127
|
function cancelTradingOrder(config, tx, input) {
|
|
114
128
|
return __awaiter(this, void 0, void 0, function () {
|
|
115
129
|
var cToken, BASE_TOKEN, coin;
|
|
@@ -117,8 +131,8 @@ function cancelTradingOrder(config, tx, input) {
|
|
|
117
131
|
cToken = "0x" + input.order.collateralToken.name;
|
|
118
132
|
BASE_TOKEN = "0x" + input.order.symbol.baseToken.name;
|
|
119
133
|
coin = (0, functions_1.cancelTradingOrder)(tx, [cToken, BASE_TOKEN], {
|
|
120
|
-
version:
|
|
121
|
-
registry:
|
|
134
|
+
version: __1.PERP_VERSION,
|
|
135
|
+
registry: __1.MARKET,
|
|
122
136
|
marketIndex: BigInt(0),
|
|
123
137
|
orderId: input.order.orderId,
|
|
124
138
|
triggerPrice: input.order.triggerPrice,
|
|
@@ -157,9 +171,9 @@ function increaseCollateral(config, tx, pythClient, input) {
|
|
|
157
171
|
_b = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _b[0];
|
|
158
172
|
}
|
|
159
173
|
(0, functions_1.increaseCollateral)(tx, [cToken, baseToken], {
|
|
160
|
-
version:
|
|
161
|
-
registry:
|
|
162
|
-
poolRegistry:
|
|
174
|
+
version: __1.PERP_VERSION,
|
|
175
|
+
registry: __1.MARKET,
|
|
176
|
+
poolRegistry: __1.LP_POOL,
|
|
163
177
|
marketIndex: BigInt(0),
|
|
164
178
|
poolIndex: BigInt(0),
|
|
165
179
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
@@ -191,9 +205,9 @@ function releaseCollateral(config, tx, pythClient, input) {
|
|
|
191
205
|
cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
192
206
|
baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
193
207
|
coin = (0, functions_1.releaseCollateral)(tx, [cToken, baseToken], {
|
|
194
|
-
version:
|
|
195
|
-
registry:
|
|
196
|
-
poolRegistry:
|
|
208
|
+
version: __1.PERP_VERSION,
|
|
209
|
+
registry: __1.MARKET,
|
|
210
|
+
poolRegistry: __1.LP_POOL,
|
|
197
211
|
marketIndex: BigInt(0),
|
|
198
212
|
poolIndex: BigInt(0),
|
|
199
213
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
@@ -70,9 +70,9 @@ function createTradingOrderWithBidReceipt(config, tx, pythClient, input) {
|
|
|
70
70
|
collateralBidReceipt = input.bidReceipt;
|
|
71
71
|
}
|
|
72
72
|
(0, functions_1.createTradingOrderWithBidReceipt)(tx, [cToken, bToken, baseToken], {
|
|
73
|
-
version:
|
|
74
|
-
registry:
|
|
75
|
-
poolRegistry:
|
|
73
|
+
version: __1.PERP_VERSION,
|
|
74
|
+
registry: __1.MARKET,
|
|
75
|
+
poolRegistry: __1.LP_POOL,
|
|
76
76
|
marketIndex: BigInt(0),
|
|
77
77
|
poolIndex: BigInt(0),
|
|
78
78
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
@@ -109,9 +109,9 @@ function reduceOptionCollateralPositionSize(config, tx, pythClient, input) {
|
|
|
109
109
|
baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
110
110
|
(0, utils_1.updateOracleWithPyth)(pythClient, tx, config.package.oracle, config.oracle[BASE_TOKEN.toLocaleLowerCase()], BASE_TOKEN, "USDC");
|
|
111
111
|
(0, functions_1.reduceOptionCollateralPositionSize)(tx, [cToken, bToken, baseToken], {
|
|
112
|
-
version:
|
|
113
|
-
registry:
|
|
114
|
-
poolRegistry:
|
|
112
|
+
version: __1.PERP_VERSION,
|
|
113
|
+
registry: __1.MARKET,
|
|
114
|
+
poolRegistry: __1.LP_POOL,
|
|
115
115
|
marketIndex: BigInt(0),
|
|
116
116
|
poolIndex: BigInt(0),
|
|
117
117
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
package/dist/src/user/tlp.js
CHANGED
|
@@ -91,8 +91,8 @@ function mintStakeLp(config, tx, pythClient, input) {
|
|
|
91
91
|
for (tokens_1 = __values(tokens), tokens_1_1 = tokens_1.next(); !tokens_1_1.done; tokens_1_1 = tokens_1.next()) {
|
|
92
92
|
token = tokens_1_1.value;
|
|
93
93
|
(0, functions_1.updateLiquidityValue)(tx, constants_1.tokenType[__1.NETWORK][token], {
|
|
94
|
-
version:
|
|
95
|
-
registry:
|
|
94
|
+
version: __1.PERP_VERSION,
|
|
95
|
+
registry: __1.LP_POOL,
|
|
96
96
|
index: BigInt(0),
|
|
97
97
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
98
98
|
oracle: utils_1.priceInfoObjectIds[__1.NETWORK][token],
|
|
@@ -117,19 +117,19 @@ function mintStakeLp(config, tx, pythClient, input) {
|
|
|
117
117
|
}
|
|
118
118
|
_c = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _c[0];
|
|
119
119
|
}
|
|
120
|
-
lpCoin = (0, functions_1.mintLp)(tx, [cToken,
|
|
121
|
-
version:
|
|
122
|
-
registry:
|
|
123
|
-
treasuryCaps:
|
|
120
|
+
lpCoin = (0, functions_1.mintLp)(tx, [cToken, __1.TLP_TOKEN], {
|
|
121
|
+
version: __1.PERP_VERSION,
|
|
122
|
+
registry: __1.LP_POOL,
|
|
123
|
+
treasuryCaps: __1.TLP_TREASURY_CAP,
|
|
124
124
|
index: BigInt(0),
|
|
125
125
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
126
126
|
oracle: utils_1.priceInfoObjectIds[__1.NETWORK][input.cTOKEN],
|
|
127
127
|
coin: coin,
|
|
128
128
|
clock: constants_1.CLOCK,
|
|
129
129
|
});
|
|
130
|
-
(0, functions_2.stake)(tx,
|
|
131
|
-
version:
|
|
132
|
-
registry:
|
|
130
|
+
(0, functions_2.stake)(tx, __1.TLP_TOKEN, {
|
|
131
|
+
version: __1.STAKE_POOL_VERSION,
|
|
132
|
+
registry: __1.STAKE_POOL,
|
|
133
133
|
index: BigInt(0),
|
|
134
134
|
lpToken: lpCoin,
|
|
135
135
|
clock: constants_1.CLOCK,
|
|
@@ -157,8 +157,8 @@ function unstakeBurn(config, tx, pythClient, input) {
|
|
|
157
157
|
for (tokens_2 = __values(tokens), tokens_2_1 = tokens_2.next(); !tokens_2_1.done; tokens_2_1 = tokens_2.next()) {
|
|
158
158
|
token = tokens_2_1.value;
|
|
159
159
|
(0, functions_1.updateLiquidityValue)(tx, constants_1.tokenType[__1.NETWORK][token], {
|
|
160
|
-
version:
|
|
161
|
-
registry:
|
|
160
|
+
version: __1.PERP_VERSION,
|
|
161
|
+
registry: __1.LP_POOL,
|
|
162
162
|
index: BigInt(0),
|
|
163
163
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
164
164
|
oracle: utils_1.priceInfoObjectIds[__1.NETWORK][token],
|
|
@@ -173,18 +173,18 @@ function unstakeBurn(config, tx, pythClient, input) {
|
|
|
173
173
|
}
|
|
174
174
|
finally { if (e_2) throw e_2.error; }
|
|
175
175
|
}
|
|
176
|
-
lpCoin = (0, functions_2.unstake)(tx,
|
|
177
|
-
version:
|
|
178
|
-
registry:
|
|
176
|
+
lpCoin = (0, functions_2.unstake)(tx, __1.TLP_TOKEN, {
|
|
177
|
+
version: __1.STAKE_POOL_VERSION,
|
|
178
|
+
registry: __1.STAKE_POOL,
|
|
179
179
|
index: BigInt(0),
|
|
180
180
|
userShareId: BigInt(input.userShareId),
|
|
181
181
|
clock: constants_1.CLOCK,
|
|
182
182
|
unstakedShares: input.share ? BigInt(input.share) : null,
|
|
183
183
|
});
|
|
184
|
-
coin = (0, functions_1.burnLp)(tx, [cToken,
|
|
185
|
-
version:
|
|
186
|
-
registry:
|
|
187
|
-
treasuryCaps:
|
|
184
|
+
coin = (0, functions_1.burnLp)(tx, [cToken, __1.TLP_TOKEN], {
|
|
185
|
+
version: __1.PERP_VERSION,
|
|
186
|
+
registry: __1.LP_POOL,
|
|
187
|
+
treasuryCaps: __1.TLP_TREASURY_CAP,
|
|
188
188
|
index: BigInt(0),
|
|
189
189
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
190
190
|
oracle: oracle,
|
|
@@ -219,8 +219,8 @@ function swap(config, tx, pythClient, input) {
|
|
|
219
219
|
_b = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _b[0];
|
|
220
220
|
}
|
|
221
221
|
token = (0, functions_1.swap)(tx, [fromToken, toToken], {
|
|
222
|
-
version:
|
|
223
|
-
registry:
|
|
222
|
+
version: __1.PERP_VERSION,
|
|
223
|
+
registry: __1.LP_POOL,
|
|
224
224
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
225
225
|
clock: constants_1.CLOCK,
|
|
226
226
|
index: BigInt(0),
|
|
@@ -238,9 +238,9 @@ function swap(config, tx, pythClient, input) {
|
|
|
238
238
|
function unsubscribe(config, tx, input) {
|
|
239
239
|
return __awaiter(this, void 0, void 0, function () {
|
|
240
240
|
return __generator(this, function (_a) {
|
|
241
|
-
(0, functions_2.unsubscribe)(tx,
|
|
242
|
-
version:
|
|
243
|
-
registry:
|
|
241
|
+
(0, functions_2.unsubscribe)(tx, __1.TLP_TOKEN, {
|
|
242
|
+
version: __1.STAKE_POOL_VERSION,
|
|
243
|
+
registry: __1.STAKE_POOL,
|
|
244
244
|
index: BigInt(0),
|
|
245
245
|
userShareId: BigInt(input.userShareId),
|
|
246
246
|
clock: constants_1.CLOCK,
|
|
@@ -254,8 +254,8 @@ function harvest(config, tx, input) {
|
|
|
254
254
|
return __awaiter(this, void 0, void 0, function () {
|
|
255
255
|
return __generator(this, function (_a) {
|
|
256
256
|
(0, functions_2.harvestPerUserShare)(tx, "0x2::sui::SUI", {
|
|
257
|
-
version:
|
|
258
|
-
registry:
|
|
257
|
+
version: __1.STAKE_POOL_VERSION,
|
|
258
|
+
registry: __1.STAKE_POOL,
|
|
259
259
|
index: BigInt(0),
|
|
260
260
|
userShareId: BigInt(input.userShareId),
|
|
261
261
|
clock: constants_1.CLOCK,
|