@typus/typus-perp-sdk 1.1.4 → 1.1.5-funding-collect
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/api/sentio.js +1 -1
- package/dist/src/fetch.d.ts +10 -1
- package/dist/src/fetch.js +21 -8
- package/dist/src/index.js +1 -1
- package/dist/src/typus_perp/lp-pool/functions.d.ts +34 -0
- package/dist/src/typus_perp/lp-pool/functions.js +56 -0
- package/dist/src/typus_perp/lp-pool/structs.d.ts +774 -0
- package/dist/src/typus_perp/lp-pool/structs.js +1952 -498
- package/dist/src/typus_perp/trading/functions.d.ts +105 -10
- package/dist/src/typus_perp/trading/functions.js +152 -16
- package/dist/src/typus_perp/user-account/functions.d.ts +36 -0
- package/dist/src/typus_perp/user-account/functions.js +70 -0
- package/dist/src/typus_perp/user-account/structs.d.ts +168 -0
- package/dist/src/typus_perp/user-account/structs.js +448 -0
- package/dist/src/user/history.js +5 -4
- package/dist/src/user/order.d.ts +4 -0
- package/dist/src/user/order.js +48 -0
- package/package.json +2 -2
package/dist/src/user/order.js
CHANGED
|
@@ -68,6 +68,7 @@ exports.zeroCoin = zeroCoin;
|
|
|
68
68
|
exports.cancelTradingOrder = cancelTradingOrder;
|
|
69
69
|
exports.increaseCollateral = increaseCollateral;
|
|
70
70
|
exports.releaseCollateral = releaseCollateral;
|
|
71
|
+
exports.collectPositionFundingFee = collectPositionFundingFee;
|
|
71
72
|
var functions_1 = require("../typus_perp/trading/functions");
|
|
72
73
|
var __1 = require("..");
|
|
73
74
|
var utils_1 = require("@typus/typus-sdk/dist/src/utils");
|
|
@@ -271,3 +272,50 @@ function releaseCollateral(config, tx, pythClient, input) {
|
|
|
271
272
|
});
|
|
272
273
|
});
|
|
273
274
|
}
|
|
275
|
+
function collectPositionFundingFee(config, tx, pythClient, input) {
|
|
276
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
277
|
+
var TOKEN, BASE_TOKEN, tokens, suiCoin, tokens_4, tokens_4_1, token, cToken, baseToken;
|
|
278
|
+
var e_4, _a;
|
|
279
|
+
return __generator(this, function (_b) {
|
|
280
|
+
switch (_b.label) {
|
|
281
|
+
case 0:
|
|
282
|
+
TOKEN = (0, constants_1.typeArgToAsset)(input.position.collateralToken.name);
|
|
283
|
+
BASE_TOKEN = (0, constants_1.typeArgToAsset)(input.position.symbol.baseToken.name);
|
|
284
|
+
tokens = Array.from(new Set([TOKEN, BASE_TOKEN]));
|
|
285
|
+
if (config.sponsored) {
|
|
286
|
+
suiCoin = (0, utils_1.splitCoin)(tx, constants_1.tokenType.MAINNET.SUI, input.suiCoins, tokens.length.toString(), config.sponsored);
|
|
287
|
+
}
|
|
288
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens, suiCoin)];
|
|
289
|
+
case 1:
|
|
290
|
+
_b.sent();
|
|
291
|
+
try {
|
|
292
|
+
for (tokens_4 = __values(tokens), tokens_4_1 = tokens_4.next(); !tokens_4_1.done; tokens_4_1 = tokens_4.next()) {
|
|
293
|
+
token = tokens_4_1.value;
|
|
294
|
+
(0, utils_1.updateOracleWithPythUsd)(pythClient, tx, config.package.oracle, token);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
298
|
+
finally {
|
|
299
|
+
try {
|
|
300
|
+
if (tokens_4_1 && !tokens_4_1.done && (_a = tokens_4.return)) _a.call(tokens_4);
|
|
301
|
+
}
|
|
302
|
+
finally { if (e_4) throw e_4.error; }
|
|
303
|
+
}
|
|
304
|
+
cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
305
|
+
baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
306
|
+
(0, functions_1.collectPositionFundingFee)(tx, [cToken, baseToken], {
|
|
307
|
+
version: __1.PERP_VERSION,
|
|
308
|
+
registry: __1.MARKET,
|
|
309
|
+
poolRegistry: __1.LP_POOL,
|
|
310
|
+
marketIndex: BigInt(0),
|
|
311
|
+
poolIndex: BigInt(0),
|
|
312
|
+
typusOracleCToken: constants_1.oracle[__1.NETWORK][TOKEN],
|
|
313
|
+
typusOracleTradingSymbol: constants_1.oracle[__1.NETWORK][BASE_TOKEN],
|
|
314
|
+
clock: constants_1.CLOCK,
|
|
315
|
+
positionId: BigInt(input.position.positionId),
|
|
316
|
+
});
|
|
317
|
+
return [2 /*return*/, tx];
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typus/typus-perp-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5-funding-collect",
|
|
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.8.
|
|
9
|
+
"@typus/typus-sdk": "1.8.6"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@types/bs58": "^4.0.1",
|