@evergonlabs/tmi-protocol-api 0.1.4 → 0.2.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 (80) hide show
  1. package/dist/app.d.ts +71 -3
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/app.js +2 -0
  4. package/dist/client.d.ts +83 -3
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/fractions/activity/searchActivity.route.d.ts +45 -9
  7. package/dist/fractions/activity/searchActivity.route.d.ts.map +1 -1
  8. package/dist/fractions/activity/utils.d.ts +91 -15
  9. package/dist/fractions/activity/utils.d.ts.map +1 -1
  10. package/dist/fractions/activity/utils.js +12 -3
  11. package/dist/fractions/deployMarket/v0/index.d.ts +3 -0
  12. package/dist/fractions/deployMarket/v0/index.d.ts.map +1 -0
  13. package/dist/fractions/deployMarket/v0/index.js +2 -0
  14. package/dist/fractions/index.d.ts +15 -3
  15. package/dist/fractions/index.d.ts.map +1 -1
  16. package/dist/fractions/sales/searchActivity.route.js +2 -2
  17. package/dist/fractions/sales/searchSaleEvents/v0/searchSaleEvents.js +6 -6
  18. package/dist/general/balanceClient.d.ts +21 -5
  19. package/dist/general/balanceClient.d.ts.map +1 -1
  20. package/dist/general/utils/tokenBalance/tokenBalance.d.ts +19 -3
  21. package/dist/general/utils/tokenBalance/tokenBalance.d.ts.map +1 -1
  22. package/dist/general/utils/tokenBalance/tokenBalance.js +8 -3
  23. package/dist/issuance/deploy.d.ts +63 -0
  24. package/dist/issuance/deploy.d.ts.map +1 -1
  25. package/dist/issuance/deploy.js +78 -0
  26. package/dist/issuance/index.d.ts +56 -0
  27. package/dist/issuance/index.d.ts.map +1 -1
  28. package/dist/issuance/index.js +6 -2
  29. package/dist/issuance/upgrade.d.ts +82 -0
  30. package/dist/issuance/upgrade.d.ts.map +1 -0
  31. package/dist/issuance/upgrade.js +46 -0
  32. package/dist/lending/buyBackAfterLiquidation/v0/buyBackAfterLiquidation.routes.d.ts +57 -0
  33. package/dist/lending/buyBackAfterLiquidation/v0/buyBackAfterLiquidation.routes.d.ts.map +1 -0
  34. package/dist/lending/buyBackAfterLiquidation/v0/buyBackAfterLiquidation.routes.js +33 -0
  35. package/dist/lending/buyBackAfterLiquidation/v0/buyBackAfterLiquidation.schema.d.ts +12 -0
  36. package/dist/lending/buyBackAfterLiquidation/v0/buyBackAfterLiquidation.schema.d.ts.map +1 -0
  37. package/dist/lending/buyBackAfterLiquidation/v0/buyBackAfterLiquidation.schema.js +10 -0
  38. package/dist/lending/buyback/v0/buyback.routes.d.ts +61 -0
  39. package/dist/lending/buyback/v0/buyback.routes.d.ts.map +1 -0
  40. package/dist/lending/buyback/v0/buyback.routes.js +33 -0
  41. package/dist/lending/buyback/v0/buyback.schema.d.ts +15 -0
  42. package/dist/lending/buyback/v0/buyback.schema.d.ts.map +1 -0
  43. package/dist/lending/buyback/v0/buyback.schema.js +13 -0
  44. package/dist/lending/createLendingSale.d.ts +585 -0
  45. package/dist/lending/createLendingSale.d.ts.map +1 -0
  46. package/dist/lending/createLendingSale.js +81 -0
  47. package/dist/lending/deployMarket/v0/deployMarket.routes.d.ts +117 -0
  48. package/dist/lending/deployMarket/v0/deployMarket.routes.d.ts.map +1 -0
  49. package/dist/lending/deployMarket/v0/deployMarket.routes.js +34 -0
  50. package/dist/lending/deployMarket/v0/deployMarket.schema.d.ts +105 -0
  51. package/dist/lending/deployMarket/v0/deployMarket.schema.d.ts.map +1 -0
  52. package/dist/lending/deployMarket/v0/deployMarket.schema.js +12 -0
  53. package/dist/lending/deployMarket/v0/lending.routes.d.ts +105 -0
  54. package/dist/lending/deployMarket/v0/lending.routes.d.ts.map +1 -0
  55. package/dist/lending/deployMarket/v0/lending.routes.js +35 -0
  56. package/dist/lending/deployMarket/v0/lending.schema.d.ts +99 -0
  57. package/dist/lending/deployMarket/v0/lending.schema.d.ts.map +1 -0
  58. package/dist/lending/deployMarket/v0/lending.schema.js +14 -0
  59. package/dist/lending/forcefullyUnlockWrappersNft/v0/forcefullyUnlockWrappersNft.routes.d.ts +57 -0
  60. package/dist/lending/forcefullyUnlockWrappersNft/v0/forcefullyUnlockWrappersNft.routes.d.ts.map +1 -0
  61. package/dist/lending/forcefullyUnlockWrappersNft/v0/forcefullyUnlockWrappersNft.routes.js +33 -0
  62. package/dist/lending/forcefullyUnlockWrappersNft/v0/forcefullyUnlockWrappersNft.schema.d.ts +12 -0
  63. package/dist/lending/forcefullyUnlockWrappersNft/v0/forcefullyUnlockWrappersNft.schema.d.ts.map +1 -0
  64. package/dist/lending/forcefullyUnlockWrappersNft/v0/forcefullyUnlockWrappersNft.schema.js +10 -0
  65. package/dist/lending/index.d.ts +226 -0
  66. package/dist/lending/index.d.ts.map +1 -0
  67. package/dist/lending/index.js +24 -0
  68. package/dist/lending/setCollateralPrice/v0/setCollateralPrice.routes.d.ts +61 -0
  69. package/dist/lending/setCollateralPrice/v0/setCollateralPrice.routes.d.ts.map +1 -0
  70. package/dist/lending/setCollateralPrice/v0/setCollateralPrice.routes.js +33 -0
  71. package/dist/lending/setCollateralPrice/v0/setCollateralPrice.schema.d.ts +15 -0
  72. package/dist/lending/setCollateralPrice/v0/setCollateralPrice.schema.d.ts.map +1 -0
  73. package/dist/lending/setCollateralPrice/v0/setCollateralPrice.schema.js +13 -0
  74. package/package.json +6 -6
  75. package/dist/fractions/sales/searchClaim.route.d.ts +0 -62
  76. package/dist/fractions/sales/searchClaim.route.d.ts.map +0 -1
  77. package/dist/fractions/sales/searchClaim.route.js +0 -47
  78. package/dist/fractions/sales/searchPurchase.route.d.ts +0 -120
  79. package/dist/fractions/sales/searchPurchase.route.d.ts.map +0 -1
  80. package/dist/fractions/sales/searchPurchase.route.js +0 -70
@@ -0,0 +1,585 @@
1
+ import { Env } from "hono";
2
+ import { Factory } from "hono/factory";
3
+ import { z } from "zod";
4
+ export declare const BuyBackConfigSchema: z.ZodObject<{
5
+ durationSeconds: z.ZodNumber;
6
+ interestPercentage: z.ZodNumber;
7
+ liquidationLimitPercentage: z.ZodNumber;
8
+ marginCallLimitPercentage: z.ZodNumber;
9
+ }, "strip", z.ZodTypeAny, {
10
+ durationSeconds: number;
11
+ interestPercentage: number;
12
+ liquidationLimitPercentage: number;
13
+ marginCallLimitPercentage: number;
14
+ }, {
15
+ durationSeconds: number;
16
+ interestPercentage: number;
17
+ liquidationLimitPercentage: number;
18
+ marginCallLimitPercentage: number;
19
+ }>;
20
+ export declare const CreateLendingFractionsRequestSchema: z.ZodObject<{
21
+ chainId: z.ZodType<import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId, z.ZodTypeDef, import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId>;
22
+ market: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
23
+ fractions: z.ZodObject<{
24
+ token: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
25
+ symbol: z.ZodString;
26
+ name: z.ZodString;
27
+ amount: z.ZodBigInt;
28
+ }, "strip", z.ZodTypeAny, {
29
+ symbol: string;
30
+ name: string;
31
+ amount: bigint;
32
+ token?: `0x${string}` | undefined;
33
+ }, {
34
+ symbol: string;
35
+ name: string;
36
+ amount: bigint;
37
+ token?: `0x${string}` | undefined;
38
+ }>;
39
+ timeBoundary: z.ZodObject<{
40
+ start: z.ZodDate;
41
+ end: z.ZodDate;
42
+ }, "strip", z.ZodTypeAny, {
43
+ start: Date;
44
+ end: Date;
45
+ }, {
46
+ start: Date;
47
+ end: Date;
48
+ }>;
49
+ cap: z.ZodObject<{
50
+ soft: z.ZodBigInt;
51
+ hard: z.ZodBigInt;
52
+ softPerAccount: z.ZodOptional<z.ZodBigInt>;
53
+ hardPerAccount: z.ZodOptional<z.ZodBigInt>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ soft: bigint;
56
+ hard: bigint;
57
+ softPerAccount?: bigint | undefined;
58
+ hardPerAccount?: bigint | undefined;
59
+ }, {
60
+ soft: bigint;
61
+ hard: bigint;
62
+ softPerAccount?: bigint | undefined;
63
+ hardPerAccount?: bigint | undefined;
64
+ }>;
65
+ wrapped: z.ZodArray<z.ZodUnion<[z.ZodObject<{
66
+ type: z.ZodLiteral<"ERC20">;
67
+ address: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
68
+ values: z.ZodArray<z.ZodBigInt, "atleastone">;
69
+ }, "strip", z.ZodTypeAny, {
70
+ values: [bigint, ...bigint[]];
71
+ type: "ERC20";
72
+ address: `0x${string}`;
73
+ }, {
74
+ values: [bigint, ...bigint[]];
75
+ type: "ERC20";
76
+ address: `0x${string}`;
77
+ }>, z.ZodObject<{
78
+ type: z.ZodLiteral<"ERC721">;
79
+ address: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
80
+ tokenIds: z.ZodArray<z.ZodBigInt, "atleastone">;
81
+ }, "strip", z.ZodTypeAny, {
82
+ type: "ERC721";
83
+ address: `0x${string}`;
84
+ tokenIds: [bigint, ...bigint[]];
85
+ }, {
86
+ type: "ERC721";
87
+ address: `0x${string}`;
88
+ tokenIds: [bigint, ...bigint[]];
89
+ }>, z.ZodObject<{
90
+ type: z.ZodLiteral<"ERC1155">;
91
+ address: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
92
+ tokenIds: z.ZodArray<z.ZodBigInt, "atleastone">;
93
+ values: z.ZodArray<z.ZodBigInt, "atleastone">;
94
+ }, "strip", z.ZodTypeAny, {
95
+ values: [bigint, ...bigint[]];
96
+ type: "ERC1155";
97
+ address: `0x${string}`;
98
+ tokenIds: [bigint, ...bigint[]];
99
+ }, {
100
+ values: [bigint, ...bigint[]];
101
+ type: "ERC1155";
102
+ address: `0x${string}`;
103
+ tokenIds: [bigint, ...bigint[]];
104
+ }>]>, "atleastone">;
105
+ funding: z.ZodArray<z.ZodObject<{
106
+ token: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
107
+ amountPerPacket: z.ZodBigInt;
108
+ }, "strip", z.ZodTypeAny, {
109
+ amountPerPacket: bigint;
110
+ token: `0x${string}`;
111
+ }, {
112
+ amountPerPacket: bigint;
113
+ token: `0x${string}`;
114
+ }>, "atleastone">;
115
+ discounts: z.ZodOptional<z.ZodObject<{
116
+ burnableTokenAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
117
+ amountToBurn: z.ZodBigInt;
118
+ percentDiscount: z.ZodNumber;
119
+ }, "strip", z.ZodTypeAny, {
120
+ burnableTokenAddress: `0x${string}`;
121
+ amountToBurn: bigint;
122
+ percentDiscount: number;
123
+ }, {
124
+ burnableTokenAddress: `0x${string}`;
125
+ amountToBurn: bigint;
126
+ percentDiscount: number;
127
+ }>>;
128
+ refundAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
129
+ amountOfPacketsPerFraction: z.ZodBigInt;
130
+ buyback: z.ZodObject<{
131
+ durationSeconds: z.ZodNumber;
132
+ interestPercentage: z.ZodNumber;
133
+ liquidationLimitPercentage: z.ZodNumber;
134
+ marginCallLimitPercentage: z.ZodNumber;
135
+ }, "strip", z.ZodTypeAny, {
136
+ durationSeconds: number;
137
+ interestPercentage: number;
138
+ liquidationLimitPercentage: number;
139
+ marginCallLimitPercentage: number;
140
+ }, {
141
+ durationSeconds: number;
142
+ interestPercentage: number;
143
+ liquidationLimitPercentage: number;
144
+ marginCallLimitPercentage: number;
145
+ }>;
146
+ }, "strip", z.ZodTypeAny, {
147
+ chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
148
+ fractions: {
149
+ symbol: string;
150
+ name: string;
151
+ amount: bigint;
152
+ token?: `0x${string}` | undefined;
153
+ };
154
+ cap: {
155
+ soft: bigint;
156
+ hard: bigint;
157
+ softPerAccount?: bigint | undefined;
158
+ hardPerAccount?: bigint | undefined;
159
+ };
160
+ market: `0x${string}`;
161
+ timeBoundary: {
162
+ start: Date;
163
+ end: Date;
164
+ };
165
+ wrapped: [{
166
+ values: [bigint, ...bigint[]];
167
+ type: "ERC20";
168
+ address: `0x${string}`;
169
+ } | {
170
+ type: "ERC721";
171
+ address: `0x${string}`;
172
+ tokenIds: [bigint, ...bigint[]];
173
+ } | {
174
+ values: [bigint, ...bigint[]];
175
+ type: "ERC1155";
176
+ address: `0x${string}`;
177
+ tokenIds: [bigint, ...bigint[]];
178
+ }, ...({
179
+ values: [bigint, ...bigint[]];
180
+ type: "ERC20";
181
+ address: `0x${string}`;
182
+ } | {
183
+ type: "ERC721";
184
+ address: `0x${string}`;
185
+ tokenIds: [bigint, ...bigint[]];
186
+ } | {
187
+ values: [bigint, ...bigint[]];
188
+ type: "ERC1155";
189
+ address: `0x${string}`;
190
+ tokenIds: [bigint, ...bigint[]];
191
+ })[]];
192
+ funding: [{
193
+ amountPerPacket: bigint;
194
+ token: `0x${string}`;
195
+ }, ...{
196
+ amountPerPacket: bigint;
197
+ token: `0x${string}`;
198
+ }[]];
199
+ refundAddress: `0x${string}`;
200
+ amountOfPacketsPerFraction: bigint;
201
+ buyback: {
202
+ durationSeconds: number;
203
+ interestPercentage: number;
204
+ liquidationLimitPercentage: number;
205
+ marginCallLimitPercentage: number;
206
+ };
207
+ discounts?: {
208
+ burnableTokenAddress: `0x${string}`;
209
+ amountToBurn: bigint;
210
+ percentDiscount: number;
211
+ } | undefined;
212
+ }, {
213
+ chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
214
+ fractions: {
215
+ symbol: string;
216
+ name: string;
217
+ amount: bigint;
218
+ token?: `0x${string}` | undefined;
219
+ };
220
+ cap: {
221
+ soft: bigint;
222
+ hard: bigint;
223
+ softPerAccount?: bigint | undefined;
224
+ hardPerAccount?: bigint | undefined;
225
+ };
226
+ market: `0x${string}`;
227
+ timeBoundary: {
228
+ start: Date;
229
+ end: Date;
230
+ };
231
+ wrapped: [{
232
+ values: [bigint, ...bigint[]];
233
+ type: "ERC20";
234
+ address: `0x${string}`;
235
+ } | {
236
+ type: "ERC721";
237
+ address: `0x${string}`;
238
+ tokenIds: [bigint, ...bigint[]];
239
+ } | {
240
+ values: [bigint, ...bigint[]];
241
+ type: "ERC1155";
242
+ address: `0x${string}`;
243
+ tokenIds: [bigint, ...bigint[]];
244
+ }, ...({
245
+ values: [bigint, ...bigint[]];
246
+ type: "ERC20";
247
+ address: `0x${string}`;
248
+ } | {
249
+ type: "ERC721";
250
+ address: `0x${string}`;
251
+ tokenIds: [bigint, ...bigint[]];
252
+ } | {
253
+ values: [bigint, ...bigint[]];
254
+ type: "ERC1155";
255
+ address: `0x${string}`;
256
+ tokenIds: [bigint, ...bigint[]];
257
+ })[]];
258
+ funding: [{
259
+ amountPerPacket: bigint;
260
+ token: `0x${string}`;
261
+ }, ...{
262
+ amountPerPacket: bigint;
263
+ token: `0x${string}`;
264
+ }[]];
265
+ refundAddress: `0x${string}`;
266
+ amountOfPacketsPerFraction: bigint;
267
+ buyback: {
268
+ durationSeconds: number;
269
+ interestPercentage: number;
270
+ liquidationLimitPercentage: number;
271
+ marginCallLimitPercentage: number;
272
+ };
273
+ discounts?: {
274
+ burnableTokenAddress: `0x${string}`;
275
+ amountToBurn: bigint;
276
+ percentDiscount: number;
277
+ } | undefined;
278
+ }>;
279
+ export declare function createLendingSale<E extends Env>(factory: Factory<E>): [import("hono/types").H<any, string, {}, Promise<Response & import("hono").TypedResponse<{
280
+ data: `0x${string}`;
281
+ to: `0x${string}`;
282
+ details: {
283
+ functionName: string;
284
+ address: `0x${string}`;
285
+ abi: any[];
286
+ args: any[];
287
+ };
288
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>>, import("hono/types").H<Env, string, {
289
+ in: {
290
+ json: {
291
+ chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
292
+ fractions: {
293
+ symbol: string;
294
+ name: string;
295
+ amount: bigint;
296
+ token?: `0x${string}` | undefined;
297
+ };
298
+ cap: {
299
+ soft: bigint;
300
+ hard: bigint;
301
+ softPerAccount?: bigint | undefined;
302
+ hardPerAccount?: bigint | undefined;
303
+ };
304
+ market: `0x${string}`;
305
+ timeBoundary: {
306
+ start: Date;
307
+ end: Date;
308
+ };
309
+ wrapped: [{
310
+ values: [bigint, ...bigint[]];
311
+ type: "ERC20";
312
+ address: `0x${string}`;
313
+ } | {
314
+ type: "ERC721";
315
+ address: `0x${string}`;
316
+ tokenIds: [bigint, ...bigint[]];
317
+ } | {
318
+ values: [bigint, ...bigint[]];
319
+ type: "ERC1155";
320
+ address: `0x${string}`;
321
+ tokenIds: [bigint, ...bigint[]];
322
+ }, ...({
323
+ values: [bigint, ...bigint[]];
324
+ type: "ERC20";
325
+ address: `0x${string}`;
326
+ } | {
327
+ type: "ERC721";
328
+ address: `0x${string}`;
329
+ tokenIds: [bigint, ...bigint[]];
330
+ } | {
331
+ values: [bigint, ...bigint[]];
332
+ type: "ERC1155";
333
+ address: `0x${string}`;
334
+ tokenIds: [bigint, ...bigint[]];
335
+ })[]];
336
+ funding: [{
337
+ amountPerPacket: bigint;
338
+ token: `0x${string}`;
339
+ }, ...{
340
+ amountPerPacket: bigint;
341
+ token: `0x${string}`;
342
+ }[]];
343
+ refundAddress: `0x${string}`;
344
+ amountOfPacketsPerFraction: bigint;
345
+ buyback: {
346
+ durationSeconds: number;
347
+ interestPercentage: number;
348
+ liquidationLimitPercentage: number;
349
+ marginCallLimitPercentage: number;
350
+ };
351
+ discounts?: {
352
+ burnableTokenAddress: `0x${string}`;
353
+ amountToBurn: bigint;
354
+ percentDiscount: number;
355
+ } | undefined;
356
+ };
357
+ };
358
+ out: {
359
+ json: {
360
+ chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
361
+ fractions: {
362
+ symbol: string;
363
+ name: string;
364
+ amount: bigint;
365
+ token?: `0x${string}` | undefined;
366
+ };
367
+ cap: {
368
+ soft: bigint;
369
+ hard: bigint;
370
+ softPerAccount?: bigint | undefined;
371
+ hardPerAccount?: bigint | undefined;
372
+ };
373
+ market: `0x${string}`;
374
+ timeBoundary: {
375
+ start: Date;
376
+ end: Date;
377
+ };
378
+ wrapped: [{
379
+ values: [bigint, ...bigint[]];
380
+ type: "ERC20";
381
+ address: `0x${string}`;
382
+ } | {
383
+ type: "ERC721";
384
+ address: `0x${string}`;
385
+ tokenIds: [bigint, ...bigint[]];
386
+ } | {
387
+ values: [bigint, ...bigint[]];
388
+ type: "ERC1155";
389
+ address: `0x${string}`;
390
+ tokenIds: [bigint, ...bigint[]];
391
+ }, ...({
392
+ values: [bigint, ...bigint[]];
393
+ type: "ERC20";
394
+ address: `0x${string}`;
395
+ } | {
396
+ type: "ERC721";
397
+ address: `0x${string}`;
398
+ tokenIds: [bigint, ...bigint[]];
399
+ } | {
400
+ values: [bigint, ...bigint[]];
401
+ type: "ERC1155";
402
+ address: `0x${string}`;
403
+ tokenIds: [bigint, ...bigint[]];
404
+ })[]];
405
+ funding: [{
406
+ amountPerPacket: bigint;
407
+ token: `0x${string}`;
408
+ }, ...{
409
+ amountPerPacket: bigint;
410
+ token: `0x${string}`;
411
+ }[]];
412
+ refundAddress: `0x${string}`;
413
+ amountOfPacketsPerFraction: bigint;
414
+ buyback: {
415
+ durationSeconds: number;
416
+ interestPercentage: number;
417
+ liquidationLimitPercentage: number;
418
+ marginCallLimitPercentage: number;
419
+ };
420
+ discounts?: {
421
+ burnableTokenAddress: `0x${string}`;
422
+ amountToBurn: bigint;
423
+ percentDiscount: number;
424
+ } | undefined;
425
+ };
426
+ };
427
+ }, Promise<Response & import("hono").TypedResponse<{
428
+ data: `0x${string}`;
429
+ to: `0x${string}`;
430
+ details: {
431
+ functionName: string;
432
+ address: `0x${string}`;
433
+ abi: any[];
434
+ args: any[];
435
+ };
436
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>>, import("hono/types").H<import("hono/utils/types").IfAnyThenEmptyObject<E extends Env ? Env extends E ? {} : E : E> & {}, string, {
437
+ in: {
438
+ json: {
439
+ chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
440
+ fractions: {
441
+ symbol: string;
442
+ name: string;
443
+ amount: bigint;
444
+ token?: `0x${string}` | undefined;
445
+ };
446
+ cap: {
447
+ soft: bigint;
448
+ hard: bigint;
449
+ softPerAccount?: bigint | undefined;
450
+ hardPerAccount?: bigint | undefined;
451
+ };
452
+ market: `0x${string}`;
453
+ timeBoundary: {
454
+ start: Date;
455
+ end: Date;
456
+ };
457
+ wrapped: [{
458
+ values: [bigint, ...bigint[]];
459
+ type: "ERC20";
460
+ address: `0x${string}`;
461
+ } | {
462
+ type: "ERC721";
463
+ address: `0x${string}`;
464
+ tokenIds: [bigint, ...bigint[]];
465
+ } | {
466
+ values: [bigint, ...bigint[]];
467
+ type: "ERC1155";
468
+ address: `0x${string}`;
469
+ tokenIds: [bigint, ...bigint[]];
470
+ }, ...({
471
+ values: [bigint, ...bigint[]];
472
+ type: "ERC20";
473
+ address: `0x${string}`;
474
+ } | {
475
+ type: "ERC721";
476
+ address: `0x${string}`;
477
+ tokenIds: [bigint, ...bigint[]];
478
+ } | {
479
+ values: [bigint, ...bigint[]];
480
+ type: "ERC1155";
481
+ address: `0x${string}`;
482
+ tokenIds: [bigint, ...bigint[]];
483
+ })[]];
484
+ funding: [{
485
+ amountPerPacket: bigint;
486
+ token: `0x${string}`;
487
+ }, ...{
488
+ amountPerPacket: bigint;
489
+ token: `0x${string}`;
490
+ }[]];
491
+ refundAddress: `0x${string}`;
492
+ amountOfPacketsPerFraction: bigint;
493
+ buyback: {
494
+ durationSeconds: number;
495
+ interestPercentage: number;
496
+ liquidationLimitPercentage: number;
497
+ marginCallLimitPercentage: number;
498
+ };
499
+ discounts?: {
500
+ burnableTokenAddress: `0x${string}`;
501
+ amountToBurn: bigint;
502
+ percentDiscount: number;
503
+ } | undefined;
504
+ };
505
+ };
506
+ out: {
507
+ json: {
508
+ chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
509
+ fractions: {
510
+ symbol: string;
511
+ name: string;
512
+ amount: bigint;
513
+ token?: `0x${string}` | undefined;
514
+ };
515
+ cap: {
516
+ soft: bigint;
517
+ hard: bigint;
518
+ softPerAccount?: bigint | undefined;
519
+ hardPerAccount?: bigint | undefined;
520
+ };
521
+ market: `0x${string}`;
522
+ timeBoundary: {
523
+ start: Date;
524
+ end: Date;
525
+ };
526
+ wrapped: [{
527
+ values: [bigint, ...bigint[]];
528
+ type: "ERC20";
529
+ address: `0x${string}`;
530
+ } | {
531
+ type: "ERC721";
532
+ address: `0x${string}`;
533
+ tokenIds: [bigint, ...bigint[]];
534
+ } | {
535
+ values: [bigint, ...bigint[]];
536
+ type: "ERC1155";
537
+ address: `0x${string}`;
538
+ tokenIds: [bigint, ...bigint[]];
539
+ }, ...({
540
+ values: [bigint, ...bigint[]];
541
+ type: "ERC20";
542
+ address: `0x${string}`;
543
+ } | {
544
+ type: "ERC721";
545
+ address: `0x${string}`;
546
+ tokenIds: [bigint, ...bigint[]];
547
+ } | {
548
+ values: [bigint, ...bigint[]];
549
+ type: "ERC1155";
550
+ address: `0x${string}`;
551
+ tokenIds: [bigint, ...bigint[]];
552
+ })[]];
553
+ funding: [{
554
+ amountPerPacket: bigint;
555
+ token: `0x${string}`;
556
+ }, ...{
557
+ amountPerPacket: bigint;
558
+ token: `0x${string}`;
559
+ }[]];
560
+ refundAddress: `0x${string}`;
561
+ amountOfPacketsPerFraction: bigint;
562
+ buyback: {
563
+ durationSeconds: number;
564
+ interestPercentage: number;
565
+ liquidationLimitPercentage: number;
566
+ marginCallLimitPercentage: number;
567
+ };
568
+ discounts?: {
569
+ burnableTokenAddress: `0x${string}`;
570
+ amountToBurn: bigint;
571
+ percentDiscount: number;
572
+ } | undefined;
573
+ };
574
+ };
575
+ }, Promise<Response & import("hono").TypedResponse<{
576
+ data: `0x${string}`;
577
+ to: `0x${string}`;
578
+ details: {
579
+ functionName: string;
580
+ address: `0x${string}`;
581
+ abi: any[];
582
+ args: any[];
583
+ };
584
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>>];
585
+ //# sourceMappingURL=createLendingSale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createLendingSale.d.ts","sourceRoot":"","sources":["../../src/lending/createLendingSale.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAWvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAK9B,CAAC;AAEH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY9C,CAAC;AAEH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEAyEnE"}
@@ -0,0 +1,81 @@
1
+ import { describeRoute } from "hono-openapi";
2
+ import { resolver, validator } from "hono-openapi/zod";
3
+ import { buildCreateLendingFractionsTx, WrappedERC1155, WrappedERC20, WrappedERC721, } from "@evergonlabs/tmi-protocol-fractions-sdk";
4
+ import { z } from "zod";
5
+ import { AddressSchema, TmiChainIdSchema, toTransaction, TransactionSchema } from "../common/index.js";
6
+ import { BurnForDiscountSchema, CapitalizationSchema, FractionSchema, FundingSchema, TimeBoundarySchema, WrappedTokenTypeSchema, } from "../fractions/createFractions/v0/createFractions.schema.js";
7
+ export const BuyBackConfigSchema = z.object({
8
+ durationSeconds: z.number().int().positive(),
9
+ interestPercentage: z.number().int().min(0).max(10000),
10
+ liquidationLimitPercentage: z.number().int().min(0).max(10000),
11
+ marginCallLimitPercentage: z.number().int().min(0).max(10000),
12
+ });
13
+ export const CreateLendingFractionsRequestSchema = z.object({
14
+ chainId: TmiChainIdSchema,
15
+ market: AddressSchema,
16
+ fractions: FractionSchema,
17
+ timeBoundary: TimeBoundarySchema,
18
+ cap: CapitalizationSchema,
19
+ wrapped: z.array(WrappedTokenTypeSchema).nonempty(),
20
+ funding: z.array(FundingSchema).nonempty(),
21
+ discounts: BurnForDiscountSchema.optional(),
22
+ refundAddress: AddressSchema,
23
+ amountOfPacketsPerFraction: z.coerce.bigint().positive(),
24
+ buyback: BuyBackConfigSchema,
25
+ });
26
+ export function createLendingSale(factory) {
27
+ const route = describeRoute({
28
+ summary: "Create lending sale fractions",
29
+ description: "Returns transaction data for creating lending sale fractions",
30
+ tags: ["Lending"],
31
+ responses: {
32
+ 200: {
33
+ description: "Returns transaction data for creating lending sale fractions",
34
+ content: {
35
+ "application/json": {
36
+ schema: resolver(TransactionSchema),
37
+ },
38
+ },
39
+ },
40
+ },
41
+ });
42
+ return factory.createHandlers(route, validator("json", CreateLendingFractionsRequestSchema.openapi({ ref: "CreateLendingFractionsRequestSchema" })), async (c) => {
43
+ const { chainId, market, wrapped, funding, fractions, timeBoundary, cap, amountOfPacketsPerFraction, refundAddress, discounts, buyback, } = c.req.valid("json");
44
+ const wrappedTokens = wrapped.map((token) => {
45
+ if (token.type === "ERC20") {
46
+ return new WrappedERC20(token.address, token.values[0]);
47
+ }
48
+ else if (token.type === "ERC721") {
49
+ return new WrappedERC721(token.address, token.tokenIds);
50
+ }
51
+ else if (token.type === "ERC1155") {
52
+ return new WrappedERC1155(token.address, token.tokenIds, token.values);
53
+ }
54
+ else {
55
+ throw new Error(`Unsupported token type: ${JSON.stringify(token)}`);
56
+ }
57
+ });
58
+ const lendingFractionsConfig = {
59
+ chainId: chainId,
60
+ market: market,
61
+ wrapped: wrappedTokens,
62
+ funding: funding,
63
+ fractions: {
64
+ name: fractions.name,
65
+ symbol: fractions.symbol,
66
+ amount: fractions.amount,
67
+ },
68
+ timeBoundary: {
69
+ start: new Date(timeBoundary.start),
70
+ end: new Date(timeBoundary.end),
71
+ },
72
+ discounts: discounts,
73
+ cap: cap,
74
+ amountOfPacketsPerFraction: amountOfPacketsPerFraction,
75
+ refundAddress: refundAddress,
76
+ buyback: buyback,
77
+ };
78
+ const tx = buildCreateLendingFractionsTx(lendingFractionsConfig);
79
+ return c.json(toTransaction(tx, true));
80
+ });
81
+ }