@typus/typus-sdk 1.0.27 → 1.0.29

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 (73) hide show
  1. package/package.json +2 -2
  2. package/lib/constants.d.ts +0 -22
  3. package/lib/constants.js +0 -35
  4. package/lib/utils/auction/sealedAuction.d.ts +0 -33
  5. package/lib/utils/auction/sealedAuction.js +0 -64
  6. package/lib/utils/portfolio/leader-board.d.ts +0 -7
  7. package/lib/utils/portfolio/leader-board.js +0 -197
  8. package/lib/utils/portfolio/mint.d.ts +0 -2
  9. package/lib/utils/portfolio/mint.js +0 -58
  10. package/lib/utils/portfolio/multiple-collateral/authorized-entry.d.ts +0 -102
  11. package/lib/utils/portfolio/multiple-collateral/authorized-entry.js +0 -295
  12. package/lib/utils/portfolio/multiple-collateral/manager-entry.d.ts +0 -219
  13. package/lib/utils/portfolio/multiple-collateral/manager-entry.js +0 -584
  14. package/lib/utils/portfolio/multiple-collateral/portfolio-vault.d.ts +0 -68
  15. package/lib/utils/portfolio/multiple-collateral/portfolio-vault.js +0 -296
  16. package/lib/utils/portfolio/multiple-collateral/user-entry.d.ts +0 -93
  17. package/lib/utils/portfolio/multiple-collateral/user-entry.js +0 -280
  18. package/lib/utils/portfolio/multiple-collateral/user-share.d.ts +0 -9
  19. package/lib/utils/portfolio/multiple-collateral/user-share.js +0 -166
  20. package/lib/utils/portfolio/multiple-collateral/view-function.d.ts +0 -9
  21. package/lib/utils/portfolio/multiple-collateral/view-function.js +0 -88
  22. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.d.ts +0 -5
  23. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.js +0 -61
  24. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedDeliveryTx.d.ts +0 -2
  25. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedDeliveryTx.js +0 -63
  26. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedNewPortfolioVaultTx.d.ts +0 -39
  27. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedNewPortfolioVaultTx.js +0 -118
  28. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.d.ts +0 -5
  29. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.js +0 -61
  30. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateCapacityTx.d.ts +0 -2
  31. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateCapacityTx.js +0 -58
  32. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateUpcomingVaultConfigTx.d.ts +0 -5
  33. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateUpcomingVaultConfigTx.js +0 -72
  34. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateWarmupVaultConfigTx.d.ts +0 -2
  35. package/lib/utils/portfolio/single-collateral/authorized/getAuthorizedUpdateWarmupVaultConfigTx.js +0 -66
  36. package/lib/utils/portfolio/single-collateral/manager/getAddAuthorizedUserTx.d.ts +0 -9
  37. package/lib/utils/portfolio/single-collateral/manager/getAddAuthorizedUserTx.js +0 -65
  38. package/lib/utils/portfolio/single-collateral/manager/getAddPortfolioVaultAuthorizedUserTx.d.ts +0 -11
  39. package/lib/utils/portfolio/single-collateral/manager/getAddPortfolioVaultAuthorizedUserTx.js +0 -67
  40. package/lib/utils/portfolio/single-collateral/manager/getCloseAuctionTx.d.ts +0 -2
  41. package/lib/utils/portfolio/single-collateral/manager/getCloseAuctionTx.js +0 -64
  42. package/lib/utils/portfolio/single-collateral/manager/getCloseVaultTx.d.ts +0 -2
  43. package/lib/utils/portfolio/single-collateral/manager/getCloseVaultTx.js +0 -58
  44. package/lib/utils/portfolio/single-collateral/manager/getDeliveryTx.d.ts +0 -2
  45. package/lib/utils/portfolio/single-collateral/manager/getDeliveryTx.js +0 -64
  46. package/lib/utils/portfolio/single-collateral/manager/getEvolutionTx.d.ts +0 -16
  47. package/lib/utils/portfolio/single-collateral/manager/getEvolutionTx.js +0 -80
  48. package/lib/utils/portfolio/single-collateral/manager/getNewManagerTx.d.ts +0 -9
  49. package/lib/utils/portfolio/single-collateral/manager/getNewManagerTx.js +0 -65
  50. package/lib/utils/portfolio/single-collateral/manager/getNewPortfolioVaultTx.d.ts +0 -39
  51. package/lib/utils/portfolio/single-collateral/manager/getNewPortfolioVaultTx.js +0 -118
  52. package/lib/utils/portfolio/single-collateral/manager/getRemoveAuthorizedUserTx.d.ts +0 -9
  53. package/lib/utils/portfolio/single-collateral/manager/getRemoveAuthorizedUserTx.js +0 -65
  54. package/lib/utils/portfolio/single-collateral/manager/getRemoveManagerTx.d.ts +0 -7
  55. package/lib/utils/portfolio/single-collateral/manager/getRemoveManagerTx.js +0 -63
  56. package/lib/utils/portfolio/single-collateral/manager/getRemovePortfolioVaultAuthorizedUserTx.d.ts +0 -11
  57. package/lib/utils/portfolio/single-collateral/manager/getRemovePortfolioVaultAuthorizedUserTx.js +0 -67
  58. package/lib/utils/portfolio/single-collateral/manager/getUpdateCapacityTx.d.ts +0 -2
  59. package/lib/utils/portfolio/single-collateral/manager/getUpdateCapacityTx.js +0 -58
  60. package/lib/utils/portfolio/single-collateral/portfolio-vault.d.ts +0 -61
  61. package/lib/utils/portfolio/single-collateral/portfolio-vault.js +0 -241
  62. package/lib/utils/portfolio/single-collateral/user-entry.d.ts +0 -81
  63. package/lib/utils/portfolio/single-collateral/user-entry.js +0 -247
  64. package/lib/utils/portfolio/single-collateral/user-share.d.ts +0 -8
  65. package/lib/utils/portfolio/single-collateral/user-share.js +0 -139
  66. package/lib/utils/portfolio/single-collateral/view-function.d.ts +0 -11
  67. package/lib/utils/portfolio/single-collateral/view-function.js +0 -99
  68. package/lib/utils/tools.d.ts +0 -1
  69. package/lib/utils/tools.js +0 -12
  70. package/lib/utils/typus-framework/dutch.d.ts +0 -25
  71. package/lib/utils/typus-framework/dutch.js +0 -84
  72. package/lib/utils/typus-framework/vault.d.ts +0 -32
  73. package/lib/utils/typus-framework/vault.js +0 -32
@@ -1,61 +0,0 @@
1
- import { JsonRpcProvider } from "@mysten/sui.js";
2
- import { DepositVault, BidVault } from "../../typus-framework/vault";
3
- import { Auction } from "../../typus-framework/dutch";
4
- export interface PortfolioVault {
5
- vaultId: string;
6
- typeArgs: string[];
7
- assets: string[];
8
- info: Info;
9
- config: Config;
10
- depositVault: DepositVault;
11
- bidVault: BidVault;
12
- auction: Auction;
13
- authority: string;
14
- tokenTvl: bigint;
15
- usdTvl: bigint;
16
- }
17
- export interface Info {
18
- index: string;
19
- creator: string;
20
- createTsMs: string;
21
- round: string;
22
- deliveryInfo?: DeliveryInfo;
23
- }
24
- export interface DeliveryInfo {
25
- round: string;
26
- price: string;
27
- size: string;
28
- premium: string;
29
- tsMs: string;
30
- }
31
- export interface Config {
32
- optionType: string;
33
- period: number;
34
- activationTsMs: string;
35
- expirationTsMs: string;
36
- dTokenDecimal: string;
37
- bTokenDecimal: string;
38
- oTokenDecimal: string;
39
- lotSize: string;
40
- capacity: string;
41
- leverage: string;
42
- hasNext: boolean;
43
- activeVaultConfig: VaultConfig;
44
- warmupVaultConfig: VaultConfig;
45
- upcomingVaultConfig: VaultConfig;
46
- }
47
- export interface VaultConfig {
48
- payoffConfigs: PayoffConfig[];
49
- strikeIncrement: string;
50
- decaySpeed: string;
51
- initialPrice: string;
52
- finalPrice: string;
53
- auctionDurationInMs: string;
54
- }
55
- export interface PayoffConfig {
56
- strikePct: string;
57
- weight: string;
58
- isBuyer: boolean;
59
- strike?: string;
60
- }
61
- export declare function getPortfolioVaults(provider: JsonRpcProvider, registry: string, deposit_vault_registry: string, bid_vault_registry: string, index?: string): Promise<Map<string, PortfolioVault>>;
@@ -1,241 +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
- function getPortfolioVaults(provider, registry, deposit_vault_registry, bid_vault_registry, index) {
43
- return __awaiter(this, void 0, void 0, function () {
44
- var portfolioVaultIds, portfolioVaults, depositVaultIds, 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 deliveryInfo =
67
- // @ts-ignore
68
- portfolioVault.data.content.fields.info.fields.delivery_info
69
- ? {
70
- // @ts-ignore
71
- round: portfolioVault.data.content.fields.info.fields.delivery_info.fields.round,
72
- // @ts-ignore
73
- price: portfolioVault.data.content.fields.info.fields.delivery_info.fields.price,
74
- // @ts-ignore
75
- size: portfolioVault.data.content.fields.info.fields.delivery_info.fields.size,
76
- // @ts-ignore
77
- premium: portfolioVault.data.content.fields.info.fields.delivery_info.fields.premium,
78
- // @ts-ignore
79
- tsMs: portfolioVault.data.content.fields.info.fields.delivery_info.fields.ts_ms,
80
- }
81
- : undefined;
82
- var info = {
83
- // @ts-ignore
84
- index: portfolioVault.data.content.fields.info.fields.index,
85
- // @ts-ignore
86
- creator: portfolioVault.data.content.fields.info.fields.creator,
87
- // @ts-ignore
88
- createTsMs: portfolioVault.data.content.fields.info.fields.create_ts_ms,
89
- // @ts-ignore
90
- round: portfolioVault.data.content.fields.info.fields.round,
91
- deliveryInfo: deliveryInfo,
92
- };
93
- var config = {
94
- // @ts-ignore
95
- optionType: portfolioVault.data.content.fields.config.fields.option_type,
96
- // @ts-ignore
97
- period: portfolioVault.data.content.fields.config.fields.period,
98
- // @ts-ignore
99
- activationTsMs: portfolioVault.data.content.fields.config.fields.activation_ts_ms,
100
- // @ts-ignore
101
- expirationTsMs: portfolioVault.data.content.fields.config.fields.expiration_ts_ms,
102
- // @ts-ignore
103
- dTokenDecimal: portfolioVault.data.content.fields.config.fields.d_token_decimal,
104
- // @ts-ignore
105
- bTokenDecimal: portfolioVault.data.content.fields.config.fields.b_token_decimal,
106
- // @ts-ignore
107
- oTokenDecimal: portfolioVault.data.content.fields.config.fields.o_token_decimal,
108
- // @ts-ignore
109
- lotSize: portfolioVault.data.content.fields.config.fields.lot_size,
110
- // @ts-ignore
111
- capacity: portfolioVault.data.content.fields.config.fields.capacity,
112
- // @ts-ignore
113
- leverage: portfolioVault.data.content.fields.config.fields.leverage,
114
- // @ts-ignore
115
- hasNext: portfolioVault.data.content.fields.config.fields.has_next,
116
- activeVaultConfig: {
117
- // @ts-ignore
118
- payoffConfigs: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.payoff_configs.map(function (x) {
119
- return ({
120
- strikePct: x.fields.strike_pct,
121
- weight: x.fields.weight,
122
- isBuyer: x.fields.is_buyer,
123
- strike: x.fields.strike,
124
- });
125
- }),
126
- // @ts-ignore
127
- strikeIncrement: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.strike_increment,
128
- // @ts-ignore
129
- decaySpeed: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.decay_speed,
130
- // @ts-ignore
131
- initialPrice: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.initial_price,
132
- // @ts-ignore
133
- finalPrice: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.final_price,
134
- // @ts-ignore
135
- auctionDurationInMs: portfolioVault.data.content.fields.config.fields.active_vault_config.fields.auction_duration_in_ms,
136
- },
137
- warmupVaultConfig: {
138
- // @ts-ignore
139
- payoffConfigs: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.payoff_configs.map(function (x) {
140
- return ({
141
- strikePct: x.fields.strike_pct,
142
- weight: x.fields.weight,
143
- isBuyer: x.fields.is_buyer,
144
- strike: x.fields.strike,
145
- });
146
- }),
147
- // @ts-ignore
148
- strikeIncrement: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.strike_increment,
149
- // @ts-ignore
150
- decaySpeed: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.decay_speed,
151
- // @ts-ignore
152
- initialPrice: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.initial_price,
153
- // @ts-ignore
154
- finalPrice: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.final_price,
155
- // @ts-ignore
156
- auctionDurationInMs: portfolioVault.data.content.fields.config.fields.warmup_vault_config.fields.auction_duration_in_ms,
157
- },
158
- upcomingVaultConfig: {
159
- // @ts-ignore
160
- payoffConfigs: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.payoff_configs.map(function (x) {
161
- return ({
162
- strikePct: x.fields.strike_pct,
163
- weight: x.fields.weight,
164
- isBuyer: x.fields.is_buyer,
165
- strike: x.fields.strike,
166
- });
167
- }),
168
- // @ts-ignore
169
- strikeIncrement: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.strike_increment,
170
- // @ts-ignore
171
- decaySpeed: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.decay_speed,
172
- // @ts-ignore
173
- initialPrice: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.initial_price,
174
- // @ts-ignore
175
- finalPrice: portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.final_price,
176
- auctionDurationInMs:
177
- // @ts-ignore
178
- portfolioVault.data.content.fields.config.fields.upcoming_vault_config.fields.auction_duration_in_ms,
179
- },
180
- };
181
- // @ts-ignore
182
- var auction = portfolioVault.data.content.fields.auction ? (0, dutch_1.parseAuction)(portfolioVault.data.content.fields.auction) : undefined;
183
- // @ts-ignore
184
- var authority = portfolioVault.data.content.fields.authority.fields.whitelist.fields.id.id;
185
- map[info.index] = {
186
- vaultId: vaultId,
187
- typeArgs: typeArgs,
188
- assets: assets,
189
- info: info,
190
- config: config,
191
- depositVault: {},
192
- bidVault: {},
193
- auction: auction,
194
- authority: authority,
195
- };
196
- return map;
197
- }, {});
198
- return [4 /*yield*/, provider.getDynamicFields({ parentId: deposit_vault_registry })];
199
- case 3:
200
- depositVaultIds = (_a.sent()).data
201
- .filter(function (x) { return (index ? x.name.value == index : true); })
202
- .map(function (x) { return x.objectId; });
203
- return [4 /*yield*/, provider.multiGetObjects({
204
- ids: depositVaultIds,
205
- options: { showContent: true },
206
- })];
207
- case 4:
208
- (_a.sent())
209
- .filter(function (depositVault) { return depositVault.error == undefined; })
210
- .forEach(function (depositVault) {
211
- // @ts-ignore
212
- var index = depositVault.data.content.fields.name;
213
- // @ts-ignore
214
- var vault = (0, vault_1.parseDepositVault)(depositVault.data.content.fields.value);
215
- var tvl = BigInt(vault.activeSubVault.balance) + BigInt(vault.warmupSubVault.balance);
216
- portfolioVaults[index].tokenTvl = tvl;
217
- portfolioVaults[index].depositVault = vault;
218
- });
219
- return [4 /*yield*/, provider.getDynamicFields({ parentId: bid_vault_registry })];
220
- case 5:
221
- bidVaultIds = (_a.sent()).data
222
- .filter(function (x) { return (index ? x.name.value == index : true); })
223
- .map(function (x) { return x.objectId; });
224
- return [4 /*yield*/, provider.multiGetObjects({
225
- ids: bidVaultIds,
226
- options: { showContent: true },
227
- })];
228
- case 6:
229
- (_a.sent())
230
- .filter(function (bidVault) { return bidVault.error == undefined; })
231
- .forEach(function (bidVault) {
232
- // @ts-ignore
233
- portfolioVaults[bidVault.data.content.fields.name].bidVault = (0, vault_1.parseBidVault)(bidVault.data.content.fields.value);
234
- });
235
- // @ts-ignore
236
- return [2 /*return*/, portfolioVaults];
237
- }
238
- });
239
- });
240
- }
241
- exports.getPortfolioVaults = getPortfolioVaults;
@@ -1,81 +0,0 @@
1
- import { TransactionBlock } from "@mysten/sui.js";
2
- /**
3
- public(friend) entry fun deposit<D_TOKEN, B_TOKEN, O_TOKEN>(
4
- registry: &mut Registry,
5
- index: u64,
6
- coins: vector<Coin<D_TOKEN>>,
7
- amount: u64,
8
- ctx: &mut TxContext
9
- )
10
- @param typeArguments [Deposit Vault Token, Bid Vault Token, Oracle Token]
11
- */
12
- export declare function getDepositTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], amount: string): Promise<TransactionBlock>;
13
- /**
14
- public(friend) entry fun withdraw<TOKEN>(
15
- registry: &mut Registry,
16
- index: u64,
17
- share: Option<u64>,
18
- ctx: &mut TxContext
19
- )
20
- @param typeArguments [Deposit Vault Token]
21
- */
22
- export declare function getWithdrawTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, share?: string): Promise<TransactionBlock>;
23
- /**
24
- public(friend) entry fun claim<TOKEN>(
25
- registry: &mut Registry,
26
- index: u64,
27
- ctx: &mut TxContext
28
- )
29
- @param typeArguments [Deposit Vault Token]
30
- */
31
- export declare function getClaimTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string): Promise<TransactionBlock>;
32
- /**
33
- public(friend) entry fun harvest<TOKEN>(
34
- registry: &mut Registry,
35
- index: u64,
36
- ctx: &mut TxContext
37
- )
38
- @param typeArguments [Bid Vault Token]
39
- */
40
- export declare function getHarvestTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string): Promise<TransactionBlock>;
41
- /**
42
- public(friend) entry fun claim_and_harvest<D_TOKEN, B_TOKEN>(
43
- registry: &mut Registry,
44
- index: u64,
45
- ctx: &mut TxContext
46
- )
47
- @param typeArguments [Deposit Vault Token, Bid Vault Token]
48
- */
49
- export declare function getClaimAndHarvestTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string): Promise<TransactionBlock>;
50
- /**
51
- public(friend) entry fun compound<TOKEN, O_TOKEN>(
52
- registry: &mut Registry,
53
- index: u64,
54
- ctx: &mut TxContext,
55
- )
56
- @param typeArguments [Deposit Vault Token, Oracle Token]
57
- */
58
- export declare function getCompoundTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string): Promise<TransactionBlock>;
59
- /**
60
- public(friend) entry fun unsubscribe<TOKEN>(
61
- registry: &mut Registry,
62
- index: u64,
63
- share: Option<u64>,
64
- ctx: &mut TxContext
65
- )
66
- @param typeArguments [Deposit Vault Token]
67
- */
68
- export declare function getUnsubscribeTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, share?: string): Promise<TransactionBlock>;
69
- /**
70
- public(friend) entry fun new_bid<D_TOKEN, B_TOKEN, O_TOKEN>(
71
- registry: &mut Registry,
72
- index: u64,
73
- price_oracle: &Oracle<O_TOKEN>,
74
- clock: &Clock,
75
- coins: vector<Coin<B_TOKEN>>,
76
- size: u64,
77
- ctx: &mut TxContext,
78
- )
79
- @param typeArguments [Deposit Vault Token, Bid Vault Token, Oracle Token]
80
- */
81
- export declare function getNewBidTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string, index: string, priceOracle: string, coins: string[], size: string): Promise<TransactionBlock>;
@@ -1,247 +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.getNewBidTx = exports.getUnsubscribeTx = exports.getCompoundTx = 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<D_TOKEN, B_TOKEN, O_TOKEN>(
43
- registry: &mut Registry,
44
- index: u64,
45
- coins: vector<Coin<D_TOKEN>>,
46
- amount: u64,
47
- ctx: &mut TxContext
48
- )
49
- @param typeArguments [Deposit Vault Token, Bid Vault Token, Oracle Token]
50
- */
51
- function getDepositTx(gasBudget, packageId, typeArguments, registry, index, coins, amount) {
52
- return __awaiter(this, void 0, void 0, function () {
53
- var tx;
54
- return __generator(this, function (_a) {
55
- tx = new sui_js_1.TransactionBlock();
56
- tx.moveCall({
57
- target: "".concat(packageId, "::single_collateral::deposit"),
58
- typeArguments: typeArguments,
59
- arguments: [tx.pure(registry), tx.pure(index), tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }), tx.pure(amount)],
60
- });
61
- tx.setGasBudget(gasBudget);
62
- return [2 /*return*/, tx];
63
- });
64
- });
65
- }
66
- exports.getDepositTx = getDepositTx;
67
- /**
68
- public(friend) entry fun withdraw<TOKEN>(
69
- registry: &mut Registry,
70
- index: u64,
71
- share: Option<u64>,
72
- ctx: &mut TxContext
73
- )
74
- @param typeArguments [Deposit Vault Token]
75
- */
76
- function getWithdrawTx(gasBudget, packageId, typeArguments, registry, index, share) {
77
- return __awaiter(this, void 0, void 0, function () {
78
- var tx;
79
- return __generator(this, function (_a) {
80
- tx = new sui_js_1.TransactionBlock();
81
- tx.moveCall({
82
- target: "".concat(packageId, "::single_collateral::withdraw"),
83
- typeArguments: typeArguments,
84
- arguments: [tx.pure(registry), tx.pure(index), tx.pure(share ? [share] : [])],
85
- });
86
- tx.setGasBudget(gasBudget);
87
- return [2 /*return*/, tx];
88
- });
89
- });
90
- }
91
- exports.getWithdrawTx = getWithdrawTx;
92
- /**
93
- public(friend) entry fun claim<TOKEN>(
94
- registry: &mut Registry,
95
- index: u64,
96
- ctx: &mut TxContext
97
- )
98
- @param typeArguments [Deposit Vault Token]
99
- */
100
- function getClaimTx(gasBudget, packageId, typeArguments, registry, index) {
101
- return __awaiter(this, void 0, void 0, function () {
102
- var tx;
103
- return __generator(this, function (_a) {
104
- tx = new sui_js_1.TransactionBlock();
105
- tx.moveCall({
106
- target: "".concat(packageId, "::single_collateral::claim"),
107
- typeArguments: typeArguments,
108
- arguments: [tx.pure(registry), tx.pure(index)],
109
- });
110
- tx.setGasBudget(gasBudget);
111
- return [2 /*return*/, tx];
112
- });
113
- });
114
- }
115
- exports.getClaimTx = getClaimTx;
116
- /**
117
- public(friend) entry fun harvest<TOKEN>(
118
- registry: &mut Registry,
119
- index: u64,
120
- ctx: &mut TxContext
121
- )
122
- @param typeArguments [Bid Vault Token]
123
- */
124
- function getHarvestTx(gasBudget, packageId, typeArguments, registry, index) {
125
- return __awaiter(this, void 0, void 0, function () {
126
- var tx;
127
- return __generator(this, function (_a) {
128
- tx = new sui_js_1.TransactionBlock();
129
- tx.moveCall({
130
- target: "".concat(packageId, "::single_collateral::harvest"),
131
- typeArguments: typeArguments,
132
- arguments: [tx.pure(registry), tx.pure(index)],
133
- });
134
- tx.setGasBudget(gasBudget);
135
- return [2 /*return*/, tx];
136
- });
137
- });
138
- }
139
- exports.getHarvestTx = getHarvestTx;
140
- /**
141
- public(friend) entry fun claim_and_harvest<D_TOKEN, B_TOKEN>(
142
- registry: &mut Registry,
143
- index: u64,
144
- ctx: &mut TxContext
145
- )
146
- @param typeArguments [Deposit Vault Token, Bid Vault Token]
147
- */
148
- function getClaimAndHarvestTx(gasBudget, packageId, typeArguments, registry, index) {
149
- return __awaiter(this, void 0, void 0, function () {
150
- var tx;
151
- return __generator(this, function (_a) {
152
- tx = new sui_js_1.TransactionBlock();
153
- tx.moveCall({
154
- target: "".concat(packageId, "::single_collateral::claim_and_harvest"),
155
- typeArguments: typeArguments,
156
- arguments: [tx.pure(registry), tx.pure(index)],
157
- });
158
- tx.setGasBudget(gasBudget);
159
- return [2 /*return*/, tx];
160
- });
161
- });
162
- }
163
- exports.getClaimAndHarvestTx = getClaimAndHarvestTx;
164
- /**
165
- public(friend) entry fun compound<TOKEN, O_TOKEN>(
166
- registry: &mut Registry,
167
- index: u64,
168
- ctx: &mut TxContext,
169
- )
170
- @param typeArguments [Deposit Vault Token, Oracle Token]
171
- */
172
- function getCompoundTx(gasBudget, packageId, typeArguments, registry, index) {
173
- return __awaiter(this, void 0, void 0, function () {
174
- var tx;
175
- return __generator(this, function (_a) {
176
- tx = new sui_js_1.TransactionBlock();
177
- tx.moveCall({
178
- target: "".concat(packageId, "::single_collateral::compound"),
179
- typeArguments: typeArguments,
180
- arguments: [tx.pure(registry), tx.pure(index)],
181
- });
182
- tx.setGasBudget(gasBudget);
183
- return [2 /*return*/, tx];
184
- });
185
- });
186
- }
187
- exports.getCompoundTx = getCompoundTx;
188
- /**
189
- public(friend) entry fun unsubscribe<TOKEN>(
190
- registry: &mut Registry,
191
- index: u64,
192
- share: Option<u64>,
193
- ctx: &mut TxContext
194
- )
195
- @param typeArguments [Deposit Vault Token]
196
- */
197
- function getUnsubscribeTx(gasBudget, packageId, typeArguments, registry, index, share) {
198
- return __awaiter(this, void 0, void 0, function () {
199
- var tx;
200
- return __generator(this, function (_a) {
201
- tx = new sui_js_1.TransactionBlock();
202
- tx.moveCall({
203
- target: "".concat(packageId, "::single_collateral::unsubscribe"),
204
- typeArguments: typeArguments,
205
- arguments: [tx.pure(registry), tx.pure(index), tx.pure(share ? [share] : [])],
206
- });
207
- tx.setGasBudget(gasBudget);
208
- return [2 /*return*/, tx];
209
- });
210
- });
211
- }
212
- exports.getUnsubscribeTx = getUnsubscribeTx;
213
- /**
214
- public(friend) entry fun new_bid<D_TOKEN, B_TOKEN, O_TOKEN>(
215
- registry: &mut Registry,
216
- index: u64,
217
- price_oracle: &Oracle<O_TOKEN>,
218
- clock: &Clock,
219
- coins: vector<Coin<B_TOKEN>>,
220
- size: u64,
221
- ctx: &mut TxContext,
222
- )
223
- @param typeArguments [Deposit Vault Token, Bid Vault Token, Oracle Token]
224
- */
225
- function getNewBidTx(gasBudget, packageId, typeArguments, registry, index, priceOracle, coins, size) {
226
- return __awaiter(this, void 0, void 0, function () {
227
- var tx;
228
- return __generator(this, function (_a) {
229
- tx = new sui_js_1.TransactionBlock();
230
- tx.moveCall({
231
- target: "".concat(packageId, "::single_collateral::new_bid"),
232
- typeArguments: typeArguments,
233
- arguments: [
234
- tx.pure(registry),
235
- tx.pure(index),
236
- tx.pure(priceOracle),
237
- tx.pure("0x6"),
238
- tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
239
- tx.pure(size),
240
- ],
241
- });
242
- tx.setGasBudget(gasBudget);
243
- return [2 /*return*/, tx];
244
- });
245
- });
246
- }
247
- exports.getNewBidTx = getNewBidTx;
@@ -1,8 +0,0 @@
1
- import { JsonRpcProvider } from "@mysten/sui.js";
2
- import { DepositVaultUserShare, BidVaultUserShare } from "../../typus-framework/vault";
3
- export interface UserShare {
4
- index: string;
5
- depositVaultUserShare: DepositVaultUserShare;
6
- bidVaultUserShare: BidVaultUserShare;
7
- }
8
- export declare function getUserShares(provider: JsonRpcProvider, packageId: string, registry: string, indexes: string[], user: string): Promise<Map<string, UserShare>>;