@typus/typus-sdk 1.4.50 → 1.4.51
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/typus/tails-staking/user-entry.d.ts +37 -0
- package/dist/src/typus/tails-staking/user-entry.js +86 -0
- package/dist/src/typus-dov-single-v2/history/vault-history.js +0 -30
- package/dist/src/utils/api/sentio/reward-generated.d.ts +2 -0
- package/dist/src/utils/api/sentio/reward-generated.js +54 -0
- package/package.json +1 -1
|
@@ -122,6 +122,43 @@ export declare function getExpUpWithoutStakingTx(config: TypusConfig, tx: Transa
|
|
|
122
122
|
amount: string;
|
|
123
123
|
personalKioskPackageId: string | undefined;
|
|
124
124
|
}): TransactionBlock;
|
|
125
|
+
/**
|
|
126
|
+
entry fun exp_down_with_fee(
|
|
127
|
+
version: &Version,
|
|
128
|
+
tails_staking_registry: &mut TailsStakingRegistry,
|
|
129
|
+
typus_user_registry: &mut TypusUserRegistry,
|
|
130
|
+
tails: address,
|
|
131
|
+
amount: u64,
|
|
132
|
+
coin: Coin<SUI>,
|
|
133
|
+
ctx: &TxContext,
|
|
134
|
+
) {
|
|
135
|
+
*/
|
|
136
|
+
export declare function getExpDownWithFeeTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
137
|
+
fee: string;
|
|
138
|
+
tails: string;
|
|
139
|
+
amount: string;
|
|
140
|
+
}): TransactionBlock;
|
|
141
|
+
/**
|
|
142
|
+
entry fun exp_down_without_staking_with_fee(
|
|
143
|
+
version: &Version,
|
|
144
|
+
tails_staking_registry: &TailsStakingRegistry,
|
|
145
|
+
typus_user_registry: &mut TypusUserRegistry,
|
|
146
|
+
kiosk: &mut Kiosk,
|
|
147
|
+
kiosk_owner_cap: &KioskOwnerCap,
|
|
148
|
+
tails: address,
|
|
149
|
+
amount: u64,
|
|
150
|
+
coin: Coin<SUI>,
|
|
151
|
+
ctx: &TxContext,
|
|
152
|
+
) {
|
|
153
|
+
*/
|
|
154
|
+
export declare function getExpDownWithoutStakingWithFeeTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
155
|
+
fee: string;
|
|
156
|
+
kiosk: string;
|
|
157
|
+
kioskCap: string;
|
|
158
|
+
tails: string;
|
|
159
|
+
amount: string;
|
|
160
|
+
personalKioskPackageId: string | undefined;
|
|
161
|
+
}): TransactionBlock;
|
|
125
162
|
export declare function getCreateKioskAndLockNftTx(config: TypusConfig, tx: TransactionBlock, kioskClient: KioskClient, input: {
|
|
126
163
|
nft_policy: string;
|
|
127
164
|
nft_id: string;
|
|
@@ -24,6 +24,8 @@ exports.getClaimProfitSharingTx = getClaimProfitSharingTx;
|
|
|
24
24
|
exports.getLevelUpTx = getLevelUpTx;
|
|
25
25
|
exports.getExpUpTx = getExpUpTx;
|
|
26
26
|
exports.getExpUpWithoutStakingTx = getExpUpWithoutStakingTx;
|
|
27
|
+
exports.getExpDownWithFeeTx = getExpDownWithFeeTx;
|
|
28
|
+
exports.getExpDownWithoutStakingWithFeeTx = getExpDownWithoutStakingWithFeeTx;
|
|
27
29
|
exports.getCreateKioskAndLockNftTx = getCreateKioskAndLockNftTx;
|
|
28
30
|
var constants_1 = require("../../../src/constants");
|
|
29
31
|
var kiosk_1 = require("@mysten/kiosk");
|
|
@@ -314,6 +316,90 @@ function getExpUpWithoutStakingTx(config, tx, input) {
|
|
|
314
316
|
}
|
|
315
317
|
return tx;
|
|
316
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
entry fun exp_down_with_fee(
|
|
321
|
+
version: &Version,
|
|
322
|
+
tails_staking_registry: &mut TailsStakingRegistry,
|
|
323
|
+
typus_user_registry: &mut TypusUserRegistry,
|
|
324
|
+
tails: address,
|
|
325
|
+
amount: u64,
|
|
326
|
+
coin: Coin<SUI>,
|
|
327
|
+
ctx: &TxContext,
|
|
328
|
+
) {
|
|
329
|
+
*/
|
|
330
|
+
function getExpDownWithFeeTx(config, tx, input) {
|
|
331
|
+
var _a = __read(tx.splitCoins(tx.gas, [tx.pure(input.fee)]), 1), coin = _a[0];
|
|
332
|
+
tx.moveCall({
|
|
333
|
+
target: "".concat(config.package.typus, "::tails_staking::exp_down_with_fee"),
|
|
334
|
+
typeArguments: [],
|
|
335
|
+
arguments: [
|
|
336
|
+
tx.object(config.version.typus),
|
|
337
|
+
tx.object(config.registry.typus.tailsStaking),
|
|
338
|
+
tx.object(config.registry.typus.user),
|
|
339
|
+
tx.pure(input.tails),
|
|
340
|
+
tx.pure(input.amount),
|
|
341
|
+
coin,
|
|
342
|
+
],
|
|
343
|
+
});
|
|
344
|
+
return tx;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
entry fun exp_down_without_staking_with_fee(
|
|
348
|
+
version: &Version,
|
|
349
|
+
tails_staking_registry: &TailsStakingRegistry,
|
|
350
|
+
typus_user_registry: &mut TypusUserRegistry,
|
|
351
|
+
kiosk: &mut Kiosk,
|
|
352
|
+
kiosk_owner_cap: &KioskOwnerCap,
|
|
353
|
+
tails: address,
|
|
354
|
+
amount: u64,
|
|
355
|
+
coin: Coin<SUI>,
|
|
356
|
+
ctx: &TxContext,
|
|
357
|
+
) {
|
|
358
|
+
*/
|
|
359
|
+
function getExpDownWithoutStakingWithFeeTx(config, tx, input) {
|
|
360
|
+
var _a = __read(tx.splitCoins(tx.gas, [tx.pure(input.fee)]), 1), coin = _a[0];
|
|
361
|
+
if (input.personalKioskPackageId) {
|
|
362
|
+
var _b = __read(tx.moveCall({
|
|
363
|
+
target: "".concat(input.personalKioskPackageId, "::personal_kiosk::borrow_val"),
|
|
364
|
+
arguments: [tx.object(input.kioskCap)],
|
|
365
|
+
}), 2), personalKioskCap = _b[0], borrow = _b[1];
|
|
366
|
+
tx.moveCall({
|
|
367
|
+
target: "".concat(config.package.typus, "::tails_staking::exp_down_without_staking_with_fee"),
|
|
368
|
+
typeArguments: [],
|
|
369
|
+
arguments: [
|
|
370
|
+
tx.object(config.version.typus),
|
|
371
|
+
tx.object(config.registry.typus.tailsStaking),
|
|
372
|
+
tx.object(config.registry.typus.user),
|
|
373
|
+
tx.object(input.kiosk),
|
|
374
|
+
personalKioskCap,
|
|
375
|
+
tx.pure(input.tails),
|
|
376
|
+
tx.pure(input.amount),
|
|
377
|
+
coin,
|
|
378
|
+
],
|
|
379
|
+
});
|
|
380
|
+
tx.moveCall({
|
|
381
|
+
target: "".concat(input.personalKioskPackageId, "::personal_kiosk::return_val"),
|
|
382
|
+
arguments: [tx.object(input.kioskCap), personalKioskCap, borrow],
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
tx.moveCall({
|
|
387
|
+
target: "".concat(config.package.typus, "::tails_staking::exp_down_without_staking_with_fee"),
|
|
388
|
+
typeArguments: [],
|
|
389
|
+
arguments: [
|
|
390
|
+
tx.object(config.version.typus),
|
|
391
|
+
tx.object(config.registry.typus.tailsStaking),
|
|
392
|
+
tx.object(config.registry.typus.user),
|
|
393
|
+
tx.object(input.kiosk),
|
|
394
|
+
tx.object(input.kioskCap),
|
|
395
|
+
tx.pure(input.tails),
|
|
396
|
+
tx.pure(input.amount),
|
|
397
|
+
coin,
|
|
398
|
+
],
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
return tx;
|
|
402
|
+
}
|
|
317
403
|
function getCreateKioskAndLockNftTx(config, tx, kioskClient, input) {
|
|
318
404
|
var kioskTx = new kiosk_1.KioskTransaction({ transactionBlock: tx, kioskClient: kioskClient });
|
|
319
405
|
kioskTx.create();
|
|
@@ -403,33 +403,3 @@ function parseBidEvents(datas, end_ts_ms) {
|
|
|
403
403
|
});
|
|
404
404
|
});
|
|
405
405
|
}
|
|
406
|
-
// SELECT
|
|
407
|
-
// Settle.index as Index,
|
|
408
|
-
// Settle.round as Round,
|
|
409
|
-
// NewAuction.start_ts_ms as ActivationDate,
|
|
410
|
-
// COALESCE(NULLIF(UpdateStrike.strikes, ''), NewAuction.strikes) AS Strikes, -- 如果 UpdateStrike.strikes 是空字符串,就使用 NewAuction.strikes
|
|
411
|
-
// Settle.oracle_price as SettlePrice,
|
|
412
|
-
// -- Settle.share_price as share_price,
|
|
413
|
-
// Delivery.max_size as TotalAuctioned,
|
|
414
|
-
// SafuOtc.delivery_size as OtcSize,
|
|
415
|
-
// Delivery.delivery_size as DeliverySize,
|
|
416
|
-
// ((SafuOtc.delivery_size + Delivery.delivery_size) / TotalAuctioned) as Filled,
|
|
417
|
-
// Delivery.delivery_price as DeliveryPrice,
|
|
418
|
-
// SafuOtc.delivery_price as OtcPrice,
|
|
419
|
-
// Delivery.bidder_bid_value as BidderPremium,
|
|
420
|
-
// Delivery.incentive_bid_value as IncentivePremium,
|
|
421
|
-
// SafuOtc.bidder_bid_value as OtcPremium,
|
|
422
|
-
// (Delivery.bidder_bid_value + Delivery.incentive_bid_value + SafuOtc.bidder_bid_value) AS Premium, -- 三個加在一起的 Premium
|
|
423
|
-
// Delivery.depositor_incentive_value as BpIncentive, -- SUI or SCA
|
|
424
|
-
// Delivery.fixed_incentive_amount as FiexedIncentive, -- SUI
|
|
425
|
-
// (Settle.settle_balance - Settle.settled_balance) as OptionProfit,
|
|
426
|
-
// Settle.d_token as d_token,
|
|
427
|
-
// Delivery.b_token as b_token,
|
|
428
|
-
// Delivery.o_token as o_token
|
|
429
|
-
// FROM Settle
|
|
430
|
-
// JOIN NewAuction ON Settle.index = NewAuction.index AND Settle.round = NewAuction.round
|
|
431
|
-
// LEFT JOIN UpdateStrike ON Settle.index = UpdateStrike.index AND Settle.round = UpdateStrike.round
|
|
432
|
-
// JOIN Delivery ON Settle.index = Delivery.index AND Settle.round = Delivery.round
|
|
433
|
-
// LEFT JOIN SafuOtc ON Settle.index = SafuOtc.index AND Settle.round = SafuOtc.round
|
|
434
|
-
// WHERE Settle.timestamp >= 1725170000
|
|
435
|
-
// ORDER BY Index ASC;
|
|
@@ -13,4 +13,6 @@ interface TokenAmount {
|
|
|
13
13
|
export declare function getAccumulatedUser(): Promise<number[]>;
|
|
14
14
|
/** Returns Accumulated Notional Volume in USD [v1, v2] */
|
|
15
15
|
export declare function getAccumulatedNotionalVolumeUSD(): Promise<number[]>;
|
|
16
|
+
/** Returns Safu Accumulated Rewards im USD */
|
|
17
|
+
export declare function getSafuAccumulatedRewardGeneratedUSD(): Promise<number>;
|
|
16
18
|
export {};
|
|
@@ -54,6 +54,7 @@ exports.getTotalProfitSharingClaimed = getTotalProfitSharingClaimed;
|
|
|
54
54
|
exports.getTotalProfitSharing = getTotalProfitSharing;
|
|
55
55
|
exports.getAccumulatedUser = getAccumulatedUser;
|
|
56
56
|
exports.getAccumulatedNotionalVolumeUSD = getAccumulatedNotionalVolumeUSD;
|
|
57
|
+
exports.getSafuAccumulatedRewardGeneratedUSD = getSafuAccumulatedRewardGeneratedUSD;
|
|
57
58
|
var constants_1 = require("../../../../src/constants");
|
|
58
59
|
var headers = {
|
|
59
60
|
"api-key": "tz3JJ6stG7Fux6ueRSRA5mdpC9U0lozI3",
|
|
@@ -504,3 +505,56 @@ function getAccumulatedNotionalVolumeUSD() {
|
|
|
504
505
|
});
|
|
505
506
|
});
|
|
506
507
|
}
|
|
508
|
+
/** Returns Safu Accumulated Rewards im USD */
|
|
509
|
+
function getSafuAccumulatedRewardGeneratedUSD() {
|
|
510
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
511
|
+
var apiUrl, requestData, jsonData, response, data;
|
|
512
|
+
return __generator(this, function (_a) {
|
|
513
|
+
switch (_a.label) {
|
|
514
|
+
case 0:
|
|
515
|
+
apiUrl = "https://app.sentio.xyz/api/v1/insights/typus/typus_v2/query";
|
|
516
|
+
requestData = {
|
|
517
|
+
timeRange: {
|
|
518
|
+
start: "now",
|
|
519
|
+
end: "now",
|
|
520
|
+
step: 3600,
|
|
521
|
+
timezone: "Asia/Taipei",
|
|
522
|
+
},
|
|
523
|
+
limit: 1,
|
|
524
|
+
queries: [
|
|
525
|
+
{
|
|
526
|
+
metricsQuery: {
|
|
527
|
+
query: "SafuAccumulatedRewardGeneratedUSD",
|
|
528
|
+
alias: "",
|
|
529
|
+
id: "a",
|
|
530
|
+
labelSelector: {},
|
|
531
|
+
aggregate: {
|
|
532
|
+
op: "SUM",
|
|
533
|
+
grouping: [],
|
|
534
|
+
},
|
|
535
|
+
functions: [],
|
|
536
|
+
disabled: false,
|
|
537
|
+
},
|
|
538
|
+
dataSource: "METRICS",
|
|
539
|
+
sourceName: "",
|
|
540
|
+
},
|
|
541
|
+
],
|
|
542
|
+
formulas: [],
|
|
543
|
+
};
|
|
544
|
+
jsonData = JSON.stringify(requestData);
|
|
545
|
+
return [4 /*yield*/, fetch(apiUrl, {
|
|
546
|
+
method: "POST",
|
|
547
|
+
headers: headers,
|
|
548
|
+
body: jsonData,
|
|
549
|
+
})];
|
|
550
|
+
case 1:
|
|
551
|
+
response = _a.sent();
|
|
552
|
+
return [4 /*yield*/, response.json()];
|
|
553
|
+
case 2:
|
|
554
|
+
data = _a.sent();
|
|
555
|
+
// console.log(data.results[0].matrix.samples[0].values[0].value);
|
|
556
|
+
return [2 /*return*/, data.results[0].matrix.samples[0].values[0].value];
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
});
|
|
560
|
+
}
|