@typus/typus-sdk 1.4.17 → 1.4.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.
Files changed (37) hide show
  1. package/dist/config-mainnet.json +3 -3
  2. package/dist/src/auto-bid/token-user-entry.d.ts +9 -0
  3. package/dist/src/auto-bid/token-user-entry.js +126 -0
  4. package/dist/src/typus/airdrop/authority-entry.d.ts +14 -2
  5. package/dist/src/typus/airdrop/authority-entry.js +27 -32
  6. package/dist/src/typus/airdrop/user-entry.d.ts +2 -5
  7. package/dist/src/typus/airdrop/user-entry.js +8 -8
  8. package/dist/src/typus/airdrop/view-function.d.ts +2 -5
  9. package/dist/src/typus/airdrop/view-function.js +5 -5
  10. package/dist/src/typus/leaderboard/authority-entry.d.ts +10 -2
  11. package/dist/src/typus/leaderboard/authority-entry.js +12 -13
  12. package/dist/src/typus/leaderboard/view-function.d.ts +2 -5
  13. package/dist/src/typus/leaderboard/view-function.js +6 -6
  14. package/dist/src/typus/tails-staking/authority-entry.d.ts +12 -55
  15. package/dist/src/typus/tails-staking/authority-entry.js +73 -97
  16. package/dist/src/typus/tails-staking/user-entry.d.ts +14 -44
  17. package/dist/src/typus/tails-staking/user-entry.js +123 -123
  18. package/dist/src/typus/tails-staking/view-function.d.ts +3 -11
  19. package/dist/src/typus/tails-staking/view-function.js +10 -10
  20. package/dist/src/typus/user/view-function.d.ts +2 -5
  21. package/dist/src/typus/user/view-function.js +5 -5
  22. package/dist/src/typus-dov-single-v2/authority-entry.d.ts +26 -18
  23. package/dist/src/typus-dov-single-v2/authority-entry.js +23 -114
  24. package/dist/src/typus-dov-single-v2/function/bidding.js +4 -5
  25. package/dist/src/typus-dov-single-v2/token-user-entry.d.ts +11 -84
  26. package/dist/src/typus-dov-single-v2/token-user-entry.js +191 -316
  27. package/dist/src/typus-dov-single-v2/user-entry.d.ts +11 -69
  28. package/dist/src/typus-dov-single-v2/user-entry.js +183 -194
  29. package/dist/src/typus-dov-single-v2/view-function.d.ts +20 -6
  30. package/dist/src/typus-dov-single-v2/view-function.js +37 -43
  31. package/dist/src/typus-perp/user/orderWithBidReceipt.js +1 -5
  32. package/dist/src/typus-safu/index.d.ts +2 -1
  33. package/dist/src/typus-safu/index.js +2 -1
  34. package/dist/src/typus-safu/user-history.d.ts +12 -0
  35. package/dist/src/typus-safu/user-history.js +312 -0
  36. package/dist/src/utils/typusConfig.d.ts +1 -0
  37. package/package.json +1 -1
@@ -35,132 +35,41 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
- var __read = (this && this.__read) || function (o, n) {
39
- var m = typeof Symbol === "function" && o[Symbol.iterator];
40
- if (!m) return o;
41
- var i = m.call(o), r, ar = [], e;
42
- try {
43
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
- }
45
- catch (error) { e = { error: error }; }
46
- finally {
47
- try {
48
- if (r && !r.done && (m = i["return"])) m.call(i);
49
- }
50
- finally { if (e) throw e.error; }
51
- }
52
- return ar;
53
- };
54
38
  Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.getOtcTx = getOtcTx;
56
39
  exports.getUpdateConfigTx = getUpdateConfigTx;
57
- var transactions_1 = require("@mysten/sui.js/transactions");
58
- var constants_1 = require("../constants");
59
- /**
60
- public(friend) entry fun otc<D_TOKEN, B_TOKEN>(
61
- registry: &mut Registry,
62
- index: u64,
63
- coins: vector<Coin<B_TOKEN>>,
64
- delivery_price: u64,
65
- delivery_size: u64,
66
- bidder_bid_value: u64,
67
- bidder_fee_balance_value: u64,
68
- incentive_bid_value: u64,
69
- incentive_fee_balance_value: u64,
70
- depositor_incentive_value: u64,
71
- clock: &Clock,
72
- ctx: &mut TxContext,
73
- )
74
- */
75
- function getOtcTx(gasBudget_1, packageId_1, typeArguments_1, registry_1, index_1, coins_1, deliveryPrice_1, deliverySize_1, bidderBidValue_1, bidderFeeBalanceValue_1, incentiveBidValue_1, incentiveFeeBalanceValue_1, depositorIncentiveValue_1) {
76
- return __awaiter(this, arguments, void 0, function (gasBudget, packageId, typeArguments, registry, index, coins, deliveryPrice, deliverySize, bidderBidValue, bidderFeeBalanceValue, incentiveBidValue, incentiveFeeBalanceValue, depositorIncentiveValue, usingSponsoredGasCoin) {
77
- var tx, amount, _a, coin;
78
- if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
79
- return __generator(this, function (_b) {
80
- tx = new transactions_1.TransactionBlock();
81
- if (!usingSponsoredGasCoin &&
82
- (typeArguments[0] == "0x2::sui::SUI" ||
83
- typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
84
- amount = BigInt(bidderBidValue) + BigInt(bidderFeeBalanceValue);
85
- _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount.toString())]), 1), coin = _a[0];
86
- tx.moveCall({
87
- target: "".concat(packageId, "::tds_authorized_entry::otc"),
88
- typeArguments: typeArguments,
89
- arguments: [
90
- tx.object(registry),
91
- tx.pure(index),
92
- tx.makeMoveVec({ objects: [coin] }),
93
- tx.pure(deliveryPrice),
94
- tx.pure(deliverySize),
95
- tx.pure(bidderBidValue),
96
- tx.pure(bidderFeeBalanceValue),
97
- tx.pure(incentiveBidValue),
98
- tx.pure(incentiveFeeBalanceValue),
99
- tx.pure(depositorIncentiveValue),
100
- tx.object(constants_1.CLOCK),
101
- ],
102
- });
103
- }
104
- else {
105
- tx.moveCall({
106
- target: "".concat(packageId, "::tds_authorized_entry::otc"),
107
- typeArguments: typeArguments,
108
- arguments: [
109
- tx.object(registry),
110
- tx.pure(index),
111
- tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
112
- tx.pure(deliveryPrice),
113
- tx.pure(deliverySize),
114
- tx.pure(bidderBidValue),
115
- tx.pure(bidderFeeBalanceValue),
116
- tx.pure(incentiveBidValue),
117
- tx.pure(incentiveFeeBalanceValue),
118
- tx.pure(depositorIncentiveValue),
119
- tx.object(constants_1.CLOCK),
120
- ],
121
- });
122
- }
123
- tx.setGasBudget(gasBudget);
124
- return [2 /*return*/, tx];
125
- });
126
- });
127
- }
128
- function getUpdateConfigTx(gasBudget, packageId, registry, requests) {
40
+ function getUpdateConfigTx(config, tx, requests) {
129
41
  return __awaiter(this, void 0, void 0, function () {
130
- var tx;
131
42
  return __generator(this, function (_a) {
132
- tx = new transactions_1.TransactionBlock();
133
43
  requests.forEach(function (request) {
134
44
  tx.moveCall({
135
- target: "".concat(packageId, "::tds_authorized_entry::update_config"),
45
+ target: "".concat(config.package.dovSingle, "::tds_authorized_entry::update_config"),
136
46
  typeArguments: [],
137
47
  arguments: [
138
- tx.object(registry),
48
+ tx.object(config.registry.dov.dovSingle),
139
49
  tx.pure(request.index),
140
- tx.pure(request.config.oracleId ? [request.config.oracleId] : []),
141
- tx.pure(request.config.depositLotSize ? [request.config.depositLotSize] : []),
142
- tx.pure(request.config.bidLotSize ? [request.config.bidLotSize] : []),
143
- tx.pure(request.config.minDepositSize ? [request.config.minDepositSize] : []),
144
- tx.pure(request.config.minBidSize ? [request.config.minBidSize] : []),
145
- tx.pure(request.config.maxDepositEntry ? [request.config.maxDepositEntry] : []),
146
- tx.pure(request.config.maxBidEntry ? [request.config.maxBidEntry] : []),
147
- tx.pure(request.config.depositFeeBp ? [request.config.depositFeeBp] : []),
148
- tx.pure(request.config.depositFeeShareBp ? [request.config.depositFeeShareBp] : []),
149
- tx.pure(request.config.depositSharedFeePool ? [request.config.depositSharedFeePool] : []),
150
- tx.pure(request.config.bidFeeBp ? [request.config.bidFeeBp] : []),
151
- tx.pure(request.config.depositIncentiveBp ? [request.config.depositIncentiveBp] : []),
152
- tx.pure(request.config.bidIncentiveBp ? [request.config.bidIncentiveBp] : []),
153
- tx.pure(request.config.auctionDelayTsMs ? [request.config.auctionDelayTsMs] : []),
154
- tx.pure(request.config.auctionDurationTsMs ? [request.config.auctionDurationTsMs] : []),
155
- tx.pure(request.config.recoupDelayTsMs ? [request.config.recoupDelayTsMs] : []),
156
- tx.pure(request.config.capacity ? [request.config.capacity] : []),
157
- tx.pure(request.config.leverage ? [request.config.leverage] : []),
158
- tx.pure(request.config.riskLevel ? [request.config.riskLevel] : []),
159
- tx.pure(request.config.depositIncentiveBpDivisorDecimal ? [request.config.depositIncentiveBpDivisorDecimal] : []),
50
+ tx.pure(request.input.oracleId ? [request.input.oracleId] : []),
51
+ tx.pure(request.input.depositLotSize ? [request.input.depositLotSize] : []),
52
+ tx.pure(request.input.bidLotSize ? [request.input.bidLotSize] : []),
53
+ tx.pure(request.input.minDepositSize ? [request.input.minDepositSize] : []),
54
+ tx.pure(request.input.minBidSize ? [request.input.minBidSize] : []),
55
+ tx.pure(request.input.maxDepositEntry ? [request.input.maxDepositEntry] : []),
56
+ tx.pure(request.input.maxBidEntry ? [request.input.maxBidEntry] : []),
57
+ tx.pure(request.input.depositFeeBp ? [request.input.depositFeeBp] : []),
58
+ tx.pure(request.input.depositFeeShareBp ? [request.input.depositFeeShareBp] : []),
59
+ tx.pure(request.input.depositSharedFeePool ? [request.input.depositSharedFeePool] : []),
60
+ tx.pure(request.input.bidFeeBp ? [request.input.bidFeeBp] : []),
61
+ tx.pure(request.input.depositIncentiveBp ? [request.input.depositIncentiveBp] : []),
62
+ tx.pure(request.input.bidIncentiveBp ? [request.input.bidIncentiveBp] : []),
63
+ tx.pure(request.input.auctionDelayTsMs ? [request.input.auctionDelayTsMs] : []),
64
+ tx.pure(request.input.auctionDurationTsMs ? [request.input.auctionDurationTsMs] : []),
65
+ tx.pure(request.input.recoupDelayTsMs ? [request.input.recoupDelayTsMs] : []),
66
+ tx.pure(request.input.capacity ? [request.input.capacity] : []),
67
+ tx.pure(request.input.leverage ? [request.input.leverage] : []),
68
+ tx.pure(request.input.riskLevel ? [request.input.riskLevel] : []),
69
+ tx.pure(request.input.depositIncentiveBpDivisorDecimal ? [request.input.depositIncentiveBpDivisorDecimal] : []),
160
70
  ],
161
71
  });
162
72
  });
163
- tx.setGasBudget(gasBudget);
164
73
  return [2 /*return*/, tx];
165
74
  });
166
75
  });
@@ -669,7 +669,7 @@ exports.getUserBidReceipts = getUserBidReceipts;
669
669
  * @return User Bids.
670
670
  */
671
671
  var fetchUserBids = function (provider, config, userAddress, prices) { return __awaiter(void 0, void 0, void 0, function () {
672
- var packageAddress, registryAddress, originFramworkAddress, framworkAddress, strategyPoolAddress, vaultsInfo, userReceipts, userStrategies, auctions, _a, sortedBidReceipts, bidVaultsInfo, bidShares, bidsFromBidShares, _loop_1, bidVaultsInfo_1, bidVaultsInfo_1_1, bidVaultInfo, autoBidsShares, vaultAutoBidReceipts, userStrategies_1, userStrategies_1_1, strategy, receipts, receipts_1, receipts_1_1, receiptItem, vaultIndex, receipt, autoBidVaultInfos, bidsFromStrategies, _loop_2, autoBidVaultInfos_1, autoBidVaultInfos_1_1, autoBidVaultInfo, byOrdered;
672
+ var packageAddress, registryAddress, originFramworkAddress, strategyPoolAddress, vaultsInfo, userReceipts, userStrategies, auctions, _a, sortedBidReceipts, bidVaultsInfo, bidShares, bidsFromBidShares, _loop_1, bidVaultsInfo_1, bidVaultsInfo_1_1, bidVaultInfo, autoBidsShares, vaultAutoBidReceipts, userStrategies_1, userStrategies_1_1, strategy, receipts, receipts_1, receipts_1_1, receiptItem, vaultIndex, receipt, autoBidVaultInfos, bidsFromStrategies, _loop_2, autoBidVaultInfos_1, autoBidVaultInfos_1_1, autoBidVaultInfo, byOrdered;
673
673
  var e_2, _b, e_3, _c, e_4, _d, e_5, _e;
674
674
  return __generator(this, function (_f) {
675
675
  switch (_f.label) {
@@ -677,9 +677,8 @@ var fetchUserBids = function (provider, config, userAddress, prices) { return __
677
677
  packageAddress = config.package.dovSingle;
678
678
  registryAddress = config.registry.dov.dovSingle;
679
679
  originFramworkAddress = config.packageOrigin.framework;
680
- framworkAddress = config.package.framework;
681
680
  strategyPoolAddress = config.object.strategyPool;
682
- return [4 /*yield*/, (0, view_function_1.getVaults)(provider, packageAddress, registryAddress, [])];
681
+ return [4 /*yield*/, (0, view_function_1.getVaults)(config, provider, { indexes: [] })];
683
682
  case 1:
684
683
  vaultsInfo = _f.sent();
685
684
  return [4 /*yield*/, (0, exports.getUserBidReceipts)(provider, originFramworkAddress, userAddress)];
@@ -688,7 +687,7 @@ var fetchUserBids = function (provider, config, userAddress, prices) { return __
688
687
  return [4 /*yield*/, (0, auto_bid_1.getUserStrategies)(provider, packageAddress, registryAddress, strategyPoolAddress, userAddress)];
689
688
  case 3:
690
689
  userStrategies = _f.sent();
691
- return [4 /*yield*/, (0, view_function_1.getAuctions)(provider, packageAddress, registryAddress, [])];
690
+ return [4 /*yield*/, (0, view_function_1.getAuctions)(config, provider, { indexes: [] })];
692
691
  case 4:
693
692
  auctions = _f.sent();
694
693
  if (!(typeof prices === "undefined")) return [3 /*break*/, 6];
@@ -698,7 +697,7 @@ var fetchUserBids = function (provider, config, userAddress, prices) { return __
698
697
  _f.label = 6;
699
698
  case 6:
700
699
  _a = (0, exports.parseBidReceipt)(Object.values(vaultsInfo), userReceipts), sortedBidReceipts = _a.sortedBidReceipts, bidVaultsInfo = _a.bidVaultsInfo;
701
- return [4 /*yield*/, (0, view_function_1.getMyBids)(provider, framworkAddress, packageAddress, registryAddress, sortedBidReceipts)];
700
+ return [4 /*yield*/, (0, view_function_1.getMyBids)(config, provider, { receipts: sortedBidReceipts })];
702
701
  case 7:
703
702
  bidShares = _f.sent();
704
703
  bidsFromBidShares = [];
@@ -1,16 +1,8 @@
1
1
  import { TransactionBlock, TransactionObjectArgument } from "@mysten/sui.js/transactions";
2
- export declare function getMfudRaiseFundTx(input: {
3
- tx: TransactionBlock;
4
- typusEcosystemVersion: string;
5
- typusUserRegistry: string;
6
- typusLeaderboardRegistry: string;
7
- typusFrameworkOriginPackageId: string;
8
- typusDovSinglePackageId: string;
9
- typusDovSingleRegistry: string;
10
- typusTokenPackageId: string;
11
- typusTokenRegistry: string;
12
- typusTokenType: string;
2
+ import { TypusConfig } from "src/utils";
3
+ export declare function getTokenRaiseFundTx(config: TypusConfig, tx: TransactionBlock, input: {
13
4
  typeArguments: string[];
5
+ typusTokenType: string;
14
6
  index: string;
15
7
  receipts: string[] | TransactionObjectArgument[];
16
8
  raiseCoins: string[];
@@ -19,18 +11,8 @@ export declare function getMfudRaiseFundTx(input: {
19
11
  raiseFromInactive: boolean;
20
12
  user: string;
21
13
  }): TransactionBlock;
22
- export declare function getMfudReduceFundTx(input: {
23
- tx: TransactionBlock;
24
- typusEcosystemVersion: string;
25
- typusUserRegistry: string;
26
- typusLeaderboardRegistry: string;
27
- typusFrameworkOriginPackageId: string;
28
- typusFrameworkPackageId: string;
29
- typusDovSinglePackageId: string;
30
- typusDovSingleRegistry: string;
14
+ export declare function getTokenReduceFundTx(config: TypusConfig, tx: TransactionBlock, input: {
31
15
  typeArguments: string[];
32
- typusTokenPackageId: string;
33
- typusTokenRegistry: string;
34
16
  typusTokenType: string;
35
17
  index: string;
36
18
  receipts: string[] | TransactionObjectArgument[];
@@ -41,84 +23,29 @@ export declare function getMfudReduceFundTx(input: {
41
23
  reduceFromIncentive: boolean;
42
24
  user: string;
43
25
  }): TransactionBlock;
44
- export declare function getMfudDepositTx(input: {
45
- tx: TransactionBlock;
46
- typusEcosystemVersion: string;
47
- typusUserRegistry: string;
48
- typusLeaderboardRegistry: string;
49
- typusFrameworkOriginPackageId: string;
50
- typusDovSinglePackageId: string;
51
- typusDovSingleRegistry: string;
52
- mfudPackageId: string;
53
- mfudRegistry: string;
54
- mfudAmount: string;
55
- typeArguments: string[];
56
- index: string;
57
- receipts: string[] | TransactionObjectArgument[];
58
- user: string;
59
- coins: string[];
60
- }): TransactionBlock;
61
- export declare function getMfudNewBidTx(input: {
62
- tx: TransactionBlock;
63
- typusEcosystemVersion: string;
64
- typusUserRegistry: string;
65
- tgldRegistry: string;
66
- typusLeaderboardRegistry: string;
67
- typusFrameworkPackageId: string;
68
- typusDovSinglePackageId: string;
69
- typusDovSingleRegistry: string;
70
- mfudPackageId: string;
71
- mfudRegistry: string;
26
+ export declare function getTokenNewBidTx(config: TypusConfig, tx: TransactionBlock, input: {
72
27
  typeArguments: string[];
28
+ typusTokenType: string;
73
29
  index: string;
74
30
  coins: string[];
75
31
  size: string;
76
32
  premium_required: string;
77
33
  user: string;
78
34
  }): TransactionBlock;
79
- export declare function getMfudExerciseTx(input: {
80
- tx: TransactionBlock;
81
- typusFrameworkOriginPackageId: string;
82
- typusFrameworkPackageId: string;
83
- typusDovSinglePackageId: string;
84
- typusDovSingleRegistry: string;
85
- mfudPackageId: string;
86
- mfudRegistry: string;
35
+ export declare function getTokenExerciseTx(config: TypusConfig, tx: TransactionBlock, input: {
87
36
  typeArguments: string[];
37
+ typusTokenType: string;
88
38
  index: string;
89
39
  receipts: string[] | TransactionObjectArgument[];
90
40
  user: string;
91
41
  }): TransactionBlock;
92
- export declare function getMfudRebateTx(input: {
93
- tx: TransactionBlock;
94
- typusFrameworkPackageId: string;
95
- typusDovSinglePackageId: string;
96
- typusDovSingleRegistry: string;
97
- mfudPackageId: string;
98
- mfudRegistry: string;
42
+ export declare function getTokenRebateTx(config: TypusConfig, tx: TransactionBlock, input: {
99
43
  typeArgument: string;
44
+ typusTokenType: string;
100
45
  user: string;
101
46
  }): TransactionBlock;
102
- export declare function getMfudNewStrategyTx(gasBudget: number, packageId: string, typeArguments: string[], // D_TOKEN, B_TOKEN
103
- registry: string, strategy_pool: string, vault_index: string, signal_index: string, coins: string[], mfudPackageId: string, mfudRegistry: string, mfudAmount: string, size: string, price_percentage: string, max_times: string, target_rounds: string[]): TransactionBlock;
104
- export declare function getMfudUpdateStrategyTx(gasBudget: number, packageId: string, typeArguments: string[], // D_TOKEN, B_TOKEN
105
- registry: string, strategy_pool: string, vault_index: string, signal_index: string, strategy_index: string, coins: string[], mfudPackageId: string, mfudRegistry: string, mfudAmount: string, size: string | null, price_percentage: string | null, max_times: string | null, target_rounds: string[]): TransactionBlock;
106
- export declare function getMfudCloseStrategyTx(gasBudget: number, packageId: string, typeArguments: string[], // D_TOKEN, B_TOKEN
107
- registry: string, strategy_pool: string, vault_index: string, signal_index: string, strategy_index: string, mfudPackageId: string, mfudRegistry: string, sender: string): TransactionBlock;
108
- export declare function getMfudWithdrawProfitStrategyTx(gasBudget: number, packageId: string, typeArguments: string[], // D_TOKEN, B_TOKEN
109
- registry: string, strategy_pool: string, vault_index: string, signal_index: string, strategy_index: string, mfudPackageId: string, mfudRegistry: string, sender: string, txBlock?: TransactionBlock): TransactionBlock;
110
- export declare function getMfudCompoundWithRedeemTx(input: {
111
- tx: TransactionBlock;
112
- typusEcosystemVersion: string;
113
- typusUserRegistry: string;
114
- typusLeaderboardRegistry: string;
115
- typusFrameworkOriginPackageId: string;
116
- typusFrameworkPackageId: string;
117
- typusDovSinglePackageId: string;
118
- typusDovSingleRegistry: string;
47
+ export declare function getTokenCompoundWithRedeemTx(config: TypusConfig, tx: TransactionBlock, input: {
119
48
  typeArguments: string[];
120
- typusTokenPackageId: string;
121
- typusTokenRegistry: string;
122
49
  typusTokenType: string;
123
50
  index: string;
124
51
  receipts: string[] | TransactionObjectArgument[];