@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
@@ -1,6 +1,6 @@
1
1
  import { describeRoute } from "hono-openapi";
2
2
  import { resolver, validator } from "hono-openapi/zod";
3
- import { and, desc, eq } from "@ponder/client";
3
+ import { and, eq } from "@ponder/client";
4
4
  import { z } from "../../common/zod.js";
5
5
  import { indexerClient } from "../../common/indexer/index.js";
6
6
  import { indexerSchemas } from "../../common/indexer/schemas.js";
@@ -50,7 +50,7 @@ export function createSearchActivityV0App(factory) {
50
50
  where: and(filter.chainId ? eq(fractionsSaleActivity.chainId, Number(filter.chainId)) : undefined, filter.platform ? eq(fractionsSaleActivity.diamondAddress, filter.platform) : undefined, typeof filter.campaignId === "bigint" ? eq(fractionsSaleActivity.saleId, filter.campaignId) : undefined),
51
51
  limit: page.limit,
52
52
  offset: page.skip,
53
- orderBy: desc(fractionsSaleActivity.createdAt),
53
+ orderBy: fractionsSaleActivity.createdAt,
54
54
  });
55
55
  return c.json(result.map((i) => FractionsSaleActivitySchema.parse({
56
56
  chainId: i.chainId,
@@ -59,23 +59,23 @@ export function createSearchSaleEventsV0App(factory) {
59
59
  const { page, filter } = c.req.valid("json");
60
60
  const result = await indexerClient.db
61
61
  .select()
62
- .from(indexerSchemas.fractions.fractionsSales)
62
+ .from(indexerSchemas.fractions.fractionEvents)
63
63
  .limit(page.limit)
64
64
  .offset(page.skip)
65
- .orderBy(indexerSchemas.fractions.fractionsSales.createdAt)
66
- .where(and(filter.chainId ? eq(indexerSchemas.fractions.fractionsSales.chainId, Number(filter.chainId)) : undefined, filter.owner ? eq(indexerSchemas.fractions.fractionsSales.creator, filter.owner) : undefined, filter.platform ? eq(indexerSchemas.fractions.fractionsSales.diamondAddress, filter.platform) : undefined, typeof filter.campaignId === "number"
67
- ? eq(indexerSchemas.fractions.fractionsSales.saleId, BigInt(filter.campaignId))
65
+ .orderBy(indexerSchemas.fractions.fractionEvents.createdAt)
66
+ .where(and(filter.chainId ? eq(indexerSchemas.fractions.fractionEvents.chainId, Number(filter.chainId)) : undefined, filter.owner ? eq(indexerSchemas.fractions.fractionEvents.walletAddress, filter.owner) : undefined, filter.platform ? eq(indexerSchemas.fractions.fractionEvents.diamondAddress, filter.platform) : undefined, typeof filter.campaignId === "number"
67
+ ? eq(indexerSchemas.fractions.fractionEvents.saleId, BigInt(filter.campaignId))
68
68
  : undefined));
69
69
  return c.json(result.map((x) => toSaleEvent(x)), 200);
70
70
  });
71
71
  }
72
72
  function toSaleEvent(raw) {
73
73
  return {
74
- id: "0",
74
+ id: raw.id,
75
75
  txHash: raw.txHash,
76
76
  chainId: TmiChainIdSchema.parse(raw.chainId),
77
77
  platform: raw.diamondAddress,
78
- owner: raw.creator,
78
+ owner: raw.walletAddress,
79
79
  campaignId: raw.saleId ? PoolIdSchema.parse(raw.saleId) : undefined,
80
80
  createdAt: unixToDate(raw.createdAt).toISOString(),
81
81
  };
@@ -5,9 +5,9 @@ import { z } from "../common/zod.js";
5
5
  export declare const AccountBalancesResponse: z.ZodObject<{
6
6
  message: z.ZodString;
7
7
  status: z.ZodString;
8
- result: z.ZodArray<z.ZodObject<{
8
+ result: z.ZodArray<z.ZodEffects<z.ZodObject<{
9
9
  balance: z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodString>;
10
- tokenAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
10
+ contractAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
11
11
  decimals: z.ZodEffects<z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodNumber>, number, string | number | bigint>;
12
12
  tokenId: z.ZodOptional<z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodString>>;
13
13
  name: z.ZodString;
@@ -18,7 +18,7 @@ export declare const AccountBalancesResponse: z.ZodObject<{
18
18
  type: import("@evergonlabs/tmi-protocol-types/evm").TokenTypeEnum | null;
19
19
  name: string;
20
20
  decimals: number;
21
- tokenAddress: `0x${string}`;
21
+ contractAddress: `0x${string}`;
22
22
  balance: string;
23
23
  tokenId?: string | undefined;
24
24
  }, {
@@ -26,7 +26,23 @@ export declare const AccountBalancesResponse: z.ZodObject<{
26
26
  type: string;
27
27
  name: string;
28
28
  decimals: string | number | bigint;
29
+ contractAddress: `0x${string}`;
30
+ balance: string | number | bigint;
31
+ tokenId?: string | number | bigint | undefined;
32
+ }>, {
29
33
  tokenAddress: `0x${string}`;
34
+ symbol: string;
35
+ type: import("@evergonlabs/tmi-protocol-types/evm").TokenTypeEnum | null;
36
+ name: string;
37
+ decimals: number;
38
+ balance: string;
39
+ tokenId?: string | undefined;
40
+ }, {
41
+ symbol: string;
42
+ type: string;
43
+ name: string;
44
+ decimals: string | number | bigint;
45
+ contractAddress: `0x${string}`;
30
46
  balance: string | number | bigint;
31
47
  tokenId?: string | number | bigint | undefined;
32
48
  }>, "many">;
@@ -34,11 +50,11 @@ export declare const AccountBalancesResponse: z.ZodObject<{
34
50
  status: string;
35
51
  message: string;
36
52
  result: {
53
+ tokenAddress: `0x${string}`;
37
54
  symbol: string;
38
55
  type: import("@evergonlabs/tmi-protocol-types/evm").TokenTypeEnum | null;
39
56
  name: string;
40
57
  decimals: number;
41
- tokenAddress: `0x${string}`;
42
58
  balance: string;
43
59
  tokenId?: string | undefined;
44
60
  }[];
@@ -50,7 +66,7 @@ export declare const AccountBalancesResponse: z.ZodObject<{
50
66
  type: string;
51
67
  name: string;
52
68
  decimals: string | number | bigint;
53
- tokenAddress: `0x${string}`;
69
+ contractAddress: `0x${string}`;
54
70
  balance: string | number | bigint;
55
71
  tokenId?: string | number | bigint | undefined;
56
72
  }[];
@@ -1 +1 @@
1
- {"version":3,"file":"balanceClient.d.ts","sourceRoot":"","sources":["../../src/general/balanceClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAC;AAErC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIlC,CAAC;AAEH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,EAAE,CAAC,CA2BzC"}
1
+ {"version":3,"file":"balanceClient.d.ts","sourceRoot":"","sources":["../../src/general/balanceClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAC;AAErC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIlC,CAAC;AAEH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,EAAE,CAAC,CA2BzC"}
@@ -1,8 +1,8 @@
1
1
  import { TokenTypeEnum } from "@evergonlabs/tmi-protocol-types/evm";
2
2
  import { z } from "../../../common/zod.js";
3
- export declare const TokenBalance: z.ZodObject<{
3
+ export declare const TokenBalance: z.ZodEffects<z.ZodObject<{
4
4
  balance: z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodString>;
5
- tokenAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
5
+ contractAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
6
6
  decimals: z.ZodEffects<z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodNumber>, number, string | number | bigint>;
7
7
  tokenId: z.ZodOptional<z.ZodPipeline<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBigInt]>, z.ZodString>>;
8
8
  name: z.ZodString;
@@ -13,7 +13,7 @@ export declare const TokenBalance: z.ZodObject<{
13
13
  type: TokenTypeEnum | null;
14
14
  name: string;
15
15
  decimals: number;
16
- tokenAddress: `0x${string}`;
16
+ contractAddress: `0x${string}`;
17
17
  balance: string;
18
18
  tokenId?: string | undefined;
19
19
  }, {
@@ -21,7 +21,23 @@ export declare const TokenBalance: z.ZodObject<{
21
21
  type: string;
22
22
  name: string;
23
23
  decimals: string | number | bigint;
24
+ contractAddress: `0x${string}`;
25
+ balance: string | number | bigint;
26
+ tokenId?: string | number | bigint | undefined;
27
+ }>, {
24
28
  tokenAddress: `0x${string}`;
29
+ symbol: string;
30
+ type: TokenTypeEnum | null;
31
+ name: string;
32
+ decimals: number;
33
+ balance: string;
34
+ tokenId?: string | undefined;
35
+ }, {
36
+ symbol: string;
37
+ type: string;
38
+ name: string;
39
+ decimals: string | number | bigint;
40
+ contractAddress: `0x${string}`;
25
41
  balance: string | number | bigint;
26
42
  tokenId?: string | number | bigint | undefined;
27
43
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"tokenBalance.d.ts","sourceRoot":"","sources":["../../../../src/general/utils/tokenBalance/tokenBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAW3C,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;EASvB,CAAC"}
1
+ {"version":3,"file":"tokenBalance.d.ts","sourceRoot":"","sources":["../../../../src/general/utils/tokenBalance/tokenBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAW3C,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcpB,CAAC"}
@@ -8,13 +8,18 @@ const tokenTypeDict = {
8
8
  "ERC-20": TokenTypeEnum.ERC20,
9
9
  };
10
10
  // @see definitions here https://docs.blockscout.com/devs/apis/rpc/account#get-list-of-tokens-owned-by-address
11
- export const TokenBalance = z.object({
11
+ export const TokenBalance = z
12
+ .object({
12
13
  balance: NumberishSchema.pipe(z.string()),
13
- tokenAddress: AddressSchema,
14
+ contractAddress: AddressSchema,
14
15
  // ERC-721 and ERC-1155 has no decimals but for interoperability we return 1
15
16
  decimals: NumberishSchema.pipe(z.coerce.number()).transform((x) => x || 1),
16
17
  tokenId: z.optional(NumberishSchema.pipe(z.string())),
17
18
  name: z.string(),
18
19
  symbol: z.string(),
19
20
  type: z.string().transform((x) => (x in tokenTypeDict ? tokenTypeDict[x] : null)),
20
- });
21
+ })
22
+ .transform(({ contractAddress, ...rest }) => ({
23
+ ...rest,
24
+ tokenAddress: contractAddress,
25
+ }));
@@ -85,4 +85,67 @@ export declare function createErc1967Proxy<E extends Env>(factory: Factory<E>):
85
85
  args: any[];
86
86
  bytecode: `0x${string}`;
87
87
  }, import("hono/utils/http-status").ContentfulStatusCode, "json">>>];
88
+ export declare const DeployTransparentProxySchema: z.ZodObject<{
89
+ implementation: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
90
+ proxyAdmin: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
91
+ data: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ implementation: `0x${string}`;
94
+ proxyAdmin: `0x${string}`;
95
+ data?: `0x${string}` | undefined;
96
+ }, {
97
+ implementation: `0x${string}`;
98
+ proxyAdmin: `0x${string}`;
99
+ data?: `0x${string}` | undefined;
100
+ }>;
101
+ export declare function createTransparentProxy<E extends Env>(factory: Factory<E>): [import("hono/types").H<any, string, {}, Promise<Response & import("hono").TypedResponse<{
102
+ abi: any[];
103
+ args: any[];
104
+ bytecode: `0x${string}`;
105
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>>, import("hono/types").H<Env, string, {
106
+ in: {
107
+ json: {
108
+ implementation: `0x${string}`;
109
+ proxyAdmin: `0x${string}`;
110
+ data?: `0x${string}` | undefined;
111
+ };
112
+ };
113
+ out: {
114
+ json: {
115
+ implementation: `0x${string}`;
116
+ proxyAdmin: `0x${string}`;
117
+ data?: `0x${string}` | undefined;
118
+ };
119
+ };
120
+ }, Promise<Response & import("hono").TypedResponse<{
121
+ abi: any[];
122
+ args: any[];
123
+ bytecode: `0x${string}`;
124
+ }, 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, {
125
+ in: {
126
+ json: {
127
+ implementation: `0x${string}`;
128
+ proxyAdmin: `0x${string}`;
129
+ data?: `0x${string}` | undefined;
130
+ };
131
+ };
132
+ out: {
133
+ json: {
134
+ implementation: `0x${string}`;
135
+ proxyAdmin: `0x${string}`;
136
+ data?: `0x${string}` | undefined;
137
+ };
138
+ };
139
+ }, Promise<Response & import("hono").TypedResponse<{
140
+ abi: any[];
141
+ args: any[];
142
+ bytecode: `0x${string}`;
143
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>>];
144
+ export declare function createProxyAdmin<E extends Env>(factory: Factory<E>): [import("hono/types").H<any, string, {}, Promise<Response & import("hono").TypedResponse<{
145
+ abi: any[];
146
+ bytecode: `0x${string}`;
147
+ }, 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, {}, Promise<Response & import("hono").TypedResponse<{
148
+ abi: any[];
149
+ bytecode: `0x${string}`;
150
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>>];
88
151
  //# sourceMappingURL=deploy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/issuance/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA+BvC,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;qEAOlE;AAgCD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;EAOnC,CAAC;AAEH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEAiBpE"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/issuance/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AA+BvC,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;qEAOlE;AAiCD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;EAOnC,CAAC;AAEH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEAiBpE;AAgCD,eAAO,MAAM,4BAA4B;;;;;;;;;;;;EAIvC,CAAC;AAEH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEAcxE;AA4BD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;qEAOlE"}
@@ -1,6 +1,8 @@
1
1
  import { z } from "zod";
2
2
  import { describeRoute } from "hono-openapi";
3
3
  import { erc1967ProxyAbi, erc1967ProxyBytecode } from "@evergonlabs/tmi-evm-contracts/erc1967";
4
+ import { transparentUpgradeableProxyAbi, transparentUpgradeableProxyBytecode, } from "@evergonlabs/tmi-evm-contracts/transparentUpgradeableProxy";
5
+ import { proxyAdminAbi, proxyAdminBytecode } from "@evergonlabs/tmi-evm-contracts/proxyAdmin";
4
6
  import { resolver, validator } from "hono-openapi/zod";
5
7
  import { AddressSchema, HexStringSchema } from "../common/index.js";
6
8
  import { encodeFunctionData } from "viem";
@@ -54,6 +56,7 @@ const deployProxyRoute = describeRoute({
54
56
  summary: "Get ERC1967Proxy",
55
57
  description: "Returns transaction data for deploying a ERC1967Proxy",
56
58
  tags: ["Issuance"],
59
+ deprecated: true,
57
60
  responses: {
58
61
  200: {
59
62
  description: "Returns transaction data for deploying a ERC1967Proxy",
@@ -89,3 +92,78 @@ export function createErc1967Proxy(factory) {
89
92
  });
90
93
  });
91
94
  }
95
+ const IssuanceDeployTransparentProxySchema = z
96
+ .object({
97
+ bytecode: HexStringSchema.openapi({ description: "Bytecode of the smartcontract" }),
98
+ abi: z.array(z.any()).openapi({
99
+ description: "ABI of a contract.",
100
+ type: "array",
101
+ }),
102
+ args: z.array(z.any()).openapi({
103
+ description: "Arguments for the transparent proxy initialization",
104
+ type: "array",
105
+ }),
106
+ })
107
+ .openapi({ ref: "IssuanceDeployTransparentProxySchema" });
108
+ const deployTransparentProxyRoute = describeRoute({
109
+ summary: "Deploy TransparentUpgradeableProxy",
110
+ description: "Returns transaction data for deploying a TransparentUpgradeableProxy",
111
+ tags: ["Issuance"],
112
+ responses: {
113
+ 200: {
114
+ description: "Returns transaction data for deploying a TransparentUpgradeableProxy",
115
+ content: {
116
+ "application/json": {
117
+ schema: resolver(IssuanceDeployTransparentProxySchema),
118
+ },
119
+ },
120
+ },
121
+ },
122
+ });
123
+ export const DeployTransparentProxySchema = z.object({
124
+ implementation: AddressSchema.openapi("The address of the implementation contract"),
125
+ proxyAdmin: AddressSchema.openapi("The address of the proxy admin"),
126
+ data: HexStringSchema.openapi("The encoded initialization data for the implementation").optional(),
127
+ });
128
+ export function createTransparentProxy(factory) {
129
+ return factory.createHandlers(deployTransparentProxyRoute, validator("json", DeployTransparentProxySchema), async (c) => {
130
+ const { implementation, proxyAdmin: admin, data } = c.req.valid("json");
131
+ return c.json({
132
+ bytecode: transparentUpgradeableProxyBytecode,
133
+ abi: transparentUpgradeableProxyAbi,
134
+ args: [implementation, admin, data || "0x"],
135
+ });
136
+ });
137
+ }
138
+ const IssuanceDeployProxyAdminSchema = z
139
+ .object({
140
+ bytecode: HexStringSchema.openapi({ description: "Bytecode of the smartcontract" }),
141
+ abi: z.array(z.any()).openapi({
142
+ description: "ABI of a contract.",
143
+ type: "array",
144
+ }),
145
+ })
146
+ .openapi({ ref: "IssuanceDeployProxyAdminSchema" });
147
+ const deployProxyAdminRoute = describeRoute({
148
+ summary: "Deploy ProxyAdmin",
149
+ description: "Returns transaction data for deploying a ProxyAdmin contract",
150
+ tags: ["Issuance"],
151
+ responses: {
152
+ 200: {
153
+ description: "Returns transaction data for deploying a ProxyAdmin contract",
154
+ content: {
155
+ "application/json": {
156
+ schema: resolver(IssuanceDeployProxyAdminSchema),
157
+ },
158
+ },
159
+ },
160
+ },
161
+ });
162
+ export function createProxyAdmin(factory) {
163
+ return factory.createHandlers(deployProxyAdminRoute, async (c) => {
164
+ return c.json({
165
+ bytecode: proxyAdminBytecode,
166
+ abi: proxyAdminAbi,
167
+ });
168
+ });
169
+ }
@@ -180,6 +180,62 @@ export declare const issuanceApis: {
180
180
  status: import("hono/utils/http-status").ContentfulStatusCode;
181
181
  };
182
182
  };
183
+ } & {
184
+ "/proxy/deployTransparentProxy": {
185
+ $post: {
186
+ input: {
187
+ json: {
188
+ implementation: `0x${string}`;
189
+ proxyAdmin: `0x${string}`;
190
+ data?: `0x${string}` | undefined;
191
+ };
192
+ };
193
+ output: {
194
+ abi: any[];
195
+ args: any[];
196
+ bytecode: `0x${string}`;
197
+ };
198
+ outputFormat: "json";
199
+ status: import("hono/utils/http-status").ContentfulStatusCode;
200
+ };
201
+ };
202
+ } & {
203
+ "/proxy/deployProxyAdmin": {
204
+ $get: {
205
+ input: {};
206
+ output: {
207
+ abi: any[];
208
+ bytecode: `0x${string}`;
209
+ };
210
+ outputFormat: "json";
211
+ status: import("hono/utils/http-status").ContentfulStatusCode;
212
+ };
213
+ };
214
+ } & {
215
+ "/proxy/upgradeTransparentProxy": {
216
+ $post: {
217
+ input: {
218
+ json: {
219
+ newImplementation: `0x${string}`;
220
+ proxyAdminAddress: `0x${string}`;
221
+ proxyAddress: `0x${string}`;
222
+ data?: `0x${string}` | undefined;
223
+ };
224
+ };
225
+ output: {
226
+ data: `0x${string}`;
227
+ to: `0x${string}`;
228
+ details: {
229
+ functionName: string;
230
+ address: `0x${string}`;
231
+ abi: any[];
232
+ args: any[];
233
+ };
234
+ };
235
+ outputFormat: "json";
236
+ status: import("hono/utils/http-status").ContentfulStatusCode;
237
+ };
238
+ };
183
239
  }, "/issuance">, "/">;
184
240
  config: {
185
241
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/issuance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAUvC,eAAO,MAAM,YAAY;;gBAEX,CAAC,SAAS,GAAG,WAAW,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkB/C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/issuance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAWvC,eAAO,MAAM,YAAY;;gBAEX,CAAC,SAAS,GAAG,WAAW,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqB/C,CAAC"}
@@ -1,11 +1,12 @@
1
1
  import { createApiConfig } from "../common/app.js";
2
2
  import { approveErc20Token } from "./approve.js";
3
3
  import { burnErc20Token } from "./burn.js";
4
- import { createErc1967Proxy, createErc20Token } from "./deploy.js";
4
+ import { createErc1967Proxy, createErc20Token, createTransparentProxy, createProxyAdmin } from "./deploy.js";
5
5
  import { mintErc20Token } from "./mint.js";
6
6
  import { transferErc20Token } from "./transfer.js";
7
7
  import { createGrantRole } from "./grantRole.js";
8
8
  import { createRenounceRole } from "./renounceRole.js";
9
+ import { upgradeTransparentProxy } from "./upgrade.js";
9
10
  export const issuanceApis = {
10
11
  name: "Issuance APIs",
11
12
  createApp: (factory) => factory.createApp().route("/issuance", factory
@@ -17,7 +18,10 @@ export const issuanceApis = {
17
18
  .post("/erc20/transfer", ...transferErc20Token(factory))
18
19
  .post("/erc20/proxy", ...createErc1967Proxy(factory))
19
20
  .post("/erc20/grantRole", ...createGrantRole(factory))
20
- .post("/erc20/renounceRole", ...createRenounceRole(factory))),
21
+ .post("/erc20/renounceRole", ...createRenounceRole(factory))
22
+ .post("/proxy/deployTransparentProxy", ...createTransparentProxy(factory))
23
+ .get("/proxy/deployProxyAdmin", ...createProxyAdmin(factory))
24
+ .post("/proxy/upgradeTransparentProxy", ...upgradeTransparentProxy(factory))),
21
25
  config: createApiConfig({
22
26
  title: "Issuance API",
23
27
  description: "APIs for issuing tokens",
@@ -0,0 +1,82 @@
1
+ import { z } from "zod";
2
+ import { Env } from "hono";
3
+ import { Factory } from "hono/factory";
4
+ export declare const UpgradeProxyRequestSchema: z.ZodObject<{
5
+ proxyAdminAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
6
+ proxyAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
7
+ newImplementation: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
8
+ data: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ newImplementation: `0x${string}`;
11
+ proxyAdminAddress: `0x${string}`;
12
+ proxyAddress: `0x${string}`;
13
+ data?: `0x${string}` | undefined;
14
+ }, {
15
+ newImplementation: `0x${string}`;
16
+ proxyAdminAddress: `0x${string}`;
17
+ proxyAddress: `0x${string}`;
18
+ data?: `0x${string}` | undefined;
19
+ }>;
20
+ export declare function upgradeTransparentProxy<E extends Env>(factory: Factory<E>): [import("hono/types").H<any, string, {}, Promise<Response & import("hono").TypedResponse<{
21
+ data: `0x${string}`;
22
+ to: `0x${string}`;
23
+ details: {
24
+ functionName: string;
25
+ address: `0x${string}`;
26
+ abi: any[];
27
+ args: any[];
28
+ };
29
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>>, import("hono/types").H<Env, string, {
30
+ in: {
31
+ json: {
32
+ newImplementation: `0x${string}`;
33
+ proxyAdminAddress: `0x${string}`;
34
+ proxyAddress: `0x${string}`;
35
+ data?: `0x${string}` | undefined;
36
+ };
37
+ };
38
+ out: {
39
+ json: {
40
+ newImplementation: `0x${string}`;
41
+ proxyAdminAddress: `0x${string}`;
42
+ proxyAddress: `0x${string}`;
43
+ data?: `0x${string}` | undefined;
44
+ };
45
+ };
46
+ }, Promise<Response & import("hono").TypedResponse<{
47
+ data: `0x${string}`;
48
+ to: `0x${string}`;
49
+ details: {
50
+ functionName: string;
51
+ address: `0x${string}`;
52
+ abi: any[];
53
+ args: any[];
54
+ };
55
+ }, 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, {
56
+ in: {
57
+ json: {
58
+ newImplementation: `0x${string}`;
59
+ proxyAdminAddress: `0x${string}`;
60
+ proxyAddress: `0x${string}`;
61
+ data?: `0x${string}` | undefined;
62
+ };
63
+ };
64
+ out: {
65
+ json: {
66
+ newImplementation: `0x${string}`;
67
+ proxyAdminAddress: `0x${string}`;
68
+ proxyAddress: `0x${string}`;
69
+ data?: `0x${string}` | undefined;
70
+ };
71
+ };
72
+ }, Promise<Response & import("hono").TypedResponse<{
73
+ data: `0x${string}`;
74
+ to: `0x${string}`;
75
+ details: {
76
+ functionName: string;
77
+ address: `0x${string}`;
78
+ abi: any[];
79
+ args: any[];
80
+ };
81
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>>];
82
+ //# sourceMappingURL=upgrade.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/issuance/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAMvC,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;EAapC,CAAC;AAmBH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEAazE"}
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ import { describeRoute } from "hono-openapi";
3
+ import { resolver, validator } from "hono-openapi/zod";
4
+ import { AddressSchema, toTransaction, TransactionSchema } from "../common/index.js";
5
+ import { proxyAdminAbi } from "@evergonlabs/tmi-evm-contracts/proxyAdmin";
6
+ import { HexStringSchema } from "@evergonlabs/tmi-utils/models";
7
+ export const UpgradeProxyRequestSchema = z.object({
8
+ proxyAdminAddress: AddressSchema.openapi({
9
+ description: "The address of the ProxyAdmin contract that manages the proxy",
10
+ }),
11
+ proxyAddress: AddressSchema.openapi({
12
+ description: "The address of the transparent proxy contract to upgrade",
13
+ }),
14
+ newImplementation: AddressSchema.openapi({
15
+ description: "The address of the new implementation contract",
16
+ }),
17
+ data: HexStringSchema.optional().openapi({
18
+ description: "Initialization data",
19
+ }),
20
+ });
21
+ const upgradeRoute = describeRoute({
22
+ summary: "Upgrade Transparent Proxy Implementation",
23
+ description: "Returns transaction data for upgrading the implementation of a transparent proxy contract using ProxyAdmin",
24
+ tags: ["Issuance"],
25
+ responses: {
26
+ 200: {
27
+ description: "Returns transaction data for upgrading transparent proxy implementation via ProxyAdmin",
28
+ content: {
29
+ "application/json": {
30
+ schema: resolver(TransactionSchema),
31
+ },
32
+ },
33
+ },
34
+ },
35
+ });
36
+ export function upgradeTransparentProxy(factory) {
37
+ return factory.createHandlers(upgradeRoute, validator("json", UpgradeProxyRequestSchema), async (c) => {
38
+ const { proxyAdminAddress, proxyAddress, newImplementation, data } = c.req.valid("json");
39
+ return c.json(toTransaction({
40
+ address: proxyAdminAddress,
41
+ abi: proxyAdminAbi,
42
+ functionName: "upgradeAndCall",
43
+ args: [proxyAddress, newImplementation, data || "0x"],
44
+ }));
45
+ });
46
+ }
@@ -0,0 +1,57 @@
1
+ import { Env } from "hono";
2
+ import { Factory } from "hono/factory";
3
+ export declare function createBuyBackAfterLiquidationTransactionV0<E extends Env>(factory: Factory<E>): [import("hono/types").H<any, string, {}, Promise<Response & import("hono").TypedResponse<{
4
+ data: `0x${string}`;
5
+ to: `0x${string}`;
6
+ details: {
7
+ functionName: string;
8
+ address: `0x${string}`;
9
+ abi: any[];
10
+ args: any[];
11
+ };
12
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>>, import("hono/types").H<Env, string, {
13
+ in: {
14
+ json: {
15
+ chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
16
+ campaignId: bigint;
17
+ };
18
+ };
19
+ out: {
20
+ json: {
21
+ chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
22
+ campaignId: bigint;
23
+ };
24
+ };
25
+ }, Promise<Response & import("hono").TypedResponse<{
26
+ data: `0x${string}`;
27
+ to: `0x${string}`;
28
+ details: {
29
+ functionName: string;
30
+ address: `0x${string}`;
31
+ abi: any[];
32
+ args: any[];
33
+ };
34
+ }, 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, {
35
+ in: {
36
+ json: {
37
+ chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
38
+ campaignId: bigint;
39
+ };
40
+ };
41
+ out: {
42
+ json: {
43
+ chainId: import("@evergonlabs/tmi-protocol-fractions-sdk").TmiChainId;
44
+ campaignId: bigint;
45
+ };
46
+ };
47
+ }, Promise<Response & import("hono").TypedResponse<{
48
+ data: `0x${string}`;
49
+ to: `0x${string}`;
50
+ details: {
51
+ functionName: string;
52
+ address: `0x${string}`;
53
+ abi: any[];
54
+ args: any[];
55
+ };
56
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">>>];
57
+ //# sourceMappingURL=buyBackAfterLiquidation.routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buyBackAfterLiquidation.routes.d.ts","sourceRoot":"","sources":["../../../../src/lending/buyBackAfterLiquidation/v0/buyBackAfterLiquidation.routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAqBvC,wBAAgB,0CAA0C,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEAe5F"}