@typus/typus-perp-sdk 1.0.18 → 1.0.19
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.js +34 -14
- package/dist/src/typus_perp/lp-pool/functions.d.ts +6 -0
- package/dist/src/typus_perp/lp-pool/functions.js +8 -0
- package/dist/src/typus_perp/position/functions.d.ts +17 -3
- package/dist/src/typus_perp/position/functions.js +26 -8
- package/dist/src/typus_perp/trading/functions.d.ts +2 -0
- package/dist/src/typus_perp/trading/functions.js +2 -0
- package/dist/src/user/orderWithBidReceipt.js +7 -4
- package/package.json +1 -1
package/dist/src/fetch.js
CHANGED
|
@@ -401,20 +401,22 @@ function getUserStake(config, user) {
|
|
|
401
401
|
/// returns [liquidationPrice, pnl(in USD)]
|
|
402
402
|
function getLiquidationPriceAndPnl(config, pythClient, input) {
|
|
403
403
|
return __awaiter(this, void 0, void 0, function () {
|
|
404
|
-
var provider, tx, pythTokens, _a, _b, position, TOKEN, BASE_TOKEN, _c, _d, position, TOKEN, BASE_TOKEN, res, results;
|
|
405
|
-
var e_3,
|
|
406
|
-
var
|
|
407
|
-
return __generator(this, function (
|
|
408
|
-
switch (
|
|
404
|
+
var provider, tx, cTokens, pythTokens, _a, _b, position, TOKEN, BASE_TOKEN, _c, _d, cToken, _e, _f, position, TOKEN, BASE_TOKEN, res, results;
|
|
405
|
+
var e_3, _g, e_4, _h, e_5, _j;
|
|
406
|
+
var _k, _l;
|
|
407
|
+
return __generator(this, function (_m) {
|
|
408
|
+
switch (_m.label) {
|
|
409
409
|
case 0:
|
|
410
410
|
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
411
411
|
tx = new transactions_1.Transaction();
|
|
412
|
+
cTokens = ["SUI"];
|
|
412
413
|
pythTokens = [];
|
|
413
414
|
try {
|
|
414
415
|
for (_a = __values(input.positions), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
415
416
|
position = _b.value;
|
|
416
417
|
TOKEN = (0, constants_1.typeArgToToken)(position.collateralToken.name);
|
|
417
418
|
BASE_TOKEN = (0, constants_1.typeArgToToken)(position.symbol.baseToken.name);
|
|
419
|
+
cTokens.push(TOKEN);
|
|
418
420
|
pythTokens.push(TOKEN);
|
|
419
421
|
pythTokens.push(BASE_TOKEN);
|
|
420
422
|
}
|
|
@@ -422,16 +424,32 @@ function getLiquidationPriceAndPnl(config, pythClient, input) {
|
|
|
422
424
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
423
425
|
finally {
|
|
424
426
|
try {
|
|
425
|
-
if (_b && !_b.done && (
|
|
427
|
+
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
|
|
426
428
|
}
|
|
427
429
|
finally { if (e_3) throw e_3.error; }
|
|
428
430
|
}
|
|
429
431
|
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, Array.from(new Set(pythTokens)))];
|
|
430
432
|
case 1:
|
|
431
|
-
|
|
433
|
+
_m.sent();
|
|
432
434
|
try {
|
|
433
|
-
for (_c = __values(
|
|
434
|
-
|
|
435
|
+
for (_c = __values(Array.from(new Set(cTokens))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
436
|
+
cToken = _d.value;
|
|
437
|
+
if (config.oracle[cToken.toLocaleLowerCase()]) {
|
|
438
|
+
// @ts-ignore
|
|
439
|
+
(0, utils_1.updateOracleWithPyth)(pythClient, tx, config.package.oracle, config.oracle[cToken.toLocaleLowerCase()], cToken, "wUSDC");
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
444
|
+
finally {
|
|
445
|
+
try {
|
|
446
|
+
if (_d && !_d.done && (_h = _c.return)) _h.call(_c);
|
|
447
|
+
}
|
|
448
|
+
finally { if (e_4) throw e_4.error; }
|
|
449
|
+
}
|
|
450
|
+
try {
|
|
451
|
+
for (_e = __values(input.positions), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
452
|
+
position = _f.value;
|
|
435
453
|
TOKEN = (0, constants_1.typeArgToToken)(position.collateralToken.name);
|
|
436
454
|
BASE_TOKEN = (0, constants_1.typeArgToToken)(position.symbol.baseToken.name);
|
|
437
455
|
(0, functions_1.getEstimatedLiquidationPriceAndPnl)(tx, [position.collateralToken.name, position.symbol.baseToken.name], {
|
|
@@ -445,20 +463,22 @@ function getLiquidationPriceAndPnl(config, pythClient, input) {
|
|
|
445
463
|
oracleTradingSymbol: utils_1.priceInfoObjectIds[_1.NETWORK][BASE_TOKEN],
|
|
446
464
|
clock: constants_1.CLOCK,
|
|
447
465
|
positionId: position.positionId,
|
|
466
|
+
dovRegistry: config.registry.dov.dovSingle,
|
|
467
|
+
typusOracle: (_k = config.oracle[TOKEN.toLocaleLowerCase()]) !== null && _k !== void 0 ? _k : config.oracle["sui"],
|
|
448
468
|
});
|
|
449
469
|
}
|
|
450
470
|
}
|
|
451
|
-
catch (
|
|
471
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
452
472
|
finally {
|
|
453
473
|
try {
|
|
454
|
-
if (
|
|
474
|
+
if (_f && !_f.done && (_j = _e.return)) _j.call(_e);
|
|
455
475
|
}
|
|
456
|
-
finally { if (
|
|
476
|
+
finally { if (e_5) throw e_5.error; }
|
|
457
477
|
}
|
|
458
478
|
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: input.user, transactionBlock: tx })];
|
|
459
479
|
case 2:
|
|
460
|
-
res =
|
|
461
|
-
results = (
|
|
480
|
+
res = _m.sent();
|
|
481
|
+
results = (_l = res.results) === null || _l === void 0 ? void 0 : _l.slice(-input.positions.length).map(function (x) {
|
|
462
482
|
// console.log(x);
|
|
463
483
|
var liquidationPrice = bcs_1.bcs.u64().parse(Uint8Array.from(x.returnValues[0][0]));
|
|
464
484
|
var isProfit = bcs_1.bcs.bool().parse(Uint8Array.from(x.returnValues[1][0]));
|
|
@@ -319,6 +319,12 @@ export interface UpdateRemoveLiquidityTokenProcessTokenArgs {
|
|
|
319
319
|
updatePositionToken: boolean | TransactionArgument;
|
|
320
320
|
}
|
|
321
321
|
export declare function updateRemoveLiquidityTokenProcessToken(tx: Transaction, typeArg: string, args: UpdateRemoveLiquidityTokenProcessTokenArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
322
|
+
export interface UpdateReserveAmountArgs {
|
|
323
|
+
liquidityPool: TransactionObjectInput;
|
|
324
|
+
addReserve: boolean | TransactionArgument;
|
|
325
|
+
dReserve: bigint | TransactionArgument;
|
|
326
|
+
}
|
|
327
|
+
export declare function updateReserveAmount(tx: Transaction, typeArg: string, args: UpdateReserveAmountArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
322
328
|
export interface UpdateSpotConfigArgs {
|
|
323
329
|
version: TransactionObjectInput;
|
|
324
330
|
registry: TransactionObjectInput;
|
|
@@ -49,6 +49,7 @@ exports.updateLiquidityValue = updateLiquidityValue;
|
|
|
49
49
|
exports.updateMarginConfig = updateMarginConfig;
|
|
50
50
|
exports.updateRemoveLiquidityTokenProcessStatus = updateRemoveLiquidityTokenProcessStatus;
|
|
51
51
|
exports.updateRemoveLiquidityTokenProcessToken = updateRemoveLiquidityTokenProcessToken;
|
|
52
|
+
exports.updateReserveAmount = updateReserveAmount;
|
|
52
53
|
exports.updateSpotConfig = updateSpotConfig;
|
|
53
54
|
exports.updateTvl = updateTvl;
|
|
54
55
|
exports.viewSwapResult = viewSwapResult;
|
|
@@ -477,6 +478,13 @@ function updateRemoveLiquidityTokenProcessToken(tx, typeArg, args) {
|
|
|
477
478
|
arguments: [(0, util_1.obj)(tx, args.process), (0, util_1.pure)(tx, args.updatePositionToken, "bool")],
|
|
478
479
|
});
|
|
479
480
|
}
|
|
481
|
+
function updateReserveAmount(tx, typeArg, args) {
|
|
482
|
+
return tx.moveCall({
|
|
483
|
+
target: "".concat(__1.PUBLISHED_AT, "::lp_pool::update_reserve_amount"),
|
|
484
|
+
typeArguments: [typeArg],
|
|
485
|
+
arguments: [(0, util_1.obj)(tx, args.liquidityPool), (0, util_1.pure)(tx, args.addReserve, "bool"), (0, util_1.pure)(tx, args.dReserve, "u64")],
|
|
486
|
+
});
|
|
487
|
+
}
|
|
480
488
|
function updateSpotConfig(tx, typeArg, args) {
|
|
481
489
|
return tx.moveCall({
|
|
482
490
|
target: "".concat(__1.PUBLISHED_AT, "::lp_pool::update_spot_config"),
|
|
@@ -174,11 +174,11 @@ export interface EmitRealizedFundingEventArgs {
|
|
|
174
174
|
export declare function emitRealizedFundingEvent(tx: Transaction, args: EmitRealizedFundingEventArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
175
175
|
export interface GetEstimatedLiquidationPriceArgs {
|
|
176
176
|
position: TransactionObjectInput;
|
|
177
|
+
isSameToken: boolean | TransactionArgument;
|
|
177
178
|
collateralOraclePrice: bigint | TransactionArgument;
|
|
178
179
|
collateralOraclePriceDecimal: bigint | TransactionArgument;
|
|
179
|
-
tradingPairOraclePrice: bigint | TransactionArgument;
|
|
180
|
-
tradingPairOraclePriceDecimal: bigint | TransactionArgument;
|
|
181
180
|
tradingFeeMbp: bigint | TransactionArgument;
|
|
181
|
+
maintenanceMarginRateBp: 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;
|
|
@@ -229,13 +229,16 @@ export declare function getPositionSide(tx: Transaction, position: TransactionOb
|
|
|
229
229
|
export declare function getPositionSize(tx: Transaction, position: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
|
|
230
230
|
export declare function getPositionSizeDecimal(tx: Transaction, position: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
|
|
231
231
|
export declare function getPositionSymbol(tx: Transaction, position: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
|
|
232
|
-
export declare function getPositionUnrealizedCost(tx: Transaction, position: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
|
|
233
232
|
export declare function getPositionUnrealizedFundingSign(tx: Transaction, position: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
|
|
234
233
|
export declare function getPositionUser(tx: Transaction, position: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
|
|
235
234
|
export declare function getReserveAmount(tx: Transaction, position: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
|
|
236
235
|
export interface IncreaseCollateralArgs {
|
|
237
236
|
position: TransactionObjectInput;
|
|
238
237
|
collateral: TransactionObjectInput;
|
|
238
|
+
collateralOraclePrice: bigint | TransactionArgument;
|
|
239
|
+
collateralOraclePriceDecimal: bigint | TransactionArgument;
|
|
240
|
+
tradingPairOraclePrice: bigint | TransactionArgument;
|
|
241
|
+
tradingPairOraclePriceDecimal: bigint | TransactionArgument;
|
|
239
242
|
}
|
|
240
243
|
export declare function increaseCollateral(tx: Transaction, typeArg: string, args: IncreaseCollateralArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
241
244
|
export declare function isOptionCollateralOrder(tx: Transaction, order: TransactionObjectInput): import("@mysten/sui/transactions").TransactionResult;
|
|
@@ -302,6 +305,10 @@ export declare function realizeFunding(tx: Transaction, typeArg: string, args: R
|
|
|
302
305
|
export interface ReleaseCollateralArgs {
|
|
303
306
|
position: TransactionObjectInput;
|
|
304
307
|
releaseAmount: bigint | TransactionArgument;
|
|
308
|
+
collateralOraclePrice: bigint | TransactionArgument;
|
|
309
|
+
collateralOraclePriceDecimal: bigint | TransactionArgument;
|
|
310
|
+
tradingPairOraclePrice: bigint | TransactionArgument;
|
|
311
|
+
tradingPairOraclePriceDecimal: bigint | TransactionArgument;
|
|
305
312
|
}
|
|
306
313
|
export declare function releaseCollateral(tx: Transaction, typeArg: string, args: ReleaseCollateralArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
307
314
|
export interface RemoveOrderArgs {
|
|
@@ -329,6 +336,13 @@ export interface RemovePositionWithBidReceiptsArgs {
|
|
|
329
336
|
position: TransactionObjectInput;
|
|
330
337
|
}
|
|
331
338
|
export declare function removePositionWithBidReceipts(tx: Transaction, args: RemovePositionWithBidReceiptsArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
339
|
+
export interface UpdateOptionPositionCollateralAmountArgs {
|
|
340
|
+
dovRegistry: TransactionObjectInput;
|
|
341
|
+
typusOracle: TransactionObjectInput;
|
|
342
|
+
position: TransactionObjectInput;
|
|
343
|
+
clock: TransactionObjectInput;
|
|
344
|
+
}
|
|
345
|
+
export declare function updateOptionPositionCollateralAmount(tx: Transaction, typeArg: string, args: UpdateOptionPositionCollateralAmountArgs): import("@mysten/sui/transactions").TransactionResult;
|
|
332
346
|
export interface UpdatePositionBorrowRateAndFundingRateArgs {
|
|
333
347
|
position: TransactionObjectInput;
|
|
334
348
|
collateralOraclePrice: bigint | TransactionArgument;
|
|
@@ -46,7 +46,6 @@ exports.getPositionSide = getPositionSide;
|
|
|
46
46
|
exports.getPositionSize = getPositionSize;
|
|
47
47
|
exports.getPositionSizeDecimal = getPositionSizeDecimal;
|
|
48
48
|
exports.getPositionSymbol = getPositionSymbol;
|
|
49
|
-
exports.getPositionUnrealizedCost = getPositionUnrealizedCost;
|
|
50
49
|
exports.getPositionUnrealizedFundingSign = getPositionUnrealizedFundingSign;
|
|
51
50
|
exports.getPositionUser = getPositionUser;
|
|
52
51
|
exports.getReserveAmount = getReserveAmount;
|
|
@@ -64,6 +63,7 @@ exports.removeOrderWithBidReceipts = removeOrderWithBidReceipts;
|
|
|
64
63
|
exports.removePosition = removePosition;
|
|
65
64
|
exports.removePositionLinkedOrderInfo = removePositionLinkedOrderInfo;
|
|
66
65
|
exports.removePositionWithBidReceipts = removePositionWithBidReceipts;
|
|
66
|
+
exports.updateOptionPositionCollateralAmount = updateOptionPositionCollateralAmount;
|
|
67
67
|
exports.updatePositionBorrowRateAndFundingRate = updatePositionBorrowRateAndFundingRate;
|
|
68
68
|
var __1 = require("..");
|
|
69
69
|
var structs_1 = require("../../_dependencies/source/0x1/option/structs");
|
|
@@ -307,11 +307,11 @@ function getEstimatedLiquidationPrice(tx, args) {
|
|
|
307
307
|
target: "".concat(__1.PUBLISHED_AT, "::position::get_estimated_liquidation_price"),
|
|
308
308
|
arguments: [
|
|
309
309
|
(0, util_1.obj)(tx, args.position),
|
|
310
|
+
(0, util_1.pure)(tx, args.isSameToken, "bool"),
|
|
310
311
|
(0, util_1.pure)(tx, args.collateralOraclePrice, "u64"),
|
|
311
312
|
(0, util_1.pure)(tx, args.collateralOraclePriceDecimal, "u64"),
|
|
312
|
-
(0, util_1.pure)(tx, args.tradingPairOraclePrice, "u64"),
|
|
313
|
-
(0, util_1.pure)(tx, args.tradingPairOraclePriceDecimal, "u64"),
|
|
314
313
|
(0, util_1.pure)(tx, args.tradingFeeMbp, "u64"),
|
|
314
|
+
(0, util_1.pure)(tx, args.maintenanceMarginRateBp, "u64"),
|
|
315
315
|
],
|
|
316
316
|
});
|
|
317
317
|
}
|
|
@@ -425,9 +425,6 @@ function getPositionSizeDecimal(tx, position) {
|
|
|
425
425
|
function getPositionSymbol(tx, position) {
|
|
426
426
|
return tx.moveCall({ target: "".concat(__1.PUBLISHED_AT, "::position::get_position_symbol"), arguments: [(0, util_1.obj)(tx, position)] });
|
|
427
427
|
}
|
|
428
|
-
function getPositionUnrealizedCost(tx, position) {
|
|
429
|
-
return tx.moveCall({ target: "".concat(__1.PUBLISHED_AT, "::position::get_position_unrealized_cost"), arguments: [(0, util_1.obj)(tx, position)] });
|
|
430
|
-
}
|
|
431
428
|
function getPositionUnrealizedFundingSign(tx, position) {
|
|
432
429
|
return tx.moveCall({ target: "".concat(__1.PUBLISHED_AT, "::position::get_position_unrealized_funding_sign"), arguments: [(0, util_1.obj)(tx, position)] });
|
|
433
430
|
}
|
|
@@ -441,7 +438,14 @@ function increaseCollateral(tx, typeArg, args) {
|
|
|
441
438
|
return tx.moveCall({
|
|
442
439
|
target: "".concat(__1.PUBLISHED_AT, "::position::increase_collateral"),
|
|
443
440
|
typeArguments: [typeArg],
|
|
444
|
-
arguments: [
|
|
441
|
+
arguments: [
|
|
442
|
+
(0, util_1.obj)(tx, args.position),
|
|
443
|
+
(0, util_1.obj)(tx, args.collateral),
|
|
444
|
+
(0, util_1.pure)(tx, args.collateralOraclePrice, "u64"),
|
|
445
|
+
(0, util_1.pure)(tx, args.collateralOraclePriceDecimal, "u64"),
|
|
446
|
+
(0, util_1.pure)(tx, args.tradingPairOraclePrice, "u64"),
|
|
447
|
+
(0, util_1.pure)(tx, args.tradingPairOraclePriceDecimal, "u64"),
|
|
448
|
+
],
|
|
445
449
|
});
|
|
446
450
|
}
|
|
447
451
|
function isOptionCollateralOrder(tx, order) {
|
|
@@ -533,7 +537,14 @@ function releaseCollateral(tx, typeArg, args) {
|
|
|
533
537
|
return tx.moveCall({
|
|
534
538
|
target: "".concat(__1.PUBLISHED_AT, "::position::release_collateral"),
|
|
535
539
|
typeArguments: [typeArg],
|
|
536
|
-
arguments: [
|
|
540
|
+
arguments: [
|
|
541
|
+
(0, util_1.obj)(tx, args.position),
|
|
542
|
+
(0, util_1.pure)(tx, args.releaseAmount, "u64"),
|
|
543
|
+
(0, util_1.pure)(tx, args.collateralOraclePrice, "u64"),
|
|
544
|
+
(0, util_1.pure)(tx, args.collateralOraclePriceDecimal, "u64"),
|
|
545
|
+
(0, util_1.pure)(tx, args.tradingPairOraclePrice, "u64"),
|
|
546
|
+
(0, util_1.pure)(tx, args.tradingPairOraclePriceDecimal, "u64"),
|
|
547
|
+
],
|
|
537
548
|
});
|
|
538
549
|
}
|
|
539
550
|
function removeOrder(tx, typeArg, args) {
|
|
@@ -568,6 +579,13 @@ function removePositionWithBidReceipts(tx, args) {
|
|
|
568
579
|
arguments: [(0, util_1.obj)(tx, args.version), (0, util_1.obj)(tx, args.position)],
|
|
569
580
|
});
|
|
570
581
|
}
|
|
582
|
+
function updateOptionPositionCollateralAmount(tx, typeArg, args) {
|
|
583
|
+
return tx.moveCall({
|
|
584
|
+
target: "".concat(__1.PUBLISHED_AT, "::position::update_option_position_collateral_amount"),
|
|
585
|
+
typeArguments: [typeArg],
|
|
586
|
+
arguments: [(0, util_1.obj)(tx, args.dovRegistry), (0, util_1.obj)(tx, args.typusOracle), (0, util_1.obj)(tx, args.position), (0, util_1.obj)(tx, args.clock)],
|
|
587
|
+
});
|
|
588
|
+
}
|
|
571
589
|
function updatePositionBorrowRateAndFundingRate(tx, args) {
|
|
572
590
|
return tx.moveCall({
|
|
573
591
|
target: "".concat(__1.PUBLISHED_AT, "::position::update_position_borrow_rate_and_funding_rate"),
|
|
@@ -223,6 +223,8 @@ export interface GetEstimatedLiquidationPriceAndPnlArgs {
|
|
|
223
223
|
version: TransactionObjectInput;
|
|
224
224
|
registry: TransactionObjectInput;
|
|
225
225
|
poolRegistry: TransactionObjectInput;
|
|
226
|
+
dovRegistry: TransactionObjectInput;
|
|
227
|
+
typusOracle: TransactionObjectInput;
|
|
226
228
|
marketIndex: bigint | TransactionArgument;
|
|
227
229
|
poolIndex: bigint | TransactionArgument;
|
|
228
230
|
pythState: TransactionObjectInput;
|
|
@@ -359,6 +359,8 @@ function getEstimatedLiquidationPriceAndPnl(tx, typeArgs, args) {
|
|
|
359
359
|
(0, util_1.obj)(tx, args.version),
|
|
360
360
|
(0, util_1.obj)(tx, args.registry),
|
|
361
361
|
(0, util_1.obj)(tx, args.poolRegistry),
|
|
362
|
+
(0, util_1.obj)(tx, args.dovRegistry),
|
|
363
|
+
(0, util_1.obj)(tx, args.typusOracle),
|
|
362
364
|
(0, util_1.pure)(tx, args.marketIndex, "u64"),
|
|
363
365
|
(0, util_1.pure)(tx, args.poolIndex, "u64"),
|
|
364
366
|
(0, util_1.obj)(tx, args.pythState),
|
|
@@ -51,13 +51,16 @@ function createTradingOrderWithBidReceipt(config, tx, pythClient, input) {
|
|
|
51
51
|
case 0:
|
|
52
52
|
TOKEN = input.cToken;
|
|
53
53
|
BASE_TOKEN = input.tradingToken;
|
|
54
|
-
|
|
54
|
+
// deduplicate
|
|
55
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, Array.from(new Set([TOKEN, BASE_TOKEN, "wUSDC"])))];
|
|
55
56
|
case 1:
|
|
57
|
+
// deduplicate
|
|
56
58
|
_a.sent();
|
|
57
59
|
cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
58
60
|
bToken = constants_1.tokenType[__1.NETWORK][input.bToken];
|
|
59
61
|
baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
60
|
-
|
|
62
|
+
// TODO: use updateOracleWithPythUsd
|
|
63
|
+
(0, utils_1.updateOracleWithPyth)(pythClient, tx, config.package.oracle, config.oracle[BASE_TOKEN.toLocaleLowerCase()], BASE_TOKEN, "wUSDC");
|
|
61
64
|
if (input.share) {
|
|
62
65
|
collateralBidReceipt = (0, typus_dov_single_v2_1.getSplitBidReceiptTx)(config, tx, {
|
|
63
66
|
index: input.index,
|
|
@@ -101,13 +104,13 @@ function reduceOptionCollateralPositionSize(config, tx, pythClient, input) {
|
|
|
101
104
|
case 0:
|
|
102
105
|
TOKEN = input.cToken;
|
|
103
106
|
BASE_TOKEN = input.tradingToken;
|
|
104
|
-
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, [TOKEN, BASE_TOKEN])];
|
|
107
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, [TOKEN, BASE_TOKEN, "wUSDC"])];
|
|
105
108
|
case 1:
|
|
106
109
|
_a.sent();
|
|
107
110
|
cToken = constants_1.tokenType[__1.NETWORK][TOKEN];
|
|
108
111
|
bToken = constants_1.tokenType[__1.NETWORK][input.bToken];
|
|
109
112
|
baseToken = constants_1.tokenType[__1.NETWORK][BASE_TOKEN];
|
|
110
|
-
(0, utils_1.updateOracleWithPyth)(pythClient, tx, config.package.oracle, config.oracle[BASE_TOKEN.toLocaleLowerCase()], BASE_TOKEN, "
|
|
113
|
+
(0, utils_1.updateOracleWithPyth)(pythClient, tx, config.package.oracle, config.oracle[BASE_TOKEN.toLocaleLowerCase()], BASE_TOKEN, "wUSDC");
|
|
111
114
|
(0, functions_1.reduceOptionCollateralPositionSize)(tx, [cToken, bToken, baseToken], {
|
|
112
115
|
version: __1.PERP_VERSION,
|
|
113
116
|
registry: __1.MARKET,
|