@typus/typus-sdk 1.0.29 → 1.0.30

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 (31) hide show
  1. package/lib/constants.d.ts +22 -0
  2. package/lib/constants.js +28 -0
  3. package/lib/utils/auction/sealedAuction.d.ts +33 -0
  4. package/lib/utils/auction/sealedAuction.js +64 -0
  5. package/lib/utils/leader-board.d.ts +7 -0
  6. package/lib/utils/leader-board.js +197 -0
  7. package/lib/utils/mint.d.ts +2 -0
  8. package/lib/utils/mint.js +58 -0
  9. package/lib/utils/tools.d.ts +1 -0
  10. package/lib/utils/tools.js +12 -0
  11. package/lib/utils/typus-dov-double/authorized-entry.d.ts +102 -0
  12. package/lib/utils/typus-dov-double/authorized-entry.js +295 -0
  13. package/lib/utils/typus-dov-double/manager-entry.d.ts +219 -0
  14. package/lib/utils/typus-dov-double/manager-entry.js +584 -0
  15. package/lib/utils/typus-dov-double/portfolio-vault.d.ts +68 -0
  16. package/lib/utils/typus-dov-double/portfolio-vault.js +296 -0
  17. package/lib/utils/typus-dov-double/user-entry.d.ts +93 -0
  18. package/lib/utils/typus-dov-double/user-entry.js +280 -0
  19. package/lib/utils/typus-dov-double/view-function.d.ts +11 -0
  20. package/lib/utils/typus-dov-double/view-function.js +213 -0
  21. package/lib/utils/typus-dov-single/portfolio-vault.d.ts +61 -0
  22. package/lib/utils/typus-dov-single/portfolio-vault.js +241 -0
  23. package/lib/utils/typus-dov-single/user-entry.d.ts +81 -0
  24. package/lib/utils/typus-dov-single/user-entry.js +284 -0
  25. package/lib/utils/typus-dov-single/view-function.d.ts +10 -0
  26. package/lib/utils/typus-dov-single/view-function.js +196 -0
  27. package/lib/utils/typus-framework/dutch.d.ts +25 -0
  28. package/lib/utils/typus-framework/dutch.js +84 -0
  29. package/lib/utils/typus-framework/vault.d.ts +32 -0
  30. package/lib/utils/typus-framework/vault.js +32 -0
  31. package/package.json +1 -1
@@ -0,0 +1,296 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getPortfolioVaults = void 0;
40
+ var vault_1 = require("../typus-framework/vault");
41
+ var dutch_1 = require("../typus-framework/dutch");
42
+ function getPortfolioVaults(provider, registry, token_deposit_vault_registry, usd_deposit_vault_registry, bid_vault_registry, index) {
43
+ return __awaiter(this, void 0, void 0, function () {
44
+ var portfolioVaultIds, portfolioVaults, tokenDepositVaultIds, usdDepositVaultIds, bidVaultIds;
45
+ return __generator(this, function (_a) {
46
+ switch (_a.label) {
47
+ case 0: return [4 /*yield*/, provider.getDynamicFields({ parentId: registry })];
48
+ case 1:
49
+ portfolioVaultIds = (_a.sent()).data
50
+ .filter(function (x) { return (index ? x.name.value == index : true); })
51
+ .map(function (x) { return x.objectId; });
52
+ return [4 /*yield*/, provider.multiGetObjects({
53
+ ids: portfolioVaultIds,
54
+ options: { showContent: true },
55
+ })];
56
+ case 2:
57
+ portfolioVaults = (_a.sent())
58
+ .filter(function (portfolioVault) { return portfolioVault.error == undefined; })
59
+ .reduce(function (map, portfolioVault) {
60
+ // console.log(JSON.stringify(portfolioVault, null, 4));
61
+ // @ts-ignore
62
+ var vaultId = portfolioVault.data.content.fields.id.id;
63
+ // @ts-ignore
64
+ var typeArgs = new RegExp(".*<(.*), (.*), (.*)>").exec(portfolioVault.data.content.type).slice(1, 4);
65
+ var assets = typeArgs.map(function (x) { return x.split("::")[2]; });
66
+ var oracleInfo = {
67
+ // @ts-ignore
68
+ price: portfolioVault.data.content.fields.info.fields.oracle_info.fields.price,
69
+ // @ts-ignore
70
+ decimal: portfolioVault.data.content.fields.info.fields.oracle_info.fields.decimal,
71
+ };
72
+ var deliveryInfo =
73
+ // @ts-ignore
74
+ portfolioVault.data.content.fields.info.fields.delivery_info
75
+ ? {
76
+ // @ts-ignore
77
+ round: portfolioVault.data.content.fields.info.fields.delivery_info.fields.round,
78
+ // @ts-ignore
79
+ price: portfolioVault.data.content.fields.info.fields.delivery_info.fields.price,
80
+ // @ts-ignore
81
+ size: portfolioVault.data.content.fields.info.fields.delivery_info.fields.size,
82
+ // @ts-ignore
83
+ premium: portfolioVault.data.content.fields.info.fields.delivery_info.fields.premium,
84
+ // @ts-ignore
85
+ tsMs: portfolioVault.data.content.fields.info.fields.delivery_info.fields.ts_ms,
86
+ }
87
+ : undefined;
88
+ var info = {
89
+ // @ts-ignore
90
+ index: portfolioVault.data.content.fields.info.fields.index,
91
+ // @ts-ignore
92
+ creator: portfolioVault.data.content.fields.info.fields.creator,
93
+ // @ts-ignore
94
+ createTsMs: portfolioVault.data.content.fields.info.fields.create_ts_ms,
95
+ // @ts-ignore
96
+ round: portfolioVault.data.content.fields.info.fields.round,
97
+ oracleInfo: oracleInfo,
98
+ deliveryInfo: deliveryInfo,
99
+ };
100
+ var config = {
101
+ // @ts-ignore
102
+ strategyName: portfolioVault.data.content.fields.config.fields.strategy_name,
103
+ // @ts-ignore
104
+ period: portfolioVault.data.content.fields.config.fields.period,
105
+ // @ts-ignore
106
+ activationTsMs: portfolioVault.data.content.fields.config.fields.activation_ts_ms,
107
+ // @ts-ignore
108
+ expirationTsMs: portfolioVault.data.content.fields.config.fields.expiration_ts_ms,
109
+ // @ts-ignore
110
+ oTokenDecimal: portfolioVault.data.content.fields.config.fields.o_token_decimal,
111
+ // @ts-ignore
112
+ uTokenDecimal: portfolioVault.data.content.fields.config.fields.u_token_decimal,
113
+ // @ts-ignore
114
+ bTokenDecimal: portfolioVault.data.content.fields.config.fields.b_token_decimal,
115
+ // @ts-ignore
116
+ lotSize: portfolioVault.data.content.fields.config.fields.lot_size,
117
+ // @ts-ignore
118
+ capacity: portfolioVault.data.content.fields.config.fields.capacity,
119
+ // @ts-ignore
120
+ leverage: portfolioVault.data.content.fields.config.fields.leverage,
121
+ // @ts-ignore
122
+ hasNext: portfolioVault.data.content.fields.config.fields.has_next,
123
+ activeVaultConfig: {
124
+ // @ts-ignore
125
+ callPayoffConfigs: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.call_payoff_configs.map(function (x) {
126
+ return ({
127
+ strikePct: x.fields.strike_pct,
128
+ weight: x.fields.weight,
129
+ isBuyer: x.fields.is_buyer,
130
+ strike: x.fields.strike,
131
+ });
132
+ }),
133
+ // @ts-ignore
134
+ putPayoffConfigs: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.put_payoff_configs.map(function (x) {
135
+ return ({
136
+ strikePct: x.fields.strike_pct,
137
+ weight: x.fields.weight,
138
+ isBuyer: x.fields.is_buyer,
139
+ strike: x.fields.strike,
140
+ });
141
+ }),
142
+ // @ts-ignore
143
+ strikeIncrement: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.strike_increment,
144
+ // @ts-ignore
145
+ decaySpeed: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.decay_speed,
146
+ // @ts-ignore
147
+ initialPrice: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.initial_price,
148
+ // @ts-ignore
149
+ finalPrice: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.final_price,
150
+ // @ts-ignore
151
+ auctionDurationInMs: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.auction_duration_in_ms,
152
+ },
153
+ warmupVaultConfig: {
154
+ // @ts-ignore
155
+ callPayoffConfigs: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.call_payoff_configs.map(function (x) {
156
+ return ({
157
+ strikePct: x.fields.strike_pct,
158
+ weight: x.fields.weight,
159
+ isBuyer: x.fields.is_buyer,
160
+ strike: x.fields.strike,
161
+ });
162
+ }),
163
+ // @ts-ignore
164
+ putPayoffConfigs: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.put_payoff_configs.map(function (x) {
165
+ return ({
166
+ strikePct: x.fields.strike_pct,
167
+ weight: x.fields.weight,
168
+ isBuyer: x.fields.is_buyer,
169
+ strike: x.fields.strike,
170
+ });
171
+ }),
172
+ // @ts-ignore
173
+ strikeIncrement: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.strike_increment,
174
+ // @ts-ignore
175
+ decaySpeed: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.decay_speed,
176
+ // @ts-ignore
177
+ initialPrice: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.initial_price,
178
+ // @ts-ignore
179
+ finalPrice: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.final_price,
180
+ // @ts-ignore
181
+ auctionDurationInMs: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.auction_duration_in_ms,
182
+ },
183
+ upcomingVaultConfig: {
184
+ // @ts-ignore
185
+ callPayoffConfigs: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.call_payoff_configs.map(function (x) {
186
+ return ({
187
+ strikePct: x.fields.strike_pct,
188
+ weight: x.fields.weight,
189
+ isBuyer: x.fields.is_buyer,
190
+ strike: x.fields.strike,
191
+ });
192
+ }),
193
+ // @ts-ignore
194
+ putPayoffConfigs: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.put_payoff_configs.map(function (x) {
195
+ return ({
196
+ strikePct: x.fields.strike_pct,
197
+ weight: x.fields.weight,
198
+ isBuyer: x.fields.is_buyer,
199
+ strike: x.fields.strike,
200
+ });
201
+ }),
202
+ // @ts-ignore
203
+ strikeIncrement: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.strike_increment,
204
+ // @ts-ignore
205
+ decaySpeed: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.decay_speed,
206
+ // @ts-ignore
207
+ initialPrice: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.initial_price,
208
+ // @ts-ignore
209
+ finalPrice: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.final_price,
210
+ // @ts-ignore
211
+ auctionDurationInMs: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.auction_duration_in_ms,
212
+ },
213
+ };
214
+ // @ts-ignore
215
+ var auction = portfolioVault.data.content.fields.auction ? (0, dutch_1.parseAuction)(portfolioVault.data.content.fields.auction) : undefined;
216
+ // @ts-ignore
217
+ var authority = portfolioVault.data.content.fields.authority.fields.whitelist.fields.id.id;
218
+ map[info.index] = {
219
+ vaultId: vaultId,
220
+ typeArgs: typeArgs,
221
+ assets: assets,
222
+ info: info,
223
+ config: config,
224
+ tokenDepositVault: {},
225
+ usdDepositVault: {},
226
+ bidVault: {},
227
+ auction: auction,
228
+ authority: authority,
229
+ };
230
+ return map;
231
+ }, {});
232
+ return [4 /*yield*/, provider.getDynamicFields({ parentId: token_deposit_vault_registry })];
233
+ case 3:
234
+ tokenDepositVaultIds = (_a.sent()).data
235
+ .filter(function (x) { return (index ? x.name.value == index : true); })
236
+ .map(function (x) { return x.objectId; });
237
+ return [4 /*yield*/, provider.multiGetObjects({
238
+ ids: tokenDepositVaultIds,
239
+ options: { showContent: true },
240
+ })];
241
+ case 4:
242
+ (_a.sent())
243
+ .filter(function (tokenDepositVault) { return tokenDepositVault.error == undefined; })
244
+ .forEach(function (tokenDepositVault) {
245
+ // @ts-ignore
246
+ var index = tokenDepositVault.data.content.fields.name;
247
+ // @ts-ignore
248
+ var depositVault = (0, vault_1.parseDepositVault)(tokenDepositVault.data.content.fields.value);
249
+ var tvl = BigInt(depositVault.activeSubVault.balance) + BigInt(depositVault.warmupSubVault.balance);
250
+ portfolioVaults[index].tokenTvl = tvl;
251
+ portfolioVaults[index].tokenDepositVault = depositVault;
252
+ });
253
+ return [4 /*yield*/, provider.getDynamicFields({ parentId: usd_deposit_vault_registry })];
254
+ case 5:
255
+ usdDepositVaultIds = (_a.sent()).data
256
+ .filter(function (x) { return (index ? x.name.value == index : true); })
257
+ .map(function (x) { return x.objectId; });
258
+ return [4 /*yield*/, provider.multiGetObjects({
259
+ ids: usdDepositVaultIds,
260
+ options: { showContent: true },
261
+ })];
262
+ case 6:
263
+ (_a.sent())
264
+ .filter(function (usdDepositVault) { return usdDepositVault.error == undefined; })
265
+ .forEach(function (usdDepositVault) {
266
+ // @ts-ignore
267
+ var index = usdDepositVault.data.content.fields.name;
268
+ // @ts-ignore
269
+ var depositVault = (0, vault_1.parseDepositVault)(usdDepositVault.data.content.fields.value);
270
+ var tvl = BigInt(depositVault.activeSubVault.balance) + BigInt(depositVault.warmupSubVault.balance);
271
+ portfolioVaults[index].usdTvl = tvl;
272
+ portfolioVaults[index].usdDepositVault = depositVault;
273
+ });
274
+ return [4 /*yield*/, provider.getDynamicFields({ parentId: bid_vault_registry })];
275
+ case 7:
276
+ bidVaultIds = (_a.sent()).data
277
+ .filter(function (x) { return (index ? x.name.value == index : true); })
278
+ .map(function (x) { return x.objectId; });
279
+ return [4 /*yield*/, provider.multiGetObjects({
280
+ ids: bidVaultIds,
281
+ options: { showContent: true },
282
+ })];
283
+ case 8:
284
+ (_a.sent())
285
+ .filter(function (bidVault) { return bidVault.error == undefined; })
286
+ .forEach(function (bidVault) {
287
+ // @ts-ignore
288
+ portfolioVaults[bidVault.data.content.fields.name].bidVault = (0, vault_1.parseBidVault)(bidVault.data.content.fields.value);
289
+ });
290
+ // @ts-ignore
291
+ return [2 /*return*/, portfolioVaults];
292
+ }
293
+ });
294
+ });
295
+ }
296
+ exports.getPortfolioVaults = getPortfolioVaults;
@@ -0,0 +1,93 @@
1
+ import { TransactionBlock } from "@mysten/sui.js";
2
+ /**
3
+ public(friend) entry fun deposit<O_TOKEN, U_TOKEN, B_TOKEN>(
4
+ registry: &mut Registry,
5
+ index: u64,
6
+ token_coins: vector<Coin<O_TOKEN>>,
7
+ usd_coins: vector<Coin<U_TOKEN>>,
8
+ token_amount: u64,
9
+ ctx: &mut TxContext
10
+ )
11
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token, Bid Vault Token]
12
+ */
13
+ export declare function getDepositTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, o_coins: string[], u_coins: string[], amount: string): Promise<TransactionBlock>;
14
+ /**
15
+ public(friend) entry fun withdraw<O_TOKEN, U_TOKEN, B_TOKEN>(
16
+ registry: &mut Registry,
17
+ index: u64,
18
+ share: Option<u64>,
19
+ ctx: &mut TxContext
20
+ )
21
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token, Bid Vault Token]
22
+ */
23
+ export declare function getWithdrawTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, share?: string): Promise<TransactionBlock>;
24
+ /**
25
+ public(friend) entry fun claim<O_TOKEN, U_TOKEN>(
26
+ registry: &mut Registry,
27
+ index: u64,
28
+ ctx: &mut TxContext
29
+ )
30
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token]
31
+ */
32
+ export declare function getClaimTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string): Promise<TransactionBlock>;
33
+ /**
34
+ public(friend) entry fun harvest<TOKEN>(
35
+ registry: &mut Registry,
36
+ index: u64,
37
+ ctx: &mut TxContext
38
+ )
39
+ @param typeArguments [Bid Vault Token]
40
+ */
41
+ export declare function getHarvestTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string): Promise<TransactionBlock>;
42
+ /**
43
+ public(friend) entry fun claim_and_harvest<O_TOKEN, U_TOKEN, B_TOKEN>(
44
+ registry: &mut Registry,
45
+ index: u64,
46
+ ctx: &mut TxContext
47
+ )
48
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token, Bid Vault Token]
49
+ */
50
+ export declare function getClaimAndHarvestTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string): Promise<TransactionBlock>;
51
+ /**
52
+ public(friend) entry fun compound_token<TOKEN, U_TOKEN>(
53
+ registry: &mut Registry,
54
+ index: u64,
55
+ usd_coins: vector<Coin<U_TOKEN>>,
56
+ ctx: &mut TxContext,
57
+ )
58
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token]
59
+ */
60
+ export declare function getCompoundTokenTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, u_coins: string[]): Promise<TransactionBlock>;
61
+ /**
62
+ public(friend) entry fun compound_usd<O_TOKEN, TOKEN>(
63
+ registry: &mut Registry,
64
+ index: u64,
65
+ token_coins: vector<Coin<O_TOKEN>>,
66
+ ctx: &mut TxContext,
67
+ )
68
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token]
69
+ */
70
+ export declare function getCompoundUsdTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, o_coins: string[]): Promise<TransactionBlock>;
71
+ /**
72
+ public(friend) entry fun unsubscribe<O_TOKEN, U_TOKEN>(
73
+ registry: &mut Registry,
74
+ index: u64,
75
+ share: Option<u64>,
76
+ ctx: &mut TxContext
77
+ )
78
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token]
79
+ */
80
+ export declare function getUnsubscribeTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, share?: string): Promise<TransactionBlock>;
81
+ /**
82
+ public(friend) entry fun new_bid<O_TOKEN, U_TOKEN, B_TOKEN>(
83
+ registry: &mut Registry,
84
+ index: u64,
85
+ price_oracle: &Oracle<O_TOKEN>,
86
+ clock: &Clock,
87
+ coins: vector<Coin<B_TOKEN>>,
88
+ size: u64,
89
+ ctx: &mut TxContext,
90
+ )
91
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token, Bid Vault Token]
92
+ */
93
+ export declare function getNewBidTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, priceOracle: string, b_coins: string[], size: string): Promise<TransactionBlock>;
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getNewBidTx = exports.getUnsubscribeTx = exports.getCompoundUsdTx = exports.getCompoundTokenTx = exports.getClaimAndHarvestTx = exports.getHarvestTx = exports.getClaimTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
40
+ var sui_js_1 = require("@mysten/sui.js");
41
+ /**
42
+ public(friend) entry fun deposit<O_TOKEN, U_TOKEN, B_TOKEN>(
43
+ registry: &mut Registry,
44
+ index: u64,
45
+ token_coins: vector<Coin<O_TOKEN>>,
46
+ usd_coins: vector<Coin<U_TOKEN>>,
47
+ token_amount: u64,
48
+ ctx: &mut TxContext
49
+ )
50
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token, Bid Vault Token]
51
+ */
52
+ function getDepositTx(gasBudget, packageId, typeArguments, registry, index, o_coins, u_coins, amount) {
53
+ return __awaiter(this, void 0, void 0, function () {
54
+ var tx;
55
+ return __generator(this, function (_a) {
56
+ tx = new sui_js_1.TransactionBlock();
57
+ tx.moveCall({
58
+ target: "".concat(packageId, "::typus_dov_double::deposit"),
59
+ typeArguments: typeArguments,
60
+ arguments: [
61
+ tx.pure(registry),
62
+ tx.pure(index),
63
+ tx.makeMoveVec({ objects: o_coins.map(function (id) { return tx.object(id); }) }),
64
+ tx.makeMoveVec({ objects: u_coins.map(function (id) { return tx.object(id); }) }),
65
+ tx.pure(amount),
66
+ ],
67
+ });
68
+ tx.setGasBudget(gasBudget);
69
+ return [2 /*return*/, tx];
70
+ });
71
+ });
72
+ }
73
+ exports.getDepositTx = getDepositTx;
74
+ /**
75
+ public(friend) entry fun withdraw<O_TOKEN, U_TOKEN, B_TOKEN>(
76
+ registry: &mut Registry,
77
+ index: u64,
78
+ share: Option<u64>,
79
+ ctx: &mut TxContext
80
+ )
81
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token, Bid Vault Token]
82
+ */
83
+ function getWithdrawTx(gasBudget, packageId, typeArguments, registry, index, share) {
84
+ return __awaiter(this, void 0, void 0, function () {
85
+ var tx;
86
+ return __generator(this, function (_a) {
87
+ tx = new sui_js_1.TransactionBlock();
88
+ tx.moveCall({
89
+ target: "".concat(packageId, "::typus_dov_double::withdraw"),
90
+ typeArguments: typeArguments,
91
+ arguments: [tx.pure(registry), tx.pure(index), tx.pure(share ? [share] : [])],
92
+ });
93
+ tx.setGasBudget(gasBudget);
94
+ return [2 /*return*/, tx];
95
+ });
96
+ });
97
+ }
98
+ exports.getWithdrawTx = getWithdrawTx;
99
+ /**
100
+ public(friend) entry fun claim<O_TOKEN, U_TOKEN>(
101
+ registry: &mut Registry,
102
+ index: u64,
103
+ ctx: &mut TxContext
104
+ )
105
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token]
106
+ */
107
+ function getClaimTx(gasBudget, packageId, typeArguments, registry, index) {
108
+ return __awaiter(this, void 0, void 0, function () {
109
+ var tx;
110
+ return __generator(this, function (_a) {
111
+ tx = new sui_js_1.TransactionBlock();
112
+ tx.moveCall({
113
+ target: "".concat(packageId, "::typus_dov_double::claim"),
114
+ typeArguments: typeArguments,
115
+ arguments: [tx.pure(registry), tx.pure(index)],
116
+ });
117
+ tx.setGasBudget(gasBudget);
118
+ return [2 /*return*/, tx];
119
+ });
120
+ });
121
+ }
122
+ exports.getClaimTx = getClaimTx;
123
+ /**
124
+ public(friend) entry fun harvest<TOKEN>(
125
+ registry: &mut Registry,
126
+ index: u64,
127
+ ctx: &mut TxContext
128
+ )
129
+ @param typeArguments [Bid Vault Token]
130
+ */
131
+ function getHarvestTx(gasBudget, packageId, typeArguments, registry, index) {
132
+ return __awaiter(this, void 0, void 0, function () {
133
+ var tx;
134
+ return __generator(this, function (_a) {
135
+ tx = new sui_js_1.TransactionBlock();
136
+ tx.moveCall({
137
+ target: "".concat(packageId, "::typus_dov_double::harvest"),
138
+ typeArguments: typeArguments,
139
+ arguments: [tx.pure(registry), tx.pure(index)],
140
+ });
141
+ tx.setGasBudget(gasBudget);
142
+ return [2 /*return*/, tx];
143
+ });
144
+ });
145
+ }
146
+ exports.getHarvestTx = getHarvestTx;
147
+ /**
148
+ public(friend) entry fun claim_and_harvest<O_TOKEN, U_TOKEN, B_TOKEN>(
149
+ registry: &mut Registry,
150
+ index: u64,
151
+ ctx: &mut TxContext
152
+ )
153
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token, Bid Vault Token]
154
+ */
155
+ function getClaimAndHarvestTx(gasBudget, packageId, typeArguments, registry, index) {
156
+ return __awaiter(this, void 0, void 0, function () {
157
+ var tx;
158
+ return __generator(this, function (_a) {
159
+ tx = new sui_js_1.TransactionBlock();
160
+ tx.moveCall({
161
+ target: "".concat(packageId, "::typus_dov_double::claim_and_harvest"),
162
+ typeArguments: typeArguments,
163
+ arguments: [tx.pure(registry), tx.pure(index)],
164
+ });
165
+ tx.setGasBudget(gasBudget);
166
+ return [2 /*return*/, tx];
167
+ });
168
+ });
169
+ }
170
+ exports.getClaimAndHarvestTx = getClaimAndHarvestTx;
171
+ /**
172
+ public(friend) entry fun compound_token<TOKEN, U_TOKEN>(
173
+ registry: &mut Registry,
174
+ index: u64,
175
+ usd_coins: vector<Coin<U_TOKEN>>,
176
+ ctx: &mut TxContext,
177
+ )
178
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token]
179
+ */
180
+ function getCompoundTokenTx(gasBudget, packageId, typeArguments, registry, index, u_coins) {
181
+ return __awaiter(this, void 0, void 0, function () {
182
+ var tx;
183
+ return __generator(this, function (_a) {
184
+ tx = new sui_js_1.TransactionBlock();
185
+ tx.moveCall({
186
+ target: "".concat(packageId, "::typus_dov_double::compound_token"),
187
+ typeArguments: typeArguments,
188
+ arguments: [tx.pure(registry), tx.pure(index), tx.makeMoveVec({ objects: u_coins.map(function (id) { return tx.object(id); }) })],
189
+ });
190
+ tx.setGasBudget(gasBudget);
191
+ return [2 /*return*/, tx];
192
+ });
193
+ });
194
+ }
195
+ exports.getCompoundTokenTx = getCompoundTokenTx;
196
+ /**
197
+ public(friend) entry fun compound_usd<O_TOKEN, TOKEN>(
198
+ registry: &mut Registry,
199
+ index: u64,
200
+ token_coins: vector<Coin<O_TOKEN>>,
201
+ ctx: &mut TxContext,
202
+ )
203
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token]
204
+ */
205
+ function getCompoundUsdTx(gasBudget, packageId, typeArguments, registry, index, o_coins) {
206
+ return __awaiter(this, void 0, void 0, function () {
207
+ var tx;
208
+ return __generator(this, function (_a) {
209
+ tx = new sui_js_1.TransactionBlock();
210
+ tx.moveCall({
211
+ target: "".concat(packageId, "::typus_dov_double::compound_usd"),
212
+ typeArguments: typeArguments,
213
+ arguments: [tx.pure(registry), tx.pure(index), tx.makeMoveVec({ objects: o_coins.map(function (id) { return tx.object(id); }) })],
214
+ });
215
+ tx.setGasBudget(gasBudget);
216
+ return [2 /*return*/, tx];
217
+ });
218
+ });
219
+ }
220
+ exports.getCompoundUsdTx = getCompoundUsdTx;
221
+ /**
222
+ public(friend) entry fun unsubscribe<O_TOKEN, U_TOKEN>(
223
+ registry: &mut Registry,
224
+ index: u64,
225
+ share: Option<u64>,
226
+ ctx: &mut TxContext
227
+ )
228
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token]
229
+ */
230
+ function getUnsubscribeTx(gasBudget, packageId, typeArguments, registry, index, share) {
231
+ return __awaiter(this, void 0, void 0, function () {
232
+ var tx;
233
+ return __generator(this, function (_a) {
234
+ tx = new sui_js_1.TransactionBlock();
235
+ tx.moveCall({
236
+ target: "".concat(packageId, "::typus_dov_double::unsubscribe"),
237
+ typeArguments: typeArguments,
238
+ arguments: [tx.pure(registry), tx.pure(index), tx.pure(share ? [share] : [])],
239
+ });
240
+ tx.setGasBudget(gasBudget);
241
+ return [2 /*return*/, tx];
242
+ });
243
+ });
244
+ }
245
+ exports.getUnsubscribeTx = getUnsubscribeTx;
246
+ /**
247
+ public(friend) entry fun new_bid<O_TOKEN, U_TOKEN, B_TOKEN>(
248
+ registry: &mut Registry,
249
+ index: u64,
250
+ price_oracle: &Oracle<O_TOKEN>,
251
+ clock: &Clock,
252
+ coins: vector<Coin<B_TOKEN>>,
253
+ size: u64,
254
+ ctx: &mut TxContext,
255
+ )
256
+ @param typeArguments [Token Deposit Vault Token, Usd Deposit Vault Token, Bid Vault Token]
257
+ */
258
+ function getNewBidTx(gasBudget, packageId, typeArguments, registry, index, priceOracle, b_coins, size) {
259
+ return __awaiter(this, void 0, void 0, function () {
260
+ var tx;
261
+ return __generator(this, function (_a) {
262
+ tx = new sui_js_1.TransactionBlock();
263
+ tx.moveCall({
264
+ target: "".concat(packageId, "::typus_dov_double::new_bid"),
265
+ typeArguments: typeArguments,
266
+ arguments: [
267
+ tx.pure(registry),
268
+ tx.pure(index),
269
+ tx.pure(priceOracle),
270
+ tx.pure("0x6"),
271
+ tx.makeMoveVec({ objects: b_coins.map(function (id) { return tx.object(id); }) }),
272
+ tx.pure(size),
273
+ ],
274
+ });
275
+ tx.setGasBudget(gasBudget);
276
+ return [2 /*return*/, tx];
277
+ });
278
+ });
279
+ }
280
+ exports.getNewBidTx = getNewBidTx;