@evergonlabs/tmi-protocol-api 0.10.0-rc.0 → 0.10.0-rc.2

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 (189) hide show
  1. package/dist/app.d.ts +430 -72
  2. package/dist/app.d.ts.map +1 -1
  3. package/dist/client.d.ts +465 -77
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/common/roles/erc1155-token-roles.d.ts +8 -0
  6. package/dist/common/roles/erc1155-token-roles.d.ts.map +1 -0
  7. package/dist/common/roles/erc1155-token-roles.js +13 -0
  8. package/dist/common/roles/exports.d.ts +1 -0
  9. package/dist/common/roles/exports.d.ts.map +1 -1
  10. package/dist/common/roles/exports.js +1 -0
  11. package/dist/fractions/index.d.ts +71 -71
  12. package/dist/fractions/index.d.ts.map +1 -1
  13. package/dist/fractions/index.js +0 -2
  14. package/dist/fractions/platforms/deployMarket.routes.js +4 -4
  15. package/dist/fractions/platforms/initCompilot.routes.js +1 -1
  16. package/dist/fractions/platforms/initNid.route.js +1 -1
  17. package/dist/fractions/sales/approveSale.route.js +1 -1
  18. package/dist/fractions/sales/approveWrapper.route.d.ts +88 -0
  19. package/dist/fractions/sales/approveWrapper.route.d.ts.map +1 -0
  20. package/dist/fractions/sales/approveWrapper.route.js +92 -0
  21. package/dist/fractions/sales/completeSale.route.js +1 -1
  22. package/dist/fractions/sales/createFractions.route.js +1 -1
  23. package/dist/fractions/sales/getFractionSaleStatistics.route.js +1 -1
  24. package/dist/fractions/sales/getVaultAddress.js +1 -1
  25. package/dist/fractions/sales/getWithdrawEvent.js +1 -1
  26. package/dist/fractions/sales/index.d.ts +71 -1
  27. package/dist/fractions/sales/index.d.ts.map +1 -1
  28. package/dist/fractions/sales/index.js +5 -1
  29. package/dist/fractions/sales/parseFractionsCreatedEvent.js +1 -1
  30. package/dist/fractions/sales/purchase.route.js +1 -1
  31. package/dist/fractions/sales/purchaseStatistics.route.js +1 -1
  32. package/dist/fractions/sales/receiveFundsAfterNonFunded.route.js +2 -2
  33. package/dist/fractions/sales/receiveNonPurchasedWrappedAssets.route.js +1 -1
  34. package/dist/fractions/sales/recoverFractions.js +1 -1
  35. package/dist/fractions/sales/rejectFractions.js +1 -1
  36. package/dist/fractions/sales/searchActivity.route.js +1 -1
  37. package/dist/fractions/sales/searchSales/searchSales.js +1 -1
  38. package/dist/fractions/sales/searchWithdrawal.route.js +1 -1
  39. package/dist/fractions/sales/setFeeCapLimit.js +1 -1
  40. package/dist/fractions/sales/unlockWrappedAssets.route.js +1 -1
  41. package/dist/fractions/sales/vesting/claimStatistics.route.js +1 -1
  42. package/dist/fractions/sales/vesting/claimVestedTokens.route.js +1 -1
  43. package/dist/fractions/sales/vesting/editCliff.route.js +1 -1
  44. package/dist/fractions/sales/vesting/parseClaimVestedTokensEvent.js +1 -1
  45. package/dist/fractions/sales/withdraw.route.js +1 -1
  46. package/dist/fractions/statistics/networkStatistics.route.js +4 -4
  47. package/dist/issuance/common/factories.base.d.ts +12 -12
  48. package/dist/issuance/erc1155/burn.d.ts +34 -0
  49. package/dist/issuance/erc1155/burn.d.ts.map +1 -0
  50. package/dist/issuance/erc1155/burn.js +40 -0
  51. package/dist/issuance/erc1155/default/deploy.d.ts +34 -0
  52. package/dist/issuance/erc1155/default/deploy.d.ts.map +1 -0
  53. package/dist/issuance/erc1155/default/deploy.js +54 -0
  54. package/dist/issuance/erc1155/default/initialize.d.ts +34 -0
  55. package/dist/issuance/erc1155/default/initialize.d.ts.map +1 -0
  56. package/dist/issuance/erc1155/default/initialize.js +39 -0
  57. package/dist/issuance/erc1155/default/parseDeployEvent.d.ts +21 -0
  58. package/dist/issuance/erc1155/default/parseDeployEvent.d.ts.map +1 -0
  59. package/dist/issuance/erc1155/default/parseDeployEvent.js +75 -0
  60. package/dist/issuance/erc1155/gated/deploy.d.ts +36 -0
  61. package/dist/issuance/erc1155/gated/deploy.d.ts.map +1 -0
  62. package/dist/issuance/erc1155/gated/deploy.js +62 -0
  63. package/dist/issuance/erc1155/gated/initialize.d.ts +36 -0
  64. package/dist/issuance/erc1155/gated/initialize.d.ts.map +1 -0
  65. package/dist/issuance/erc1155/gated/initialize.js +45 -0
  66. package/dist/issuance/erc1155/gated/parseDeployEvent.d.ts +21 -0
  67. package/dist/issuance/erc1155/gated/parseDeployEvent.d.ts.map +1 -0
  68. package/dist/issuance/erc1155/gated/parseDeployEvent.js +75 -0
  69. package/dist/issuance/erc1155/grantRole.d.ts +33 -0
  70. package/dist/issuance/erc1155/grantRole.d.ts.map +1 -0
  71. package/dist/issuance/erc1155/grantRole.js +42 -0
  72. package/dist/issuance/erc1155/index.d.ts +361 -0
  73. package/dist/issuance/erc1155/index.d.ts.map +1 -0
  74. package/dist/issuance/erc1155/index.js +38 -0
  75. package/dist/issuance/erc1155/mint.d.ts +34 -0
  76. package/dist/issuance/erc1155/mint.d.ts.map +1 -0
  77. package/dist/issuance/erc1155/mint.js +40 -0
  78. package/dist/issuance/erc1155/recover.d.ts +36 -0
  79. package/dist/issuance/erc1155/recover.d.ts.map +1 -0
  80. package/dist/issuance/erc1155/recover.js +41 -0
  81. package/dist/issuance/erc1155/renounceRole.d.ts +33 -0
  82. package/dist/issuance/erc1155/renounceRole.d.ts.map +1 -0
  83. package/dist/issuance/erc1155/renounceRole.js +42 -0
  84. package/dist/issuance/erc1155/revokeRole.d.ts +33 -0
  85. package/dist/issuance/erc1155/revokeRole.d.ts.map +1 -0
  86. package/dist/issuance/erc1155/revokeRole.js +42 -0
  87. package/dist/issuance/erc1155/setApprovalForAll.d.ts +32 -0
  88. package/dist/issuance/erc1155/setApprovalForAll.d.ts.map +1 -0
  89. package/dist/issuance/erc1155/setApprovalForAll.js +40 -0
  90. package/dist/issuance/erc1155/setBaseURI.d.ts +30 -0
  91. package/dist/issuance/erc1155/setBaseURI.d.ts.map +1 -0
  92. package/dist/issuance/erc1155/setBaseURI.js +37 -0
  93. package/dist/issuance/erc1155/setTokenURI.d.ts +32 -0
  94. package/dist/issuance/erc1155/setTokenURI.d.ts.map +1 -0
  95. package/dist/issuance/erc1155/setTokenURI.js +39 -0
  96. package/dist/issuance/erc1155/tag.d.ts +4 -0
  97. package/dist/issuance/erc1155/tag.d.ts.map +1 -0
  98. package/dist/issuance/erc1155/tag.js +2 -0
  99. package/dist/issuance/erc20/approve.d.ts.map +1 -1
  100. package/dist/issuance/erc20/approve.js +2 -1
  101. package/dist/issuance/erc20/burn.d.ts.map +1 -1
  102. package/dist/issuance/erc20/burn.js +2 -1
  103. package/dist/issuance/erc20/default/deploy.d.ts.map +1 -1
  104. package/dist/issuance/erc20/default/deploy.js +2 -1
  105. package/dist/issuance/erc20/default/initialize.d.ts.map +1 -1
  106. package/dist/issuance/erc20/default/initialize.js +2 -1
  107. package/dist/issuance/erc20/default/parseDeployEvent.d.ts.map +1 -1
  108. package/dist/issuance/erc20/default/parseDeployEvent.js +2 -1
  109. package/dist/issuance/erc20/gated/deploy.d.ts.map +1 -1
  110. package/dist/issuance/erc20/gated/deploy.js +2 -1
  111. package/dist/issuance/erc20/gated/initialize.d.ts.map +1 -1
  112. package/dist/issuance/erc20/gated/initialize.js +2 -1
  113. package/dist/issuance/erc20/gated/parseDeployEvent.d.ts.map +1 -1
  114. package/dist/issuance/erc20/gated/parseDeployEvent.js +2 -1
  115. package/dist/issuance/erc20/gatedSimple/deploy.d.ts.map +1 -1
  116. package/dist/issuance/erc20/gatedSimple/deploy.js +2 -1
  117. package/dist/issuance/erc20/gatedSimple/getInitData.d.ts.map +1 -1
  118. package/dist/issuance/erc20/gatedSimple/getInitData.js +2 -1
  119. package/dist/issuance/erc20/gatedSimple/parseDeployEvent.d.ts.map +1 -1
  120. package/dist/issuance/erc20/gatedSimple/parseDeployEvent.js +2 -1
  121. package/dist/issuance/erc20/grantRole.d.ts.map +1 -1
  122. package/dist/issuance/erc20/grantRole.js +2 -1
  123. package/dist/issuance/erc20/mint.d.ts.map +1 -1
  124. package/dist/issuance/erc20/mint.js +2 -1
  125. package/dist/issuance/erc20/recover.d.ts.map +1 -1
  126. package/dist/issuance/erc20/recover.js +2 -1
  127. package/dist/issuance/erc20/renounceRole.d.ts.map +1 -1
  128. package/dist/issuance/erc20/renounceRole.js +2 -1
  129. package/dist/issuance/erc20/revokeRole.d.ts.map +1 -1
  130. package/dist/issuance/erc20/revokeRole.js +2 -1
  131. package/dist/issuance/erc20/tag.d.ts +4 -0
  132. package/dist/issuance/erc20/tag.d.ts.map +1 -0
  133. package/dist/issuance/erc20/tag.js +2 -0
  134. package/dist/issuance/erc20/transfer.d.ts.map +1 -1
  135. package/dist/issuance/erc20/transfer.js +2 -1
  136. package/dist/issuance/erc20/transferFrom.d.ts.map +1 -1
  137. package/dist/issuance/erc20/transferFrom.js +2 -1
  138. package/dist/issuance/erc721/approve.d.ts.map +1 -1
  139. package/dist/issuance/erc721/approve.js +3 -2
  140. package/dist/issuance/erc721/burn.d.ts.map +1 -1
  141. package/dist/issuance/erc721/burn.js +3 -2
  142. package/dist/issuance/erc721/default/deploy.d.ts.map +1 -1
  143. package/dist/issuance/erc721/default/deploy.js +6 -5
  144. package/dist/issuance/erc721/default/initialize.d.ts.map +1 -1
  145. package/dist/issuance/erc721/default/initialize.js +3 -2
  146. package/dist/issuance/erc721/default/parseDeployEvent.d.ts.map +1 -1
  147. package/dist/issuance/erc721/default/parseDeployEvent.js +3 -2
  148. package/dist/issuance/erc721/gated/deploy.d.ts.map +1 -1
  149. package/dist/issuance/erc721/gated/deploy.js +6 -5
  150. package/dist/issuance/erc721/gated/initialize.d.ts.map +1 -1
  151. package/dist/issuance/erc721/gated/initialize.js +3 -2
  152. package/dist/issuance/erc721/gated/parseDeployEvent.d.ts.map +1 -1
  153. package/dist/issuance/erc721/gated/parseDeployEvent.js +3 -2
  154. package/dist/issuance/erc721/grantRole.d.ts.map +1 -1
  155. package/dist/issuance/erc721/grantRole.js +3 -2
  156. package/dist/issuance/erc721/index.d.ts +0 -1
  157. package/dist/issuance/erc721/index.d.ts.map +1 -1
  158. package/dist/issuance/erc721/mint.d.ts +0 -2
  159. package/dist/issuance/erc721/mint.d.ts.map +1 -1
  160. package/dist/issuance/erc721/mint.js +6 -7
  161. package/dist/issuance/erc721/nextTokenId.d.ts +19 -0
  162. package/dist/issuance/erc721/nextTokenId.d.ts.map +1 -0
  163. package/dist/issuance/erc721/nextTokenId.js +79 -0
  164. package/dist/issuance/erc721/recover.d.ts.map +1 -1
  165. package/dist/issuance/erc721/recover.js +3 -2
  166. package/dist/issuance/erc721/renounceRole.d.ts.map +1 -1
  167. package/dist/issuance/erc721/renounceRole.js +3 -2
  168. package/dist/issuance/erc721/revokeRole.d.ts.map +1 -1
  169. package/dist/issuance/erc721/revokeRole.js +3 -2
  170. package/dist/issuance/erc721/setBaseURI.d.ts.map +1 -1
  171. package/dist/issuance/erc721/setBaseURI.js +3 -2
  172. package/dist/issuance/erc721/setTokenURI.d.ts.map +1 -1
  173. package/dist/issuance/erc721/setTokenURI.js +3 -2
  174. package/dist/issuance/erc721/tag.d.ts +4 -0
  175. package/dist/issuance/erc721/tag.d.ts.map +1 -0
  176. package/dist/issuance/erc721/tag.js +2 -0
  177. package/dist/issuance/erc721/transferFrom.d.ts.map +1 -1
  178. package/dist/issuance/erc721/transferFrom.js +3 -2
  179. package/dist/issuance/index.d.ts +359 -1
  180. package/dist/issuance/index.d.ts.map +1 -1
  181. package/dist/issuance/index.js +2 -0
  182. package/dist/issuance/proxy/deploy.d.ts.map +1 -1
  183. package/dist/issuance/proxy/deploy.js +3 -2
  184. package/dist/issuance/proxy/tag.d.ts +4 -0
  185. package/dist/issuance/proxy/tag.d.ts.map +1 -0
  186. package/dist/issuance/proxy/tag.js +2 -0
  187. package/dist/issuance/proxy/upgrade.d.ts.map +1 -1
  188. package/dist/issuance/proxy/upgrade.js +2 -1
  189. package/package.json +16 -14
@@ -0,0 +1,62 @@
1
+ import { describeRoute } from "hono-openapi";
2
+ import { resolver, validator } from "hono-openapi";
3
+ import { z } from "zod";
4
+ import { abis } from "@evergonlabs/tmi-factories-sdk";
5
+ import { createController } from "../../../common/controller.js";
6
+ import { AddressSchema, toTransaction, TransactionSchema } from "../../../common/index.js";
7
+ import { DEFAULT_COMPILOT_SIGNER } from "../../../common/models/compilot.js";
8
+ import { FactoryChainId, getFactories } from "../../common/factories.js";
9
+ import { erc1155Tag } from "../tag.js";
10
+ export const DeployGatedErc1155RequestSchema = z.object({
11
+ chainId: FactoryChainId.Schema,
12
+ baseURI: z.string().openapi({ description: "Base URI for token metadata" }),
13
+ defaultTokenAdmin: AddressSchema.openapi({ description: "Address to receive DEFAULT_ADMIN_ROLE" }),
14
+ minter: AddressSchema.openapi({ description: "Address to receive MINTER_ROLE" }),
15
+ gatingSigner: AddressSchema.optional().openapi({
16
+ description: "Address of the gating signer for whitelist verification. Defaults to the ComPilot signer.",
17
+ }),
18
+ });
19
+ const deployGatedErc1155Route = describeRoute({
20
+ summary: "Deploy Gated ERC1155 via Factory",
21
+ description: `This contract has not been audited.
22
+
23
+ Returns transaction data for deploying a new gated ERC1155 token via the factory contract.
24
+
25
+ Gated tokens require cryptographic signatures for transfers, mints, and burns.
26
+
27
+ Calls deployAndInitializeProxy on the ERC1155AutoIdGatedPausableRecoverableFactory to atomic deploy and initialize a new token proxy.
28
+
29
+ The deployed token supports:
30
+ - mint(to, amount, data) - Mint tokens with auto-generated ID (MINTER_ROLE gated + signature required)
31
+ - mintBatch(to, amounts, data) - Mint multiple tokens with auto-generated IDs (MINTER_ROLE gated + signature required)
32
+ - burn(account, id, amount) - Burn tokens (signature required)
33
+ - burnBatch(account, ids, amounts) - Burn multiple tokens (signature required)
34
+ - setURI(newuri) - Set metadata URI (DEFAULT_ADMIN_ROLE gated)
35
+ - pause() / unpause() - Pause/unpause transfers (PAUSER_ROLE gated)
36
+ - recover(token, to, amount) - Recover tokens (RECOVER_ROLE gated)`,
37
+ tags: [erc1155Tag.tag],
38
+ responses: {
39
+ 200: {
40
+ description: "Returns transaction data for deploying a gated ERC1155 token via factory",
41
+ content: {
42
+ "application/json": {
43
+ schema: resolver(TransactionSchema),
44
+ },
45
+ },
46
+ },
47
+ },
48
+ });
49
+ export const CreateGatedErc1155Token = createController({
50
+ build: (factory) => factory
51
+ .createApp()
52
+ .post("/", deployGatedErc1155Route, validator("json", DeployGatedErc1155RequestSchema), async (c) => {
53
+ const { chainId, baseURI, defaultTokenAdmin, minter, gatingSigner } = c.req.valid("json");
54
+ const factory = getFactories(chainId);
55
+ return c.json(toTransaction({
56
+ address: factory.ERC1155AutoIdGatedPausableRecoverableFactory,
57
+ abi: abis.erc1155AutoIdGatedPausableRecoverableFactoryAbi,
58
+ functionName: "deployAndInitializeProxy",
59
+ args: [baseURI, defaultTokenAdmin, minter, gatingSigner ?? DEFAULT_COMPILOT_SIGNER],
60
+ }));
61
+ }),
62
+ });
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ export declare const InitializeGatedErc1155RequestSchema: z.ZodObject<{
3
+ tokenAddress: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
4
+ baseURI: z.ZodString;
5
+ defaultAdmin: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
6
+ minter: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
7
+ gatingSigner: z.ZodOptional<z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>>;
8
+ }, z.core.$strip>;
9
+ export declare const InitializeGatedErc1155: import("../../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../../common/context.js").AppContext, {
10
+ "/": {
11
+ $post: {
12
+ input: {
13
+ json: {
14
+ tokenAddress: string;
15
+ baseURI: string;
16
+ defaultAdmin: string;
17
+ minter: string;
18
+ gatingSigner?: string | undefined;
19
+ };
20
+ };
21
+ output: {
22
+ data: `0x${string}`;
23
+ to: `0x${string}`;
24
+ details: {
25
+ functionName: string;
26
+ address: `0x${string}`;
27
+ abi: any[];
28
+ args: any[];
29
+ };
30
+ };
31
+ outputFormat: "json";
32
+ status: import("hono/utils/http-status").ContentfulStatusCode;
33
+ };
34
+ };
35
+ }, "/", "/">>;
36
+ //# sourceMappingURL=initialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../../../src/issuance/erc1155/gated/initialize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,mCAAmC;;;;;;iBAQ9C,CAAC;AAkBH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;aAgBjC,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { describeRoute } from "hono-openapi";
2
+ import { resolver, validator } from "hono-openapi";
3
+ import { z } from "zod";
4
+ import { abis } from "@evergonlabs/tmi-factories-sdk";
5
+ import { createController } from "../../../common/controller.js";
6
+ import { AddressSchema, toTransaction, TransactionSchema } from "../../../common/index.js";
7
+ import { DEFAULT_COMPILOT_SIGNER } from "../../../common/models/compilot.js";
8
+ import { erc1155Tag } from "../tag.js";
9
+ export const InitializeGatedErc1155RequestSchema = z.object({
10
+ tokenAddress: AddressSchema,
11
+ baseURI: z.string().openapi({ description: "Base URI for token metadata" }),
12
+ defaultAdmin: AddressSchema.openapi({ description: "Address to receive DEFAULT_ADMIN_ROLE" }),
13
+ minter: AddressSchema.openapi({ description: "Address to receive MINTER_ROLE" }),
14
+ gatingSigner: AddressSchema.optional().openapi({
15
+ description: "Address of the gating signer for whitelist verification. Defaults to the ComPilot signer.",
16
+ }),
17
+ });
18
+ const initializeRoute = describeRoute({
19
+ summary: "Initialize Gated ERC1155",
20
+ description: "Returns transaction data for initializing a gated ERC1155 token proxy contract",
21
+ tags: [erc1155Tag.tag],
22
+ responses: {
23
+ 200: {
24
+ description: "Returns transaction data for initializing a gated ERC1155 token",
25
+ content: {
26
+ "application/json": {
27
+ schema: resolver(TransactionSchema),
28
+ },
29
+ },
30
+ },
31
+ },
32
+ });
33
+ export const InitializeGatedErc1155 = createController({
34
+ build: (factory) => factory
35
+ .createApp()
36
+ .post("/", initializeRoute, validator("json", InitializeGatedErc1155RequestSchema), async (c) => {
37
+ const { tokenAddress, baseURI, defaultAdmin, minter, gatingSigner } = c.req.valid("json");
38
+ return c.json(toTransaction({
39
+ address: tokenAddress,
40
+ abi: abis.erc1155AutoIdWhitelistGatedPausableRecoverableUpgradeableAbi,
41
+ functionName: "initialize",
42
+ args: [baseURI, defaultAdmin, minter, gatingSigner ?? DEFAULT_COMPILOT_SIGNER],
43
+ }));
44
+ }),
45
+ });
@@ -0,0 +1,21 @@
1
+ export declare const ParseGatedErc1155DeployEvent: import("../../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../../common/context.js").AppContext, {
2
+ "/": {
3
+ $get: {
4
+ input: {
5
+ query: {
6
+ chainId: string | string[];
7
+ hash: string | string[];
8
+ };
9
+ };
10
+ output: {
11
+ proxy: `0x${string}`;
12
+ admin: `0x${string}`;
13
+ minter: `0x${string}`;
14
+ baseURI: string;
15
+ };
16
+ outputFormat: "json";
17
+ status: import("hono/utils/http-status").ContentfulStatusCode;
18
+ };
19
+ };
20
+ }, "/", "/">>;
21
+ //# sourceMappingURL=parseDeployEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseDeployEvent.d.ts","sourceRoot":"","sources":["../../../../src/issuance/erc1155/gated/parseDeployEvent.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;aAgDvC,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { describeRoute } from "hono-openapi";
2
+ import { resolver, validator } from "hono-openapi";
3
+ import { parseEventLogs } from "viem";
4
+ import { waitForTransactionReceipt } from "viem/actions";
5
+ import { z } from "zod";
6
+ import { abis } from "@evergonlabs/tmi-factories-sdk";
7
+ import { getPublicClient } from "../../../common/blockchain.js";
8
+ import { createController } from "../../../common/controller.js";
9
+ import { HttpError } from "../../../common/http-error.js";
10
+ import { AddressSchema, HashSchema } from "../../../common/index.js";
11
+ import { FactoryChainIdQuery } from "../../common/factories.js";
12
+ import { erc1155Tag } from "../tag.js";
13
+ const QuerySchema = z.object({
14
+ chainId: FactoryChainIdQuery.openapi({
15
+ param: {
16
+ name: "chainId",
17
+ in: "query",
18
+ },
19
+ }),
20
+ hash: HashSchema.openapi({
21
+ param: {
22
+ name: "hash",
23
+ in: "query",
24
+ },
25
+ }),
26
+ });
27
+ export const ParseGatedErc1155DeployEvent = createController({
28
+ build: (factory) => factory.createApp().get("/", describeRoute({
29
+ summary: "Get Gated ERC1155 TokenProxyConfigured Event",
30
+ description: `Gets the transaction by hash and parses emitted logs.\n\nProvided transaction must be a transaction emitted by the Gated ERC1155 factory \`deployAndInitializeProxy\` action`,
31
+ tags: [erc1155Tag.tag],
32
+ responses: {
33
+ 200: {
34
+ description: "Returns parsed event log",
35
+ content: {
36
+ "application/json": {
37
+ schema: resolver(z.object({
38
+ proxy: AddressSchema,
39
+ admin: AddressSchema,
40
+ minter: AddressSchema,
41
+ baseURI: z.string(),
42
+ })),
43
+ },
44
+ },
45
+ },
46
+ },
47
+ }), validator("query", QuerySchema), async (c) => {
48
+ const params = c.req.valid("query");
49
+ const receipt = await waitForTransactionReceipt(getPublicClient(params.chainId, c.env.config), {
50
+ hash: params.hash,
51
+ });
52
+ const [event] = parseEventLogs({
53
+ abi: abis.erc1155AutoIdGatedPausableRecoverableFactoryAbi,
54
+ eventName: "TokenProxyConfigured",
55
+ logs: receipt.logs,
56
+ });
57
+ if (!event) {
58
+ throw new UnableParseGatedErc1155DeployEvent();
59
+ }
60
+ return c.json({
61
+ proxy: event.args.proxy,
62
+ admin: event.args.admin,
63
+ minter: event.args.minter,
64
+ baseURI: event.args.baseURI,
65
+ });
66
+ }),
67
+ });
68
+ class UnableParseGatedErc1155DeployEvent extends HttpError {
69
+ constructor() {
70
+ super(500, {
71
+ message: `Can't parse TokenProxyConfigured event. Make sure you're passing a transaction generated by the Gated ERC1155 factory \`deployAndInitializeProxy\` action`,
72
+ name: "UnableParseGatedErc1155DeployEvent",
73
+ });
74
+ }
75
+ }
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ import { Erc1155TokenRole } from "../../common/roles/erc1155-token-roles.js";
3
+ export declare const GrantRoleErc1155RequestSchema: z.ZodObject<{
4
+ tokenAddress: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
5
+ role: z.ZodEnum<typeof Erc1155TokenRole>;
6
+ account: z.ZodPipe<z.ZodString & z.ZodType<`0x${string}`, string, z.core.$ZodTypeInternals<`0x${string}`, string>>, z.ZodTransform<`0x${string}`, `0x${string}`>>;
7
+ }, z.core.$strip>;
8
+ export declare const GrantRoleErc1155: import("../../common/controller.js").IController<import("hono/hono-base").HonoBase<import("../../common/context.js").AppContext, {
9
+ "/": {
10
+ $post: {
11
+ input: {
12
+ json: {
13
+ tokenAddress: string;
14
+ role: Erc1155TokenRole;
15
+ account: string;
16
+ };
17
+ };
18
+ output: {
19
+ data: `0x${string}`;
20
+ to: `0x${string}`;
21
+ details: {
22
+ functionName: string;
23
+ address: `0x${string}`;
24
+ abi: any[];
25
+ args: any[];
26
+ };
27
+ };
28
+ outputFormat: "json";
29
+ status: import("hono/utils/http-status").ContentfulStatusCode;
30
+ };
31
+ };
32
+ }, "/", "/">>;
33
+ //# sourceMappingURL=grantRole.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grantRole.d.ts","sourceRoot":"","sources":["../../../src/issuance/erc1155/grantRole.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAiC,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAG5G,eAAO,MAAM,6BAA6B;;;;iBAOxC,CAAC;AAkBH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;aAc3B,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { describeRoute } from "hono-openapi";
2
+ import { resolver, validator } from "hono-openapi";
3
+ import { z } from "zod";
4
+ import { abis } from "@evergonlabs/tmi-factories-sdk";
5
+ import { createController } from "../../common/controller.js";
6
+ import { AddressSchema, toTransaction, TransactionSchema } from "../../common/index.js";
7
+ import { convertErc1155TokenRoleToHash, Erc1155TokenRole } from "../../common/roles/erc1155-token-roles.js";
8
+ import { erc1155Tag } from "./tag.js";
9
+ export const GrantRoleErc1155RequestSchema = z.object({
10
+ tokenAddress: AddressSchema,
11
+ role: z.nativeEnum(Erc1155TokenRole).openapi({
12
+ description: "The role to grant",
13
+ example: Erc1155TokenRole.MINTER_ROLE,
14
+ }),
15
+ account: AddressSchema.openapi({ description: "The address to grant the role to" }),
16
+ });
17
+ const grantRoleRoute = describeRoute({
18
+ summary: "Grant Role on ERC1155",
19
+ description: "Returns transaction data for granting a role on the ERC1155 token contract",
20
+ tags: [erc1155Tag.tag],
21
+ responses: {
22
+ 200: {
23
+ description: "Returns transaction data for granting a role",
24
+ content: {
25
+ "application/json": {
26
+ schema: resolver(TransactionSchema),
27
+ },
28
+ },
29
+ },
30
+ },
31
+ });
32
+ export const GrantRoleErc1155 = createController({
33
+ build: (factory) => factory.createApp().post("/", grantRoleRoute, validator("json", GrantRoleErc1155RequestSchema), async (c) => {
34
+ const { tokenAddress, role, account } = c.req.valid("json");
35
+ return c.json(toTransaction({
36
+ address: tokenAddress,
37
+ abi: abis.erc1155AutoIdPausableRecoverableUpgradeableAbi,
38
+ functionName: "grantRole",
39
+ args: [convertErc1155TokenRoleToHash(role), account],
40
+ }));
41
+ }),
42
+ });