@typus/typus-sdk 1.8.43 → 1.9.0

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 (52) hide show
  1. package/dist/src/auto-bid/view-function.d.ts +0 -2
  2. package/dist/src/auto-bid/view-function.js +7 -76
  3. package/dist/src/dice/fetch.d.ts +2 -2
  4. package/dist/src/dice/fetch.js +34 -91
  5. package/dist/src/typus/airdrop/view-function.js +5 -8
  6. package/dist/src/typus/leaderboard/view-function.js +5 -8
  7. package/dist/src/typus/tails-staking/view-function.js +10 -14
  8. package/dist/src/typus/user/view-function.js +5 -6
  9. package/dist/src/typus-dov-single-v2/function/index.d.ts +0 -1
  10. package/dist/src/typus-dov-single-v2/function/index.js +0 -1
  11. package/dist/src/typus-dov-single-v2/function/token.js +1 -1
  12. package/dist/src/typus-dov-single-v2/history/index.d.ts +0 -1
  13. package/dist/src/typus-dov-single-v2/history/index.js +0 -1
  14. package/dist/src/typus-dov-single-v2/history/user-history.d.ts +5 -3
  15. package/dist/src/typus-dov-single-v2/history/user-history.js +124 -187
  16. package/dist/src/typus-dov-single-v2/otc-entry.js +5 -6
  17. package/dist/src/typus-dov-single-v2/user-entry.d.ts +1 -1
  18. package/dist/src/typus-dov-single-v2/view-function.d.ts +3 -0
  19. package/dist/src/typus-dov-single-v2/view-function.js +72 -28
  20. package/dist/src/typus-hedge/view-function.js +10 -10
  21. package/dist/src/typus-launch/airdrop/view-function.js +3 -5
  22. package/dist/src/typus-launch/auction/view-function.js +17 -16
  23. package/dist/src/typus-launch/funding-vault/view-function.js +21 -19
  24. package/dist/src/typus-launch/improvement-proposal/view-function.js +17 -18
  25. package/dist/src/typus-launch/ve-typus/view-function.js +15 -15
  26. package/dist/src/typus-nft/fetch.d.ts +2 -36
  27. package/dist/src/typus-nft/fetch.js +34 -396
  28. package/dist/src/typus-nft/index.d.ts +0 -1
  29. package/dist/src/typus-nft/index.js +0 -1
  30. package/dist/src/typus-safu/view-function.js +13 -13
  31. package/dist/src/utils/api/price.js +6 -58
  32. package/dist/src/utils/api/sentio/events.js +4 -4
  33. package/dist/src/utils/api/sentio/leader-board.js +1 -1
  34. package/dist/src/utils/api/sentio/reward-generated.js +16 -16
  35. package/dist/src/utils/api/sentio/vault-history.js +1 -1
  36. package/dist/src/utils/graphQl.d.ts +27 -0
  37. package/dist/src/utils/graphQl.js +132 -0
  38. package/dist/src/utils/index.d.ts +1 -0
  39. package/dist/src/utils/index.js +1 -0
  40. package/dist/src/utils/oracle.js +13 -14
  41. package/dist/src/utils/sponsoredTx.d.ts +2 -2
  42. package/dist/src/utils/typusConfig.d.ts +4 -0
  43. package/dist/src/utils/typusConfig.js +33 -31
  44. package/package.json +10 -9
  45. package/dist/src/dice/view-function.d.ts +0 -1
  46. package/dist/src/dice/view-function.js +0 -20
  47. package/dist/src/typus-dov-single-v2/function/bidding.d.ts +0 -87
  48. package/dist/src/typus-dov-single-v2/function/bidding.js +0 -653
  49. package/dist/src/typus-dov-single-v2/history/vault-history.d.ts +0 -123
  50. package/dist/src/typus-dov-single-v2/history/vault-history.js +0 -307
  51. package/dist/src/typus-nft/user-entry.d.ts +0 -57
  52. package/dist/src/typus-nft/user-entry.js +0 -161
@@ -1,123 +0,0 @@
1
- import { SuiEvent } from "@mysten/sui/client";
2
- import { OracleInfo, VaultConfig } from "../../../src/typus-dov-single-v2";
3
- import { TypusConfig } from "../../../src/utils";
4
- export declare function getVaultHistoryEvents(config: TypusConfig, startTimeMs: number): Promise<SuiEvent[]>;
5
- export declare function parseGroupEvents(datas: SuiEvent[]): Promise<Map<string, Map<string, GroupEvent>>>;
6
- export declare function parseVaultHistory(inputMap: Map<string, Map<string, GroupEvent>>): Promise<Map<string, Map<string, VaultHistory | undefined>>>;
7
- export declare function convertGroupEventToVaultHistory(groupEvent: GroupEvent): Promise<VaultHistory | undefined>;
8
- export interface VaultHistory {
9
- vaultIndex: string;
10
- round: string;
11
- ActivationDate: Date;
12
- SettlementTime: Date;
13
- StrikePrice: number[] | undefined;
14
- SettlePrice: number;
15
- ActualReturn: number;
16
- TotalAuctioned: number;
17
- Filled: number;
18
- DeliverySize: number;
19
- DeliveryPrice: number;
20
- DepositorsRewards: number;
21
- BiddersPayoff: number;
22
- DepositorPnl: number;
23
- ActivateTx: string | undefined;
24
- NewAuctionTx: string | undefined;
25
- DeliveryTx: string | undefined;
26
- RecoupTx: string | undefined;
27
- SettleTx: string | undefined;
28
- }
29
- interface GroupEvent {
30
- activateEvent: ActivateEvent | undefined;
31
- newAuctionEvent: NewAuctionEvent | undefined;
32
- deliveryEvent: DeliveryEvent | undefined;
33
- recoupEvent: RecoupEvent | undefined;
34
- settleEvent: SettleEvent | undefined;
35
- }
36
- interface ActivateEvent {
37
- signer: string;
38
- index: string;
39
- round: string;
40
- deposit_amount: string;
41
- d_token_decimal: string;
42
- contract_size: string;
43
- o_token_decimal: string;
44
- oracle_info: OracleInfo;
45
- u64_padding: string[];
46
- timestampMs: string | null | undefined;
47
- txDigest: string;
48
- }
49
- interface NewAuctionEvent {
50
- signer: string;
51
- index: string;
52
- round: string;
53
- start_ts_ms: string;
54
- end_ts_ms: string;
55
- size: string;
56
- vault_config: VaultConfig;
57
- oracle_info: OracleInfo;
58
- u64_padding: string[];
59
- timestampMs: string | null | undefined;
60
- txDigest: string;
61
- }
62
- interface DeliveryEvent {
63
- signer: string;
64
- index: string;
65
- round: string;
66
- early: boolean;
67
- delivery_price: string;
68
- delivery_size: string;
69
- o_token_decimal: string;
70
- o_token: {
71
- name: string;
72
- };
73
- bidder_bid_value: string;
74
- bidder_fee: string;
75
- incentive_bid_value: string;
76
- incentive_fee: string;
77
- b_token_decimal: string;
78
- b_token: {
79
- name: string;
80
- };
81
- depositor_incentive_value: string;
82
- u64_padding: string[];
83
- timestampMs: string | null | undefined;
84
- txDigest: string;
85
- }
86
- interface RecoupEvent {
87
- signer: string;
88
- index: string;
89
- round: string;
90
- active_amount: string;
91
- deactivating_amount: string;
92
- d_token_decimal: string;
93
- u64_padding: string[];
94
- timestampMs: string | null | undefined;
95
- txDigest: string;
96
- }
97
- interface SettleEvent {
98
- signer: string;
99
- index: string;
100
- round: string;
101
- oracle_price: string;
102
- oracle_price_decimal: string;
103
- settle_balance: string;
104
- settled_balance: string;
105
- d_token_decimal: string;
106
- d_token: {
107
- name: string;
108
- };
109
- share_price: string;
110
- u64_padding: string[];
111
- timestampMs: string | null | undefined;
112
- txDigest: string;
113
- }
114
- export declare function parseBidEvents(datas: SuiEvent[], end_ts_ms: any): Promise<Map<string, NewBidEvent[]>>;
115
- interface NewBidEvent {
116
- signer: string;
117
- index: string;
118
- size: string;
119
- ts_ms: string;
120
- timestampMs: string | null | undefined;
121
- txDigest: string;
122
- }
123
- export {};
@@ -1,307 +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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["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.getVaultHistoryEvents = getVaultHistoryEvents;
40
- exports.parseGroupEvents = parseGroupEvents;
41
- exports.parseVaultHistory = parseVaultHistory;
42
- exports.convertGroupEventToVaultHistory = convertGroupEventToVaultHistory;
43
- exports.parseBidEvents = parseBidEvents;
44
- var client_1 = require("@mysten/sui/client");
45
- var constants_1 = require("../../../src/constants");
46
- function getVaultHistoryEvents(config, startTimeMs) {
47
- return __awaiter(this, void 0, void 0, function () {
48
- var provider, senderFilter, result, datas, hasNextPage, cursor, result;
49
- return __generator(this, function (_a) {
50
- switch (_a.label) {
51
- case 0:
52
- provider = new client_1.SuiClient({ url: config.rpcEndpoint });
53
- senderFilter = {
54
- MoveEventModule: {
55
- package: config.packageOrigin.dovSingle,
56
- module: "typus_dov_single",
57
- },
58
- };
59
- return [4 /*yield*/, provider.queryEvents({ query: senderFilter, order: "descending" })];
60
- case 1:
61
- result = _a.sent();
62
- datas = result.data;
63
- hasNextPage = result.hasNextPage;
64
- cursor = result.nextCursor;
65
- _a.label = 2;
66
- case 2:
67
- if (!hasNextPage) return [3 /*break*/, 4];
68
- return [4 /*yield*/, provider.queryEvents({ query: senderFilter, order: "descending", cursor: cursor })];
69
- case 3:
70
- result = _a.sent();
71
- // console.log(result);
72
- datas = datas.concat(result.data);
73
- if (result.hasNextPage && Number(result.data.at(-1).timestampMs) < startTimeMs) {
74
- return [3 /*break*/, 4];
75
- }
76
- hasNextPage = result.hasNextPage;
77
- cursor = result.nextCursor;
78
- return [3 /*break*/, 2];
79
- case 4: return [2 /*return*/, datas];
80
- }
81
- });
82
- });
83
- }
84
- function parseGroupEvents(datas) {
85
- return __awaiter(this, void 0, void 0, function () {
86
- var results;
87
- var _this = this;
88
- return __generator(this, function (_a) {
89
- switch (_a.label) {
90
- case 0: return [4 /*yield*/, datas.reduce(function (promise, event) { return __awaiter(_this, void 0, void 0, function () {
91
- var map, functionType, action, parsedJson, index, round, round_event, round_events, round_events, round_events;
92
- return __generator(this, function (_a) {
93
- switch (_a.label) {
94
- case 0: return [4 /*yield*/, promise];
95
- case 1:
96
- map = _a.sent();
97
- functionType = new RegExp("^([^::]+)::([^::]+)::([^<]+)").exec(event.type);
98
- action = functionType[3];
99
- // console.log(action);
100
- if (!["ActivateEvent", "NewAuctionEvent", "DeliveryEvent", "RecoupEvent", "SettleEvent"].includes(action)) {
101
- return [2 /*return*/, map];
102
- }
103
- parsedJson = event.parsedJson;
104
- // console.log(parsedJson);
105
- parsedJson.timestampMs = event.timestampMs;
106
- parsedJson.txDigest = event.id.txDigest;
107
- index = parsedJson.index.toString();
108
- round = parsedJson.round.toString();
109
- round_event = {
110
- activateEvent: undefined,
111
- newAuctionEvent: undefined,
112
- deliveryEvent: undefined,
113
- recoupEvent: undefined,
114
- settleEvent: undefined,
115
- };
116
- if (map.has(index)) {
117
- round_events = map.get(index);
118
- if (round_events.has(round)) {
119
- round_event = round_events.get(round);
120
- }
121
- }
122
- switch (action) {
123
- case "ActivateEvent":
124
- round_event.activateEvent = parsedJson;
125
- break;
126
- case "NewAuctionEvent":
127
- round_event.newAuctionEvent = parsedJson;
128
- round_event.newAuctionEvent.vault_config = {
129
- payoffConfigs: parsedJson.vault_config.payoff_configs.map(function (x) {
130
- return ({
131
- weight: x.weight,
132
- isBuyer: x.is_buyer,
133
- strike: x.strike,
134
- strikeBp: x.strike_bp,
135
- u64Padding: x.u64_padding,
136
- });
137
- }),
138
- strikeIncrement: parsedJson.vault_config.strike_increment,
139
- decaySpeed: parsedJson.vault_config.decay_speed,
140
- initialPrice: parsedJson.vault_config.initial_price,
141
- finalPrice: parsedJson.vault_config.final_price,
142
- auctionDurationInMs: parsedJson.vault_config.auction_duration_in_ms,
143
- u64Padding: parsedJson.vault_config.u64_padding,
144
- };
145
- break;
146
- case "DeliveryEvent":
147
- round_event.deliveryEvent = parsedJson;
148
- // console.log(parsedJson);
149
- break;
150
- case "RecoupEvent":
151
- round_event.recoupEvent = parsedJson;
152
- break;
153
- case "SettleEvent":
154
- round_event.settleEvent = parsedJson;
155
- break;
156
- }
157
- // console.log(round_event);
158
- if (map.has(index)) {
159
- round_events = map.get(index);
160
- round_events.set(round, round_event);
161
- map.set(index, round_events);
162
- }
163
- else {
164
- round_events = new Map();
165
- round_events.set(round, round_event);
166
- map.set(index, round_events);
167
- }
168
- return [2 /*return*/, map];
169
- }
170
- });
171
- }); }, Promise.resolve(new Map()))];
172
- case 1:
173
- results = _a.sent();
174
- // console.log(results);
175
- return [2 /*return*/, results];
176
- }
177
- });
178
- });
179
- }
180
- function parseVaultHistory(inputMap) {
181
- return __awaiter(this, void 0, void 0, function () {
182
- var result;
183
- var _this = this;
184
- return __generator(this, function (_a) {
185
- result = new Map();
186
- inputMap.forEach(function (innerMap, outerKey) {
187
- var newInnerMap = new Map();
188
- innerMap.forEach(function (groupEvent, innerKey) { return __awaiter(_this, void 0, void 0, function () {
189
- var vaultHistory;
190
- return __generator(this, function (_a) {
191
- switch (_a.label) {
192
- case 0: return [4 /*yield*/, convertGroupEventToVaultHistory(groupEvent)];
193
- case 1:
194
- vaultHistory = _a.sent();
195
- newInnerMap.set(innerKey, vaultHistory);
196
- return [2 /*return*/];
197
- }
198
- });
199
- }); });
200
- result.set(outerKey, newInnerMap);
201
- });
202
- return [2 /*return*/, result];
203
- });
204
- });
205
- }
206
- function convertGroupEventToVaultHistory(groupEvent) {
207
- return __awaiter(this, void 0, void 0, function () {
208
- var ActivationMs, SettlementTsMs, b_token, o_token, bidder_bid_value, bidder_fee, delivery_price, delivery_size, incentive_bid_value, incentive_fee, DepositorsRewards, BiddersPayoff, result;
209
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
210
- return __generator(this, function (_t) {
211
- ActivationMs = Number((_a = groupEvent.activateEvent) === null || _a === void 0 ? void 0 : _a.timestampMs);
212
- SettlementTsMs = Number((_b = groupEvent.settleEvent) === null || _b === void 0 ? void 0 : _b.timestampMs);
213
- if (groupEvent.deliveryEvent) {
214
- b_token = (0, constants_1.typeArgToAsset)(groupEvent.deliveryEvent.b_token.name);
215
- o_token = (0, constants_1.typeArgToAsset)(groupEvent.deliveryEvent.o_token.name);
216
- bidder_bid_value = Number(groupEvent.deliveryEvent.bidder_bid_value) / Math.pow(10, (0, constants_1.assetToDecimal)(b_token));
217
- bidder_fee = Number(groupEvent.deliveryEvent.bidder_fee) / Math.pow(10, (0, constants_1.assetToDecimal)(b_token));
218
- delivery_price = Number(groupEvent.deliveryEvent.delivery_price) / Math.pow(10, (0, constants_1.assetToDecimal)(b_token));
219
- delivery_size = Number(groupEvent.deliveryEvent.delivery_size) / Math.pow(10, (0, constants_1.assetToDecimal)(o_token));
220
- incentive_bid_value = Number(groupEvent.deliveryEvent.incentive_bid_value) / Math.pow(10, (0, constants_1.assetToDecimal)(b_token));
221
- incentive_fee = Number(groupEvent.deliveryEvent.incentive_fee) / Math.pow(10, (0, constants_1.assetToDecimal)(b_token));
222
- DepositorsRewards = bidder_bid_value + bidder_fee + incentive_bid_value + incentive_fee;
223
- BiddersPayoff = (Number((_c = groupEvent.settleEvent) === null || _c === void 0 ? void 0 : _c.settle_balance) - Number((_d = groupEvent.settleEvent) === null || _d === void 0 ? void 0 : _d.settled_balance)) /
224
- Math.pow(10, Number((_e = groupEvent.settleEvent) === null || _e === void 0 ? void 0 : _e.d_token_decimal));
225
- result = {
226
- vaultIndex: (_f = groupEvent.activateEvent) === null || _f === void 0 ? void 0 : _f.index,
227
- round: (_g = groupEvent.activateEvent) === null || _g === void 0 ? void 0 : _g.round,
228
- // activateEvent
229
- ActivateTx: (_h = groupEvent.activateEvent) === null || _h === void 0 ? void 0 : _h.txDigest,
230
- ActivationDate: new Date(ActivationMs - (ActivationMs % 3600000)),
231
- TotalAuctioned: Number((_j = groupEvent.activateEvent) === null || _j === void 0 ? void 0 : _j.contract_size) / Math.pow(10, Number((_k = groupEvent.activateEvent) === null || _k === void 0 ? void 0 : _k.o_token_decimal)),
232
- // newAuctionEvent
233
- NewAuctionTx: (_l = groupEvent.newAuctionEvent) === null || _l === void 0 ? void 0 : _l.txDigest,
234
- StrikePrice: (_m = groupEvent.newAuctionEvent) === null || _m === void 0 ? void 0 : _m.vault_config.payoffConfigs.map(function (payoffConfig) { return Number(payoffConfig.strike) / Math.pow(10, 8); }),
235
- // deliveryEvent
236
- DeliveryTx: groupEvent.deliveryEvent.txDigest,
237
- DeliverySize: delivery_size,
238
- DeliveryPrice: delivery_price,
239
- Filled: delivery_size == 0 ? 0 : Number(groupEvent.deliveryEvent.delivery_size) / Number((_o = groupEvent.newAuctionEvent) === null || _o === void 0 ? void 0 : _o.size),
240
- DepositorsRewards: DepositorsRewards,
241
- // recoupEvent
242
- RecoupTx: (_p = groupEvent.recoupEvent) === null || _p === void 0 ? void 0 : _p.txDigest,
243
- // settleEvent
244
- SettleTx: (_q = groupEvent.settleEvent) === null || _q === void 0 ? void 0 : _q.txDigest,
245
- SettlementTime: new Date(SettlementTsMs - (SettlementTsMs % 3600000)),
246
- SettlePrice: Number((_r = groupEvent.settleEvent) === null || _r === void 0 ? void 0 : _r.oracle_price) / Math.pow(10, 8),
247
- ActualReturn: Number((_s = groupEvent.settleEvent) === null || _s === void 0 ? void 0 : _s.share_price) / Math.pow(10, 8) - 1,
248
- BiddersPayoff: BiddersPayoff,
249
- DepositorPnl: DepositorsRewards - BiddersPayoff,
250
- };
251
- return [2 /*return*/, result];
252
- }
253
- return [2 /*return*/];
254
- });
255
- });
256
- }
257
- function parseBidEvents(datas, end_ts_ms) {
258
- return __awaiter(this, void 0, void 0, function () {
259
- var results;
260
- var _this = this;
261
- return __generator(this, function (_a) {
262
- switch (_a.label) {
263
- case 0: return [4 /*yield*/, datas.reduce(function (promise, event) { return __awaiter(_this, void 0, void 0, function () {
264
- var map, functionType, action, parsedJson, index, bid_event, o_token, size, bid_events;
265
- return __generator(this, function (_a) {
266
- switch (_a.label) {
267
- case 0: return [4 /*yield*/, promise];
268
- case 1:
269
- map = _a.sent();
270
- functionType = new RegExp("^([^::]+)::([^::]+)::([^<]+)").exec(event.type);
271
- action = functionType[3];
272
- // console.log(action);
273
- if (action != "NewBidEvent") {
274
- return [2 /*return*/, map];
275
- }
276
- parsedJson = event.parsedJson;
277
- // console.log(parsedJson);
278
- parsedJson.timestampMs = event.timestampMs;
279
- parsedJson.txDigest = event.id.txDigest;
280
- index = parsedJson.index.toString();
281
- bid_event = parsedJson;
282
- o_token = (0, constants_1.typeArgToAsset)("0x" + parsedJson.o_token.name);
283
- size = Number(parsedJson.size) / Math.pow(10, (0, constants_1.assetToDecimal)(o_token));
284
- bid_event.size = size.toString();
285
- if (Number(bid_event.ts_ms) > end_ts_ms) {
286
- return [2 /*return*/, map];
287
- }
288
- if (map.has(index)) {
289
- bid_events = map.get(index);
290
- bid_events.push(bid_event);
291
- }
292
- else {
293
- bid_events = [bid_event];
294
- }
295
- map.set(index, bid_events);
296
- return [2 /*return*/, map];
297
- }
298
- });
299
- }); }, Promise.resolve(new Map()))];
300
- case 1:
301
- results = _a.sent();
302
- // console.log(results);
303
- return [2 /*return*/, results];
304
- }
305
- });
306
- });
307
- }
@@ -1,57 +0,0 @@
1
- import { TransactionArgument, Transaction } from "@mysten/sui/transactions";
2
- import { TypusConfig } from "../../src/utils";
3
- /**
4
- entry fun free_mint(
5
- pool: &mut Pool,
6
- whitelist_token: Whitelist,
7
- ctx: &mut TxContext,
8
- )
9
- */
10
- export declare function getMintTx(config: TypusConfig, tx: Transaction, input: {
11
- pool: string;
12
- whitelist_token: string;
13
- }): Promise<Transaction>;
14
- /**
15
- entry fun free_mint_into_kiosk(
16
- pool: &mut Pool,
17
- whitelist_token: Whitelist,
18
- kiosk: &mut Kiosk,
19
- kiosk_cap: &KioskOwnerCap,
20
- ctx: &mut TxContext,
21
- )
22
- */
23
- export declare function getMintToKioskTx(config: TypusConfig, tx: Transaction, input: {
24
- pool: string;
25
- whitelist_token: string;
26
- kiosk: string;
27
- kiosk_cap: string;
28
- }): Promise<Transaction>;
29
- /**
30
- public fun pay<T>(
31
- config.object.nftTransferPolicy: &mut TransferPolicy<T>,
32
- request: &mut TransferRequest<T>,
33
- payment: Coin<SUI>
34
- )
35
- */
36
- export declare function getPayRoyaltyTx(config: TypusConfig, tx: Transaction, input: {
37
- request: TransactionArgument;
38
- coin: string;
39
- }): Promise<Transaction>;
40
- /**
41
- entry fun request_mint(
42
- pool: &mut Pool,
43
- seed: u64, // 0, 1, 2
44
- coin: Coin<SUI>,
45
- clock: &Clock,
46
- ctx: & TxContext
47
- )
48
- */
49
- export declare function getRequestMintTx(config: TypusConfig, tx: Transaction, input: {
50
- pool: string;
51
- seed: string;
52
- price: string;
53
- }): Promise<Transaction>;
54
- export declare function getIsWhitelistTx(config: TypusConfig, tx: Transaction, input: {
55
- pool: string;
56
- user: string;
57
- }): Promise<Transaction>;
@@ -1,161 +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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["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
- 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
- Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.getMintTx = getMintTx;
56
- exports.getMintToKioskTx = getMintToKioskTx;
57
- exports.getPayRoyaltyTx = getPayRoyaltyTx;
58
- exports.getRequestMintTx = getRequestMintTx;
59
- exports.getIsWhitelistTx = getIsWhitelistTx;
60
- var constants_1 = require("../../src/constants");
61
- /**
62
- entry fun free_mint(
63
- pool: &mut Pool,
64
- whitelist_token: Whitelist,
65
- ctx: &mut TxContext,
66
- )
67
- */
68
- function getMintTx(config, tx, input) {
69
- return __awaiter(this, void 0, void 0, function () {
70
- return __generator(this, function (_a) {
71
- tx.moveCall({
72
- target: "".concat(config.package.nft, "::typus_nft::free_mint"),
73
- typeArguments: [],
74
- arguments: [tx.object(input.pool), tx.object(config.object.nftTransferPolicy), tx.object(input.whitelist_token), tx.object(constants_1.CLOCK)],
75
- });
76
- return [2 /*return*/, tx];
77
- });
78
- });
79
- }
80
- /**
81
- entry fun free_mint_into_kiosk(
82
- pool: &mut Pool,
83
- whitelist_token: Whitelist,
84
- kiosk: &mut Kiosk,
85
- kiosk_cap: &KioskOwnerCap,
86
- ctx: &mut TxContext,
87
- )
88
- */
89
- function getMintToKioskTx(config, tx, input) {
90
- return __awaiter(this, void 0, void 0, function () {
91
- return __generator(this, function (_a) {
92
- tx.moveCall({
93
- target: "".concat(config.package.nft, "::typus_nft::free_mint_into_kiosk"),
94
- typeArguments: [],
95
- arguments: [
96
- tx.object(input.pool),
97
- tx.object(config.object.nftTransferPolicy),
98
- tx.object(input.whitelist_token),
99
- tx.object(input.kiosk),
100
- tx.object(input.kiosk_cap),
101
- tx.object(constants_1.CLOCK),
102
- ],
103
- });
104
- return [2 /*return*/, tx];
105
- });
106
- });
107
- }
108
- /**
109
- public fun pay<T>(
110
- config.object.nftTransferPolicy: &mut TransferPolicy<T>,
111
- request: &mut TransferRequest<T>,
112
- payment: Coin<SUI>
113
- )
114
- */
115
- function getPayRoyaltyTx(config, tx, input) {
116
- return __awaiter(this, void 0, void 0, function () {
117
- return __generator(this, function (_a) {
118
- tx.moveCall({
119
- target: "".concat(config.package.nft, "::royalty_rule::pay"),
120
- typeArguments: ["".concat(config.package.nft, "::typus_nft::Tails")],
121
- arguments: [tx.object(config.object.nftTransferPolicy), input.request, tx.object(input.coin)],
122
- });
123
- return [2 /*return*/, tx];
124
- });
125
- });
126
- }
127
- /**
128
- entry fun request_mint(
129
- pool: &mut Pool,
130
- seed: u64, // 0, 1, 2
131
- coin: Coin<SUI>,
132
- clock: &Clock,
133
- ctx: & TxContext
134
- )
135
- */
136
- function getRequestMintTx(config, tx, input) {
137
- return __awaiter(this, void 0, void 0, function () {
138
- var _a, coin;
139
- return __generator(this, function (_b) {
140
- _a = __read(tx.splitCoins(tx.gas, [tx.pure.u64(input.price)]), 1), coin = _a[0];
141
- tx.moveCall({
142
- target: "".concat(config.package.nft, "::discount_mint::request_mint"),
143
- typeArguments: [],
144
- arguments: [tx.object(input.pool), tx.pure.u64(input.seed), coin, tx.object(constants_1.CLOCK)],
145
- });
146
- return [2 /*return*/, tx];
147
- });
148
- });
149
- }
150
- function getIsWhitelistTx(config, tx, input) {
151
- return __awaiter(this, void 0, void 0, function () {
152
- return __generator(this, function (_a) {
153
- tx.moveCall({
154
- target: "".concat(config.package.nft, "::discount_mint::is_whitelist"),
155
- typeArguments: [],
156
- arguments: [tx.object(input.pool), tx.pure.address(input.user)],
157
- });
158
- return [2 /*return*/, tx];
159
- });
160
- });
161
- }