@typus/typus-sdk 1.2.68 → 1.2.69

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 (40) hide show
  1. package/lib/config.json +14 -14
  2. package/lib/utils/airdrop/authority-entry.d.ts +22 -0
  3. package/lib/utils/airdrop/authority-entry.js +138 -0
  4. package/lib/utils/airdrop/user-entry.d.ts +10 -0
  5. package/lib/utils/airdrop/user-entry.js +21 -0
  6. package/lib/utils/airdrop/view-functions.d.ts +10 -0
  7. package/lib/utils/airdrop/view-functions.js +72 -0
  8. package/lib/utils/leaderboard/authority-entry.d.ts +22 -0
  9. package/lib/utils/leaderboard/authority-entry.js +91 -0
  10. package/lib/utils/leaderboard/view-function.d.ts +21 -0
  11. package/lib/utils/leaderboard/view-function.js +92 -0
  12. package/lib/utils/typus-dov-single-v2/mfud-user-entry.d.ts +4 -0
  13. package/lib/utils/typus-dov-single-v2/mfud-user-entry.js +5 -1
  14. package/lib/utils/typus-dov-single-v2/user-entry.d.ts +4 -0
  15. package/lib/utils/typus-dov-single-v2/user-entry.js +10 -2
  16. package/lib/utils/user/view-functions.d.ts +9 -0
  17. package/lib/utils/user/view-functions.js +71 -0
  18. package/package.json +1 -1
  19. package/lib/utils/typus-dov-double/authorized-entry.d.ts +0 -102
  20. package/lib/utils/typus-dov-double/authorized-entry.js +0 -295
  21. package/lib/utils/typus-dov-double/manager-entry.d.ts +0 -219
  22. package/lib/utils/typus-dov-double/manager-entry.js +0 -584
  23. package/lib/utils/typus-dov-double/portfolio-vault.d.ts +0 -68
  24. package/lib/utils/typus-dov-double/portfolio-vault.js +0 -303
  25. package/lib/utils/typus-dov-double/user-entry.d.ts +0 -93
  26. package/lib/utils/typus-dov-double/user-entry.js +0 -280
  27. package/lib/utils/typus-dov-double/view-function.d.ts +0 -11
  28. package/lib/utils/typus-dov-double/view-function.js +0 -213
  29. package/lib/utils/typus-dov-single/db-data.d.ts +0 -19
  30. package/lib/utils/typus-dov-single/db-data.js +0 -226
  31. package/lib/utils/typus-dov-single/portfolio-vault.d.ts +0 -63
  32. package/lib/utils/typus-dov-single/portfolio-vault.js +0 -284
  33. package/lib/utils/typus-dov-single/registry.d.ts +0 -14
  34. package/lib/utils/typus-dov-single/registry.js +0 -126
  35. package/lib/utils/typus-dov-single/user-entry.d.ts +0 -103
  36. package/lib/utils/typus-dov-single/user-entry.js +0 -388
  37. package/lib/utils/typus-dov-single/user-history.d.ts +0 -17
  38. package/lib/utils/typus-dov-single/user-history.js +0 -146
  39. package/lib/utils/typus-dov-single/view-function.d.ts +0 -50
  40. package/lib/utils/typus-dov-single/view-function.js +0 -444
@@ -1,303 +0,0 @@
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
- var token_1 = require("../token");
43
- function getPortfolioVaults(provider, registry, token_deposit_vault_registry, usd_deposit_vault_registry, bid_vault_registry, index) {
44
- return __awaiter(this, void 0, void 0, function () {
45
- var portfolioVaultIds, portfolioVaults, tokenDepositVaultIds, usdDepositVaultIds, bidVaultIds;
46
- return __generator(this, function (_a) {
47
- switch (_a.label) {
48
- case 0:
49
- console.warn = function () { };
50
- return [4 /*yield*/, provider.getDynamicFields({ parentId: registry })];
51
- case 1:
52
- portfolioVaultIds = (_a.sent()).data
53
- .filter(function (x) { return (index ? x.name.value == index : true); })
54
- .map(function (x) { return x.objectId; });
55
- return [4 /*yield*/, provider.multiGetObjects({
56
- ids: portfolioVaultIds,
57
- options: { showContent: true },
58
- })];
59
- case 2:
60
- portfolioVaults = (_a.sent())
61
- .filter(function (portfolioVault) { return portfolioVault.error == undefined; })
62
- .reduce(function (map, portfolioVault) {
63
- // console.log(JSON.stringify(portfolioVault, null, 4));
64
- // @ts-ignore
65
- var vaultId = portfolioVault.data.content.fields.id.id;
66
- // @ts-ignore
67
- var typeArgs = new RegExp(".*<(.*), (.*), (.*)>").exec(portfolioVault.data.content.type).slice(1, 4);
68
- var assets = (0, token_1.typeArgsToAssets)(typeArgs);
69
- var oracleInfo = {
70
- // @ts-ignore
71
- price: portfolioVault.data.content.fields.info.fields.oracle_info.fields.price,
72
- // @ts-ignore
73
- decimal: portfolioVault.data.content.fields.info.fields.oracle_info.fields.decimal,
74
- };
75
- var deliveryInfo =
76
- // @ts-ignore
77
- portfolioVault.data.content.fields.info.fields.delivery_info
78
- ? {
79
- // @ts-ignore
80
- round: portfolioVault.data.content.fields.info.fields.delivery_info.fields.round,
81
- // @ts-ignore
82
- price: portfolioVault.data.content.fields.info.fields.delivery_info.fields.price,
83
- // @ts-ignore
84
- size: portfolioVault.data.content.fields.info.fields.delivery_info.fields.size,
85
- // @ts-ignore
86
- premium: portfolioVault.data.content.fields.info.fields.delivery_info.fields.premium,
87
- // @ts-ignore
88
- tsMs: portfolioVault.data.content.fields.info.fields.delivery_info.fields.ts_ms,
89
- }
90
- : undefined;
91
- var info = {
92
- // @ts-ignore
93
- index: portfolioVault.data.content.fields.info.fields.index,
94
- // @ts-ignore
95
- creator: portfolioVault.data.content.fields.info.fields.creator,
96
- // @ts-ignore
97
- createTsMs: portfolioVault.data.content.fields.info.fields.create_ts_ms,
98
- // @ts-ignore
99
- round: portfolioVault.data.content.fields.info.fields.round,
100
- oracleInfo: oracleInfo,
101
- deliveryInfo: deliveryInfo,
102
- };
103
- var config = {
104
- // @ts-ignore
105
- strategyName: portfolioVault.data.content.fields.config.fields.strategy_name,
106
- // @ts-ignore
107
- period: portfolioVault.data.content.fields.config.fields.period,
108
- // @ts-ignore
109
- activationTsMs: portfolioVault.data.content.fields.config.fields.activation_ts_ms,
110
- // @ts-ignore
111
- expirationTsMs: portfolioVault.data.content.fields.config.fields.expiration_ts_ms,
112
- // @ts-ignore
113
- oTokenDecimal: portfolioVault.data.content.fields.config.fields.o_token_decimal,
114
- // @ts-ignore
115
- uTokenDecimal: portfolioVault.data.content.fields.config.fields.u_token_decimal,
116
- // @ts-ignore
117
- bTokenDecimal: portfolioVault.data.content.fields.config.fields.b_token_decimal,
118
- // @ts-ignore
119
- lotSize: portfolioVault.data.content.fields.config.fields.lot_size,
120
- // @ts-ignore
121
- capacity: portfolioVault.data.content.fields.config.fields.capacity,
122
- // @ts-ignore
123
- leverage: portfolioVault.data.content.fields.config.fields.leverage,
124
- // @ts-ignore
125
- hasNext: portfolioVault.data.content.fields.config.fields.has_next,
126
- activeVaultConfig: {
127
- // @ts-ignore
128
- callPayoffConfigs: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.call_payoff_configs.map(function (x) {
129
- return ({
130
- strikePct: x.fields.strike_pct,
131
- weight: x.fields.weight,
132
- isBuyer: x.fields.is_buyer,
133
- strike: x.fields.strike,
134
- });
135
- }),
136
- // @ts-ignore
137
- putPayoffConfigs: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.put_payoff_configs.map(function (x) {
138
- return ({
139
- strikePct: x.fields.strike_pct,
140
- weight: x.fields.weight,
141
- isBuyer: x.fields.is_buyer,
142
- strike: x.fields.strike,
143
- });
144
- }),
145
- // @ts-ignore
146
- strikeIncrement: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.strike_increment,
147
- // @ts-ignore
148
- decaySpeed: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.decay_speed,
149
- // @ts-ignore
150
- initialPrice: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.initial_price,
151
- // @ts-ignore
152
- finalPrice: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.final_price,
153
- // @ts-ignore
154
- auctionDurationInMs: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.auction_duration_in_ms,
155
- },
156
- warmupVaultConfig: {
157
- // @ts-ignore
158
- callPayoffConfigs: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.call_payoff_configs.map(function (x) {
159
- return ({
160
- strikePct: x.fields.strike_pct,
161
- weight: x.fields.weight,
162
- isBuyer: x.fields.is_buyer,
163
- strike: x.fields.strike,
164
- });
165
- }),
166
- // @ts-ignore
167
- putPayoffConfigs: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.put_payoff_configs.map(function (x) {
168
- return ({
169
- strikePct: x.fields.strike_pct,
170
- weight: x.fields.weight,
171
- isBuyer: x.fields.is_buyer,
172
- strike: x.fields.strike,
173
- });
174
- }),
175
- // @ts-ignore
176
- strikeIncrement: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.strike_increment,
177
- // @ts-ignore
178
- decaySpeed: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.decay_speed,
179
- // @ts-ignore
180
- initialPrice: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.initial_price,
181
- // @ts-ignore
182
- finalPrice: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.final_price,
183
- // @ts-ignore
184
- auctionDurationInMs: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.auction_duration_in_ms,
185
- },
186
- upcomingVaultConfig: {
187
- // @ts-ignore
188
- callPayoffConfigs:
189
- // @ts-ignore
190
- portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.call_payoff_configs.map(function (x) {
191
- return ({
192
- strikePct: x.fields.strike_pct,
193
- weight: x.fields.weight,
194
- isBuyer: x.fields.is_buyer,
195
- strike: x.fields.strike,
196
- });
197
- }),
198
- // @ts-ignore
199
- putPayoffConfigs: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.put_payoff_configs.map(function (x) {
200
- return ({
201
- strikePct: x.fields.strike_pct,
202
- weight: x.fields.weight,
203
- isBuyer: x.fields.is_buyer,
204
- strike: x.fields.strike,
205
- });
206
- }),
207
- // @ts-ignore
208
- strikeIncrement: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.strike_increment,
209
- // @ts-ignore
210
- decaySpeed: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.decay_speed,
211
- // @ts-ignore
212
- initialPrice: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.initial_price,
213
- // @ts-ignore
214
- finalPrice: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.final_price,
215
- // @ts-ignore
216
- auctionDurationInMs:
217
- // @ts-ignore
218
- portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.auction_duration_in_ms,
219
- },
220
- };
221
- // @ts-ignore
222
- var auction = portfolioVault.data.content.fields.auction ? (0, dutch_1.parseAuction)(portfolioVault.data.content.fields.auction) : undefined;
223
- // @ts-ignore
224
- var authority = portfolioVault.data.content.fields.authority.fields.whitelist.fields.id.id;
225
- map[info.index] = {
226
- vaultId: vaultId,
227
- typeArgs: typeArgs,
228
- assets: assets,
229
- info: info,
230
- config: config,
231
- tokenDepositVault: {},
232
- usdDepositVault: {},
233
- bidVault: {},
234
- auction: auction,
235
- authority: authority,
236
- };
237
- return map;
238
- }, {});
239
- return [4 /*yield*/, provider.getDynamicFields({ parentId: token_deposit_vault_registry })];
240
- case 3:
241
- tokenDepositVaultIds = (_a.sent()).data
242
- .filter(function (x) { return (index ? x.name.value == index : true); })
243
- .map(function (x) { return x.objectId; });
244
- return [4 /*yield*/, provider.multiGetObjects({
245
- ids: tokenDepositVaultIds,
246
- options: { showContent: true },
247
- })];
248
- case 4:
249
- (_a.sent())
250
- .filter(function (tokenDepositVault) { return tokenDepositVault.error == undefined; })
251
- .forEach(function (tokenDepositVault) {
252
- // @ts-ignore
253
- var index = tokenDepositVault.data.content.fields.name;
254
- // @ts-ignore
255
- var depositVault = (0, vault_1.parseDepositVault)(tokenDepositVault.data.content.fields.value);
256
- var tvl = BigInt(depositVault.activeSubVault.balance) + BigInt(depositVault.warmupSubVault.balance);
257
- portfolioVaults[index].tokenTvl = tvl;
258
- portfolioVaults[index].tokenDepositVault = depositVault;
259
- });
260
- return [4 /*yield*/, provider.getDynamicFields({ parentId: usd_deposit_vault_registry })];
261
- case 5:
262
- usdDepositVaultIds = (_a.sent()).data
263
- .filter(function (x) { return (index ? x.name.value == index : true); })
264
- .map(function (x) { return x.objectId; });
265
- return [4 /*yield*/, provider.multiGetObjects({
266
- ids: usdDepositVaultIds,
267
- options: { showContent: true },
268
- })];
269
- case 6:
270
- (_a.sent())
271
- .filter(function (usdDepositVault) { return usdDepositVault.error == undefined; })
272
- .forEach(function (usdDepositVault) {
273
- // @ts-ignore
274
- var index = usdDepositVault.data.content.fields.name;
275
- // @ts-ignore
276
- var depositVault = (0, vault_1.parseDepositVault)(usdDepositVault.data.content.fields.value);
277
- var tvl = BigInt(depositVault.activeSubVault.balance) + BigInt(depositVault.warmupSubVault.balance);
278
- portfolioVaults[index].usdTvl = tvl;
279
- portfolioVaults[index].usdDepositVault = depositVault;
280
- });
281
- return [4 /*yield*/, provider.getDynamicFields({ parentId: bid_vault_registry })];
282
- case 7:
283
- bidVaultIds = (_a.sent()).data
284
- .filter(function (x) { return (index ? x.name.value == index : true); })
285
- .map(function (x) { return x.objectId; });
286
- return [4 /*yield*/, provider.multiGetObjects({
287
- ids: bidVaultIds,
288
- options: { showContent: true },
289
- })];
290
- case 8:
291
- (_a.sent())
292
- .filter(function (bidVault) { return bidVault.error == undefined; })
293
- .forEach(function (bidVault) {
294
- // @ts-ignore
295
- portfolioVaults[bidVault.data.content.fields.name].bidVault = (0, vault_1.parseBidVault)(bidVault.data.content.fields.value);
296
- });
297
- // @ts-ignore
298
- return [2 /*return*/, portfolioVaults];
299
- }
300
- });
301
- });
302
- }
303
- exports.getPortfolioVaults = getPortfolioVaults;
@@ -1,93 +0,0 @@
1
- import { TransactionBlock } from "@mysten/sui.js/transactions";
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>;