@namera-ai/cli 0.1.4 → 1.0.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 (148) hide show
  1. package/README.md +91 -221
  2. package/dist/index.js +1660 -0
  3. package/dist/index.js.map +1 -0
  4. package/package.json +57 -50
  5. package/LICENSE +0 -201
  6. package/dist/commands/index.mjs +0 -21
  7. package/dist/commands/index.mjs.map +0 -1
  8. package/dist/commands/keystore/create.mjs +0 -74
  9. package/dist/commands/keystore/create.mjs.map +0 -1
  10. package/dist/commands/keystore/decrypt.mjs +0 -71
  11. package/dist/commands/keystore/decrypt.mjs.map +0 -1
  12. package/dist/commands/keystore/import.mjs +0 -84
  13. package/dist/commands/keystore/import.mjs.map +0 -1
  14. package/dist/commands/keystore/index.mjs +0 -28
  15. package/dist/commands/keystore/index.mjs.map +0 -1
  16. package/dist/commands/keystore/info.mjs +0 -62
  17. package/dist/commands/keystore/info.mjs.map +0 -1
  18. package/dist/commands/keystore/list.mjs +0 -46
  19. package/dist/commands/keystore/list.mjs.map +0 -1
  20. package/dist/commands/keystore/remove.mjs +0 -51
  21. package/dist/commands/keystore/remove.mjs.map +0 -1
  22. package/dist/commands/mcp/index.mjs +0 -13
  23. package/dist/commands/mcp/index.mjs.map +0 -1
  24. package/dist/commands/mcp/start.mjs +0 -82
  25. package/dist/commands/mcp/start.mjs.map +0 -1
  26. package/dist/commands/schema/index.mjs +0 -53
  27. package/dist/commands/schema/index.mjs.map +0 -1
  28. package/dist/commands/session-key/create/index.mjs +0 -87
  29. package/dist/commands/session-key/create/index.mjs.map +0 -1
  30. package/dist/commands/session-key/create/prompts/base.mjs +0 -52
  31. package/dist/commands/session-key/create/prompts/base.mjs.map +0 -1
  32. package/dist/commands/session-key/create/prompts/call.mjs +0 -85
  33. package/dist/commands/session-key/create/prompts/call.mjs.map +0 -1
  34. package/dist/commands/session-key/create/prompts/common.mjs +0 -27
  35. package/dist/commands/session-key/create/prompts/common.mjs.map +0 -1
  36. package/dist/commands/session-key/create/prompts/gas.mjs +0 -19
  37. package/dist/commands/session-key/create/prompts/gas.mjs.map +0 -1
  38. package/dist/commands/session-key/create/prompts/index.mjs +0 -44
  39. package/dist/commands/session-key/create/prompts/index.mjs.map +0 -1
  40. package/dist/commands/session-key/create/prompts/rate-limit.mjs +0 -40
  41. package/dist/commands/session-key/create/prompts/rate-limit.mjs.map +0 -1
  42. package/dist/commands/session-key/create/prompts/signature-caller.mjs +0 -26
  43. package/dist/commands/session-key/create/prompts/signature-caller.mjs.map +0 -1
  44. package/dist/commands/session-key/create/prompts/timestamp.mjs +0 -32
  45. package/dist/commands/session-key/create/prompts/timestamp.mjs.map +0 -1
  46. package/dist/commands/session-key/index.mjs +0 -26
  47. package/dist/commands/session-key/index.mjs.map +0 -1
  48. package/dist/commands/session-key/info.mjs +0 -64
  49. package/dist/commands/session-key/info.mjs.map +0 -1
  50. package/dist/commands/session-key/list.mjs +0 -54
  51. package/dist/commands/session-key/list.mjs.map +0 -1
  52. package/dist/commands/session-key/remove.mjs +0 -51
  53. package/dist/commands/session-key/remove.mjs.map +0 -1
  54. package/dist/commands/session-key/status.mjs +0 -64
  55. package/dist/commands/session-key/status.mjs.map +0 -1
  56. package/dist/commands/smart-account/create.mjs +0 -94
  57. package/dist/commands/smart-account/create.mjs.map +0 -1
  58. package/dist/commands/smart-account/import.mjs +0 -45
  59. package/dist/commands/smart-account/import.mjs.map +0 -1
  60. package/dist/commands/smart-account/index.mjs +0 -30
  61. package/dist/commands/smart-account/index.mjs.map +0 -1
  62. package/dist/commands/smart-account/info.mjs +0 -66
  63. package/dist/commands/smart-account/info.mjs.map +0 -1
  64. package/dist/commands/smart-account/list.mjs +0 -48
  65. package/dist/commands/smart-account/list.mjs.map +0 -1
  66. package/dist/commands/smart-account/remove.mjs +0 -54
  67. package/dist/commands/smart-account/remove.mjs.map +0 -1
  68. package/dist/commands/smart-account/status.mjs +0 -63
  69. package/dist/commands/smart-account/status.mjs.map +0 -1
  70. package/dist/dto/index.mjs +0 -6
  71. package/dist/dto/keystore.mjs +0 -44
  72. package/dist/dto/keystore.mjs.map +0 -1
  73. package/dist/dto/mcp.mjs +0 -13
  74. package/dist/dto/mcp.mjs.map +0 -1
  75. package/dist/dto/session-key.mjs +0 -54
  76. package/dist/dto/session-key.mjs.map +0 -1
  77. package/dist/dto/smart-account.mjs +0 -45
  78. package/dist/dto/smart-account.mjs.map +0 -1
  79. package/dist/flags/global.mjs +0 -29
  80. package/dist/flags/global.mjs.map +0 -1
  81. package/dist/flags/shared.mjs +0 -11
  82. package/dist/flags/shared.mjs.map +0 -1
  83. package/dist/helpers/humanize.mjs +0 -153
  84. package/dist/helpers/humanize.mjs.map +0 -1
  85. package/dist/helpers/paths.mjs +0 -31
  86. package/dist/helpers/paths.mjs.map +0 -1
  87. package/dist/helpers/policy.mjs +0 -89
  88. package/dist/helpers/policy.mjs.map +0 -1
  89. package/dist/helpers/pretty.mjs +0 -71
  90. package/dist/helpers/pretty.mjs.map +0 -1
  91. package/dist/index.d.mts +0 -2
  92. package/dist/index.mjs +0 -36
  93. package/dist/index.mjs.map +0 -1
  94. package/dist/layers/config.mjs +0 -124
  95. package/dist/layers/config.mjs.map +0 -1
  96. package/dist/layers/index.mjs +0 -11
  97. package/dist/layers/keystore.mjs +0 -225
  98. package/dist/layers/keystore.mjs.map +0 -1
  99. package/dist/layers/mcp-context.mjs +0 -8
  100. package/dist/layers/mcp-context.mjs.map +0 -1
  101. package/dist/layers/mcp.mjs +0 -31
  102. package/dist/layers/mcp.mjs.map +0 -1
  103. package/dist/layers/output.mjs +0 -21
  104. package/dist/layers/output.mjs.map +0 -1
  105. package/dist/layers/prompt.mjs +0 -78
  106. package/dist/layers/prompt.mjs.map +0 -1
  107. package/dist/layers/session-key.mjs +0 -218
  108. package/dist/layers/session-key.mjs.map +0 -1
  109. package/dist/layers/smart-account.mjs +0 -175
  110. package/dist/layers/smart-account.mjs.map +0 -1
  111. package/dist/layers/web3.mjs +0 -83
  112. package/dist/layers/web3.mjs.map +0 -1
  113. package/dist/mcp/helpers/common.mjs +0 -9
  114. package/dist/mcp/helpers/common.mjs.map +0 -1
  115. package/dist/mcp/helpers/index.mjs +0 -4
  116. package/dist/mcp/helpers/session-key.mjs +0 -129
  117. package/dist/mcp/helpers/session-key.mjs.map +0 -1
  118. package/dist/mcp/index.mjs +0 -43
  119. package/dist/mcp/index.mjs.map +0 -1
  120. package/dist/mcp/mcp.mjs +0 -15
  121. package/dist/mcp/mcp.mjs.map +0 -1
  122. package/dist/mcp/tools/account/address.mjs +0 -20
  123. package/dist/mcp/tools/account/address.mjs.map +0 -1
  124. package/dist/mcp/tools/account/get-balance.mjs +0 -54
  125. package/dist/mcp/tools/account/get-balance.mjs.map +0 -1
  126. package/dist/mcp/tools/account/index.mjs +0 -15
  127. package/dist/mcp/tools/account/index.mjs.map +0 -1
  128. package/dist/mcp/tools/read/index.mjs +0 -11
  129. package/dist/mcp/tools/read/index.mjs.map +0 -1
  130. package/dist/mcp/tools/read/read-contract.mjs +0 -49
  131. package/dist/mcp/tools/read/read-contract.mjs.map +0 -1
  132. package/dist/mcp/tools/transaction/execute-transaction.mjs +0 -38
  133. package/dist/mcp/tools/transaction/execute-transaction.mjs.map +0 -1
  134. package/dist/mcp/tools/transaction/index.mjs +0 -15
  135. package/dist/mcp/tools/transaction/index.mjs.map +0 -1
  136. package/dist/mcp/tools/transaction/native-transfer.mjs +0 -59
  137. package/dist/mcp/tools/transaction/native-transfer.mjs.map +0 -1
  138. package/dist/schema/chain.mjs +0 -124
  139. package/dist/schema/chain.mjs.map +0 -1
  140. package/dist/schema/common.mjs +0 -29
  141. package/dist/schema/common.mjs.map +0 -1
  142. package/dist/schema/index.mjs +0 -5
  143. package/dist/schema/policy.mjs +0 -114
  144. package/dist/schema/policy.mjs.map +0 -1
  145. package/dist/schema/tx.mjs +0 -19
  146. package/dist/schema/tx.mjs.map +0 -1
  147. package/dist/types/index.mjs +0 -11
  148. package/dist/types/index.mjs.map +0 -1
@@ -1,54 +0,0 @@
1
- #!/usr/bin/env node
2
- import { SupportedChain, getChain } from "../../../schema/chain.mjs";
3
- import { EthereumAddress } from "../../../schema/common.mjs";
4
- import "../../../schema/index.mjs";
5
- import { McpContext } from "../../../layers/mcp-context.mjs";
6
- import { InsufficientPermissions } from "../../helpers/common.mjs";
7
- import { Web3Service } from "../../../layers/web3.mjs";
8
- import { getSessionKeyClient } from "../../helpers/session-key.mjs";
9
- import "../../helpers/index.mjs";
10
- import { Effect, Schema } from "effect";
11
- import { formatUnits } from "viem";
12
- import { Tool } from "effect/unstable/ai";
13
- import { getBalance } from "viem/actions";
14
- //#region src/mcp/tools/account/get-balance.ts
15
- const GetBalanceToolParams = Schema.Struct({
16
- address: EthereumAddress.annotate({ description: "The address to get the balance for" }),
17
- chain: SupportedChain.annotate({ description: "The chain to get the balance for" })
18
- });
19
- const GetBalanceToolResult = Schema.Struct({
20
- nativeCurrency: Schema.Struct({
21
- name: Schema.String.annotate({ description: "The name of the currency" }),
22
- symbol: Schema.String.annotate({ description: "The symbol of the currency" }),
23
- decimals: Schema.Number.annotate({ description: "The number of decimals the currency has" })
24
- }).annotate({ description: "The native currency of the chain" }),
25
- balance: Schema.Struct({
26
- amount: Schema.String.annotate({ description: "Balance in atomic units" }),
27
- formatted: Schema.String.annotate({ description: "Balance in native currency units" })
28
- })
29
- });
30
- const GetBalanceTool = Tool.make("get_balance", {
31
- dependencies: [McpContext, Web3Service],
32
- description: "Get the address of the wallet",
33
- failure: InsufficientPermissions,
34
- parameters: GetBalanceToolParams,
35
- success: GetBalanceToolResult
36
- });
37
- const getBalanceToolHandler = (params) => Effect.gen(function* () {
38
- const sessionKeyClient = yield* getSessionKeyClient({ operation: {
39
- intent: "read",
40
- chainId: getChain(params.chain).id
41
- } });
42
- const res = yield* Effect.promise(() => getBalance(sessionKeyClient.client, { address: params.address }));
43
- return {
44
- nativeCurrency: sessionKeyClient.chain.nativeCurrency,
45
- balance: {
46
- amount: res.toString(),
47
- formatted: formatUnits(res, sessionKeyClient.chain.nativeCurrency.decimals)
48
- }
49
- };
50
- });
51
- //#endregion
52
- export { GetBalanceTool, getBalanceToolHandler };
53
-
54
- //# sourceMappingURL=get-balance.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-balance.mjs","names":[],"sources":["../../../../src/mcp/tools/account/get-balance.ts"],"sourcesContent":["import { Effect, Schema } from \"effect\";\nimport { Tool } from \"effect/unstable/ai\";\nimport { formatUnits } from \"viem\";\nimport { getBalance } from \"viem/actions\";\n\nimport { McpContext } from \"@/layers/mcp-context\";\nimport { Web3Service } from \"@/layers/web3\";\nimport { getSessionKeyClient, InsufficientPermissions } from \"@/mcp/helpers\";\nimport { EthereumAddress, getChain, SupportedChain } from \"@/schema\";\n\nexport const GetBalanceToolParams = Schema.Struct({\n address: EthereumAddress.annotate({\n description: \"The address to get the balance for\",\n }),\n chain: SupportedChain.annotate({\n description: \"The chain to get the balance for\",\n }),\n});\n\nexport const GetBalanceToolResult = Schema.Struct({\n nativeCurrency: Schema.Struct({\n name: Schema.String.annotate({\n description: \"The name of the currency\",\n }),\n symbol: Schema.String.annotate({\n description: \"The symbol of the currency\",\n }),\n decimals: Schema.Number.annotate({\n description: \"The number of decimals the currency has\",\n }),\n }).annotate({\n description: \"The native currency of the chain\",\n }),\n balance: Schema.Struct({\n amount: Schema.String.annotate({\n description: \"Balance in atomic units\",\n }),\n formatted: Schema.String.annotate({\n description: \"Balance in native currency units\",\n }),\n }),\n});\n\nexport type GetBalanceToolResult = typeof GetBalanceToolResult.Type;\nexport type GetBalanceToolParams = typeof GetBalanceToolParams.Type;\n\nexport const GetBalanceTool = Tool.make(\"get_balance\", {\n dependencies: [McpContext, Web3Service],\n description: \"Get the address of the wallet\",\n failure: InsufficientPermissions,\n parameters: GetBalanceToolParams,\n success: GetBalanceToolResult,\n});\n\nexport const getBalanceToolHandler = (params: GetBalanceToolParams) =>\n Effect.gen(function* () {\n const sessionKeyClient = yield* getSessionKeyClient({\n operation: {\n intent: \"read\",\n chainId: getChain(params.chain).id,\n },\n });\n\n const res = yield* Effect.promise(() =>\n getBalance(sessionKeyClient.client, {\n address: params.address,\n }),\n );\n\n const data = {\n nativeCurrency: sessionKeyClient.chain.nativeCurrency,\n balance: {\n amount: res.toString(),\n formatted: formatUnits(\n res,\n sessionKeyClient.chain.nativeCurrency.decimals,\n ),\n },\n };\n\n return data;\n });\n"],"mappings":";;;;;;;;;;;;;;AAUA,MAAa,uBAAuB,OAAO,OAAO;CAChD,SAAS,gBAAgB,SAAS,EAChC,aAAa,sCACd,CAAC;CACF,OAAO,eAAe,SAAS,EAC7B,aAAa,oCACd,CAAC;CACH,CAAC;AAEF,MAAa,uBAAuB,OAAO,OAAO;CAChD,gBAAgB,OAAO,OAAO;EAC5B,MAAM,OAAO,OAAO,SAAS,EAC3B,aAAa,4BACd,CAAC;EACF,QAAQ,OAAO,OAAO,SAAS,EAC7B,aAAa,8BACd,CAAC;EACF,UAAU,OAAO,OAAO,SAAS,EAC/B,aAAa,2CACd,CAAC;EACH,CAAC,CAAC,SAAS,EACV,aAAa,oCACd,CAAC;CACF,SAAS,OAAO,OAAO;EACrB,QAAQ,OAAO,OAAO,SAAS,EAC7B,aAAa,2BACd,CAAC;EACF,WAAW,OAAO,OAAO,SAAS,EAChC,aAAa,oCACd,CAAC;EACH,CAAC;CACH,CAAC;AAKF,MAAa,iBAAiB,KAAK,KAAK,eAAe;CACrD,cAAc,CAAC,YAAY,YAAY;CACvC,aAAa;CACb,SAAS;CACT,YAAY;CACZ,SAAS;CACV,CAAC;AAEF,MAAa,yBAAyB,WACpC,OAAO,IAAI,aAAa;CACtB,MAAM,mBAAmB,OAAO,oBAAoB,EAClD,WAAW;EACT,QAAQ;EACR,SAAS,SAAS,OAAO,MAAM,CAAC;EACjC,EACF,CAAC;CAEF,MAAM,MAAM,OAAO,OAAO,cACxB,WAAW,iBAAiB,QAAQ,EAClC,SAAS,OAAO,SACjB,CAAC,CACH;AAaD,QAAO;EAVL,gBAAgB,iBAAiB,MAAM;EACvC,SAAS;GACP,QAAQ,IAAI,UAAU;GACtB,WAAW,YACT,KACA,iBAAiB,MAAM,eAAe,SACvC;GACF;EAGI;EACP"}
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env node
2
- import { GetAddressTool, getAddressToolHandler } from "./address.mjs";
3
- import { GetBalanceTool, getBalanceToolHandler } from "./get-balance.mjs";
4
- import { Effect } from "effect";
5
- import { Toolkit } from "effect/unstable/ai";
6
- //#region src/mcp/tools/account/index.ts
7
- const AccountTools = Toolkit.make(GetAddressTool, GetBalanceTool);
8
- const AccountToolsHandlers = AccountTools.toLayer(Effect.succeed({
9
- get_wallet_address: getAddressToolHandler,
10
- get_balance: getBalanceToolHandler
11
- }));
12
- //#endregion
13
- export { AccountTools, AccountToolsHandlers };
14
-
15
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/mcp/tools/account/index.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { Toolkit } from \"effect/unstable/ai\";\n\nimport { GetAddressTool, getAddressToolHandler } from \"./address\";\nimport { GetBalanceTool, getBalanceToolHandler } from \"./get-balance\";\n\nexport const AccountTools = Toolkit.make(GetAddressTool, GetBalanceTool);\nexport const AccountToolsHandlers = AccountTools.toLayer(\n Effect.succeed({\n get_wallet_address: getAddressToolHandler,\n get_balance: getBalanceToolHandler,\n }),\n);\n"],"mappings":";;;;;;AAMA,MAAa,eAAe,QAAQ,KAAK,gBAAgB,eAAe;AACxE,MAAa,uBAAuB,aAAa,QAC/C,OAAO,QAAQ;CACb,oBAAoB;CACpB,aAAa;CACd,CAAC,CACH"}
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- import { ReadContractTool, readContractToolHandler } from "./read-contract.mjs";
3
- import { Effect } from "effect";
4
- import { Toolkit } from "effect/unstable/ai";
5
- //#region src/mcp/tools/read/index.ts
6
- const ReadTools = Toolkit.make(ReadContractTool);
7
- const ReadToolsHandlers = ReadTools.toLayer(Effect.succeed({ read_contract: (params) => readContractToolHandler(params) }));
8
- //#endregion
9
- export { ReadTools, ReadToolsHandlers };
10
-
11
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/mcp/tools/read/index.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { Toolkit } from \"effect/unstable/ai\";\n\nimport { ReadContractTool, readContractToolHandler } from \"./read-contract\";\n\nexport const ReadTools = Toolkit.make(ReadContractTool);\nexport const ReadToolsHandlers = ReadTools.toLayer(\n Effect.succeed({\n read_contract: (params) => readContractToolHandler(params),\n }),\n);\n"],"mappings":";;;;;AAKA,MAAa,YAAY,QAAQ,KAAK,iBAAiB;AACvD,MAAa,oBAAoB,UAAU,QACzC,OAAO,QAAQ,EACb,gBAAgB,WAAW,wBAAwB,OAAO,EAC3D,CAAC,CACH"}
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env node
2
- import { SupportedChain, getChain } from "../../../schema/chain.mjs";
3
- import { EthereumAddress } from "../../../schema/common.mjs";
4
- import "../../../schema/index.mjs";
5
- import { McpContext } from "../../../layers/mcp-context.mjs";
6
- import { InsufficientPermissions } from "../../helpers/common.mjs";
7
- import { Web3Service } from "../../../layers/web3.mjs";
8
- import { getSessionKeyClient } from "../../helpers/session-key.mjs";
9
- import "../../helpers/index.mjs";
10
- import { Effect, Schema } from "effect";
11
- import { Tool } from "effect/unstable/ai";
12
- import { readContract } from "viem/actions";
13
- //#region src/mcp/tools/read/read-contract.ts
14
- const ReadContractToolParams = Schema.Struct({
15
- chain: SupportedChain.annotate({ description: "The chain to use for the transfer" }),
16
- contractAddress: EthereumAddress.annotate({ description: "The ethereum address of the contract to read" }),
17
- abi: Schema.Array(Schema.Any).annotate({ description: "The ABI of the contract to read" }),
18
- functionName: Schema.String.annotate({ description: "The name of the function to call on the contract" }),
19
- args: Schema.Array(Schema.Any).annotate({ description: "The arguments to pass to the function" })
20
- });
21
- const ReadContractTool = Tool.make("read_contract", {
22
- dependencies: [McpContext, Web3Service],
23
- description: "Read data from a specified contract.",
24
- failure: InsufficientPermissions,
25
- parameters: ReadContractToolParams,
26
- success: Schema.Any.annotate({ description: "The data returned by the contract" })
27
- });
28
- const readContractToolHandler = (params) => Effect.gen(function* () {
29
- const client = yield* getSessionKeyClient({ operation: {
30
- intent: "read",
31
- chainId: getChain(params.chain).id
32
- } });
33
- readContract(client, {
34
- address: params.contractAddress,
35
- abi: params.abi,
36
- functionName: params.functionName,
37
- args: params.args
38
- });
39
- return yield* Effect.promise(() => readContract(client, {
40
- address: params.contractAddress,
41
- abi: params.abi,
42
- functionName: params.functionName,
43
- args: params.args
44
- }));
45
- });
46
- //#endregion
47
- export { ReadContractTool, readContractToolHandler };
48
-
49
- //# sourceMappingURL=read-contract.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read-contract.mjs","names":[],"sources":["../../../../src/mcp/tools/read/read-contract.ts"],"sourcesContent":["import { Effect, Schema } from \"effect\";\nimport { Tool } from \"effect/unstable/ai\";\nimport { readContract } from \"viem/actions\";\n\nimport { McpContext } from \"@/layers/mcp-context\";\nimport { Web3Service } from \"@/layers/web3\";\nimport { getSessionKeyClient, InsufficientPermissions } from \"@/mcp/helpers\";\nimport { EthereumAddress, getChain, SupportedChain } from \"@/schema\";\n\nexport const ReadContractToolParams = Schema.Struct({\n chain: SupportedChain.annotate({\n description: \"The chain to use for the transfer\",\n }),\n contractAddress: EthereumAddress.annotate({\n description: \"The ethereum address of the contract to read\",\n }),\n abi: Schema.Array(Schema.Any).annotate({\n description: \"The ABI of the contract to read\",\n }),\n functionName: Schema.String.annotate({\n description: \"The name of the function to call on the contract\",\n }),\n args: Schema.Array(Schema.Any).annotate({\n description: \"The arguments to pass to the function\",\n }),\n});\n\nexport type ReadContractToolParams = typeof ReadContractToolParams.Type;\n\nexport const ReadContractTool = Tool.make(\"read_contract\", {\n dependencies: [McpContext, Web3Service],\n description: \"Read data from a specified contract.\",\n failure: InsufficientPermissions,\n parameters: ReadContractToolParams,\n success: Schema.Any.annotate({\n description: \"The data returned by the contract\",\n }),\n});\n\nexport const readContractToolHandler = (params: ReadContractToolParams) =>\n Effect.gen(function* () {\n const chain = getChain(params.chain);\n\n const client = yield* getSessionKeyClient({\n operation: {\n intent: \"read\",\n chainId: chain.id,\n },\n });\n\n readContract(client, {\n address: params.contractAddress,\n abi: params.abi,\n functionName: params.functionName,\n args: params.args,\n });\n\n const result = yield* Effect.promise(() =>\n readContract(client, {\n address: params.contractAddress,\n abi: params.abi,\n functionName: params.functionName,\n args: params.args,\n }),\n );\n\n return result;\n });\n"],"mappings":";;;;;;;;;;;;;AASA,MAAa,yBAAyB,OAAO,OAAO;CAClD,OAAO,eAAe,SAAS,EAC7B,aAAa,qCACd,CAAC;CACF,iBAAiB,gBAAgB,SAAS,EACxC,aAAa,gDACd,CAAC;CACF,KAAK,OAAO,MAAM,OAAO,IAAI,CAAC,SAAS,EACrC,aAAa,mCACd,CAAC;CACF,cAAc,OAAO,OAAO,SAAS,EACnC,aAAa,oDACd,CAAC;CACF,MAAM,OAAO,MAAM,OAAO,IAAI,CAAC,SAAS,EACtC,aAAa,yCACd,CAAC;CACH,CAAC;AAIF,MAAa,mBAAmB,KAAK,KAAK,iBAAiB;CACzD,cAAc,CAAC,YAAY,YAAY;CACvC,aAAa;CACb,SAAS;CACT,YAAY;CACZ,SAAS,OAAO,IAAI,SAAS,EAC3B,aAAa,qCACd,CAAC;CACH,CAAC;AAEF,MAAa,2BAA2B,WACtC,OAAO,IAAI,aAAa;CAGtB,MAAM,SAAS,OAAO,oBAAoB,EACxC,WAAW;EACT,QAAQ;EACR,SALU,SAAS,OAAO,MAKjB,CAAM;EAChB,EACF,CAAC;AAEF,cAAa,QAAQ;EACnB,SAAS,OAAO;EAChB,KAAK,OAAO;EACZ,cAAc,OAAO;EACrB,MAAM,OAAO;EACd,CAAC;AAWF,QAAO,OATe,OAAO,cAC3B,aAAa,QAAQ;EACnB,SAAS,OAAO;EAChB,KAAK,OAAO;EACZ,cAAc,OAAO;EACrB,MAAM,OAAO;EACd,CAAC,CACH;EAGD"}
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env node
2
- import { McpContext } from "../../../layers/mcp-context.mjs";
3
- import { InsufficientPermissions } from "../../helpers/common.mjs";
4
- import { Web3Service } from "../../../layers/web3.mjs";
5
- import { getSessionKeyClient } from "../../helpers/session-key.mjs";
6
- import "../../helpers/index.mjs";
7
- import { Batch } from "../../../schema/tx.mjs";
8
- import { Effect, Schema } from "effect";
9
- import { Tool } from "effect/unstable/ai";
10
- import { executeTransaction } from "@namera-ai/sdk/transaction";
11
- //#region src/mcp/tools/transaction/execute-transaction.ts
12
- const ExecuteTransactionToolParams = Batch;
13
- const ExecuteTransactionTool = Tool.make("execute_transaction", {
14
- dependencies: [McpContext, Web3Service],
15
- description: "Send transactions.",
16
- failure: InsufficientPermissions,
17
- parameters: ExecuteTransactionToolParams,
18
- success: Schema.String.annotate({ description: "The transaction hash for the executed transaction." })
19
- });
20
- const executeTransactionToolHandler = (params) => Effect.gen(function* () {
21
- const batches = [{
22
- chainId: params.chainId,
23
- nonceKey: params.nonceKey,
24
- calls: params.calls
25
- }];
26
- const client = yield* getSessionKeyClient({ operation: {
27
- intent: "transaction",
28
- batches
29
- } });
30
- return (yield* Effect.promise(() => executeTransaction({
31
- clients: [client],
32
- batches
33
- })))[0]?.receipt.transactionHash;
34
- });
35
- //#endregion
36
- export { ExecuteTransactionTool, executeTransactionToolHandler };
37
-
38
- //# sourceMappingURL=execute-transaction.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execute-transaction.mjs","names":[],"sources":["../../../../src/mcp/tools/transaction/execute-transaction.ts"],"sourcesContent":["import { executeTransaction } from \"@namera-ai/sdk/transaction\";\nimport { Effect, Schema } from \"effect\";\nimport { Tool } from \"effect/unstable/ai\";\n\nimport { McpContext } from \"@/layers/mcp-context\";\nimport { Web3Service } from \"@/layers/web3\";\nimport { getSessionKeyClient, InsufficientPermissions } from \"@/mcp/helpers\";\nimport type { Hex } from \"@/schema\";\nimport { Batch } from \"@/schema/tx\";\n\nexport const ExecuteTransactionToolParams = Batch;\n\nexport type ExecuteTransactionToolParams =\n typeof ExecuteTransactionToolParams.Type;\n\nexport const ExecuteTransactionTool = Tool.make(\"execute_transaction\", {\n dependencies: [McpContext, Web3Service],\n description: \"Send transactions.\",\n failure: InsufficientPermissions,\n parameters: ExecuteTransactionToolParams,\n success: Schema.String.annotate({\n description: \"The transaction hash for the executed transaction.\",\n }),\n});\n\nexport const executeTransactionToolHandler = (\n params: ExecuteTransactionToolParams,\n) =>\n Effect.gen(function* () {\n const batches: Batch[] = [\n {\n chainId: params.chainId,\n nonceKey: params.nonceKey,\n calls: params.calls,\n },\n ];\n\n const client = yield* getSessionKeyClient({\n operation: {\n intent: \"transaction\",\n batches,\n },\n });\n\n const txHashes = yield* Effect.promise(() =>\n executeTransaction({\n clients: [client],\n batches,\n }),\n );\n\n return txHashes[0]?.receipt.transactionHash as Hex;\n });\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,+BAA+B;AAK5C,MAAa,yBAAyB,KAAK,KAAK,uBAAuB;CACrE,cAAc,CAAC,YAAY,YAAY;CACvC,aAAa;CACb,SAAS;CACT,YAAY;CACZ,SAAS,OAAO,OAAO,SAAS,EAC9B,aAAa,sDACd,CAAC;CACH,CAAC;AAEF,MAAa,iCACX,WAEA,OAAO,IAAI,aAAa;CACtB,MAAM,UAAmB,CACvB;EACE,SAAS,OAAO;EAChB,UAAU,OAAO;EACjB,OAAO,OAAO;EACf,CACF;CAED,MAAM,SAAS,OAAO,oBAAoB,EACxC,WAAW;EACT,QAAQ;EACR;EACD,EACF,CAAC;AASF,SAAO,OAPiB,OAAO,cAC7B,mBAAmB;EACjB,SAAS,CAAC,OAAO;EACjB;EACD,CAAC,CACH,EAEe,IAAI,QAAQ;EAC5B"}
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env node
2
- import { ExecuteTransactionTool, executeTransactionToolHandler } from "./execute-transaction.mjs";
3
- import { NativeTransferTool, nativeTransferToolHandler } from "./native-transfer.mjs";
4
- import { Effect } from "effect";
5
- import { Toolkit } from "effect/unstable/ai";
6
- //#region src/mcp/tools/transaction/index.ts
7
- const TransactionTools = Toolkit.make(NativeTransferTool, ExecuteTransactionTool);
8
- const TransactionToolsHandlers = TransactionTools.toLayer(Effect.succeed({
9
- native_transfer: (params) => nativeTransferToolHandler(params),
10
- execute_transaction: (params) => executeTransactionToolHandler(params)
11
- }));
12
- //#endregion
13
- export { TransactionTools, TransactionToolsHandlers };
14
-
15
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/mcp/tools/transaction/index.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { Toolkit } from \"effect/unstable/ai\";\n\nimport {\n ExecuteTransactionTool,\n executeTransactionToolHandler,\n} from \"./execute-transaction\";\nimport {\n NativeTransferTool,\n nativeTransferToolHandler,\n} from \"./native-transfer\";\n\nexport const TransactionTools = Toolkit.make(\n NativeTransferTool,\n ExecuteTransactionTool,\n);\nexport const TransactionToolsHandlers = TransactionTools.toLayer(\n Effect.succeed({\n native_transfer: (params) => nativeTransferToolHandler(params),\n execute_transaction: (params) => executeTransactionToolHandler(params),\n }),\n);\n"],"mappings":";;;;;;AAYA,MAAa,mBAAmB,QAAQ,KACtC,oBACA,uBACD;AACD,MAAa,2BAA2B,iBAAiB,QACvD,OAAO,QAAQ;CACb,kBAAkB,WAAW,0BAA0B,OAAO;CAC9D,sBAAsB,WAAW,8BAA8B,OAAO;CACvE,CAAC,CACH"}
@@ -1,59 +0,0 @@
1
- #!/usr/bin/env node
2
- import { SupportedChain, getChain } from "../../../schema/chain.mjs";
3
- import { EthereumAddress } from "../../../schema/common.mjs";
4
- import "../../../schema/index.mjs";
5
- import { McpContext } from "../../../layers/mcp-context.mjs";
6
- import { InsufficientPermissions } from "../../helpers/common.mjs";
7
- import { Web3Service } from "../../../layers/web3.mjs";
8
- import { getSessionKeyClient } from "../../helpers/session-key.mjs";
9
- import "../../helpers/index.mjs";
10
- import { Effect, Schema } from "effect";
11
- import { parseUnits } from "viem";
12
- import { Tool } from "effect/unstable/ai";
13
- import { executeTransaction } from "@namera-ai/sdk/transaction";
14
- //#region src/mcp/tools/transaction/native-transfer.ts
15
- const NativeTransferToolParams = Schema.Struct({
16
- chain: SupportedChain.annotate({ description: "The chain to use for the transfer" }),
17
- address: EthereumAddress.annotate({ description: "The ethereum address to transfer to" }),
18
- amount: Schema.String.annotate({ description: "The amount of native tokens to transfer" }),
19
- unit: Schema.Literals([
20
- "wei",
21
- "gwei",
22
- "ether"
23
- ])
24
- });
25
- const NativeTransferTool = Tool.make("native_transfer", {
26
- dependencies: [McpContext, Web3Service],
27
- description: "Transfer Native Tokens to a specified address.",
28
- failure: InsufficientPermissions,
29
- parameters: NativeTransferToolParams,
30
- success: Schema.String.annotate({ description: "The transaction hash of the transfer" })
31
- });
32
- const nativeTransferToolHandler = (params) => Effect.gen(function* () {
33
- const decimals = () => {
34
- if (params.unit === "wei") return 1;
35
- if (params.unit === "gwei") return 9;
36
- return 18;
37
- };
38
- const amount = parseUnits(params.amount.toString(), decimals());
39
- const batches = [{
40
- chainId: getChain(params.chain).id,
41
- calls: [{
42
- to: params.address,
43
- value: amount,
44
- data: "0x"
45
- }]
46
- }];
47
- const client = yield* getSessionKeyClient({ operation: {
48
- intent: "transaction",
49
- batches
50
- } });
51
- return (yield* Effect.promise(() => executeTransaction({
52
- clients: [client],
53
- batches
54
- })))[0]?.receipt.transactionHash;
55
- });
56
- //#endregion
57
- export { NativeTransferTool, nativeTransferToolHandler };
58
-
59
- //# sourceMappingURL=native-transfer.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"native-transfer.mjs","names":[],"sources":["../../../../src/mcp/tools/transaction/native-transfer.ts"],"sourcesContent":["import { executeTransaction } from \"@namera-ai/sdk/transaction\";\nimport { Effect, Schema } from \"effect\";\nimport { Tool } from \"effect/unstable/ai\";\nimport { parseUnits } from \"viem\";\n\nimport { McpContext } from \"@/layers/mcp-context\";\nimport { Web3Service } from \"@/layers/web3\";\nimport { getSessionKeyClient, InsufficientPermissions } from \"@/mcp/helpers\";\nimport { EthereumAddress, getChain, type Hex, SupportedChain } from \"@/schema\";\nimport type { Batch } from \"@/schema/tx\";\n\nexport const NativeTransferToolParams = Schema.Struct({\n chain: SupportedChain.annotate({\n description: \"The chain to use for the transfer\",\n }),\n address: EthereumAddress.annotate({\n description: \"The ethereum address to transfer to\",\n }),\n amount: Schema.String.annotate({\n description: \"The amount of native tokens to transfer\",\n }),\n unit: Schema.Literals([\"wei\", \"gwei\", \"ether\"]),\n});\n\nexport type NativeTransferToolParams = typeof NativeTransferToolParams.Type;\n\nexport const NativeTransferTool = Tool.make(\"native_transfer\", {\n dependencies: [McpContext, Web3Service],\n description: \"Transfer Native Tokens to a specified address.\",\n failure: InsufficientPermissions,\n parameters: NativeTransferToolParams,\n success: Schema.String.annotate({\n description: \"The transaction hash of the transfer\",\n }),\n});\n\nexport const nativeTransferToolHandler = (params: NativeTransferToolParams) =>\n Effect.gen(function* () {\n const decimals = () => {\n if (params.unit === \"wei\") return 1;\n if (params.unit === \"gwei\") return 9;\n return 18;\n };\n\n const amount = parseUnits(params.amount.toString(), decimals());\n const chain = getChain(params.chain);\n\n const batches: Batch[] = [\n {\n chainId: chain.id,\n calls: [\n {\n to: params.address,\n value: amount,\n data: \"0x\",\n },\n ],\n },\n ];\n\n const client = yield* getSessionKeyClient({\n operation: {\n intent: \"transaction\",\n batches,\n },\n });\n\n const txHashes = yield* Effect.promise(() =>\n executeTransaction({\n clients: [client],\n batches,\n }),\n );\n\n return txHashes[0]?.receipt.transactionHash as Hex;\n });\n"],"mappings":";;;;;;;;;;;;;;AAWA,MAAa,2BAA2B,OAAO,OAAO;CACpD,OAAO,eAAe,SAAS,EAC7B,aAAa,qCACd,CAAC;CACF,SAAS,gBAAgB,SAAS,EAChC,aAAa,uCACd,CAAC;CACF,QAAQ,OAAO,OAAO,SAAS,EAC7B,aAAa,2CACd,CAAC;CACF,MAAM,OAAO,SAAS;EAAC;EAAO;EAAQ;EAAQ,CAAC;CAChD,CAAC;AAIF,MAAa,qBAAqB,KAAK,KAAK,mBAAmB;CAC7D,cAAc,CAAC,YAAY,YAAY;CACvC,aAAa;CACb,SAAS;CACT,YAAY;CACZ,SAAS,OAAO,OAAO,SAAS,EAC9B,aAAa,wCACd,CAAC;CACH,CAAC;AAEF,MAAa,6BAA6B,WACxC,OAAO,IAAI,aAAa;CACtB,MAAM,iBAAiB;AACrB,MAAI,OAAO,SAAS,MAAO,QAAO;AAClC,MAAI,OAAO,SAAS,OAAQ,QAAO;AACnC,SAAO;;CAGT,MAAM,SAAS,WAAW,OAAO,OAAO,UAAU,EAAE,UAAU,CAAC;CAG/D,MAAM,UAAmB,CACvB;EACE,SAJU,SAAS,OAAO,MAIjB,CAAM;EACf,OAAO,CACL;GACE,IAAI,OAAO;GACX,OAAO;GACP,MAAM;GACP,CACF;EACF,CACF;CAED,MAAM,SAAS,OAAO,oBAAoB,EACxC,WAAW;EACT,QAAQ;EACR;EACD,EACF,CAAC;AASF,SAAO,OAPiB,OAAO,cAC7B,mBAAmB;EACjB,SAAS,CAAC,OAAO;EACjB;EACD,CAAC,CACH,EAEe,IAAI,QAAQ;EAC5B"}
@@ -1,124 +0,0 @@
1
- #!/usr/bin/env node
2
- import { Schema } from "effect";
3
- import { arbitrum, arbitrumSepolia, arcTestnet, avalanche, avalancheFuji, base, baseSepolia, celo, celoSepolia, mainnet, monad, monadTestnet, optimism, optimismSepolia, polygon, polygonAmoy, scroll, scrollSepolia, sepolia, tempoModerato, unichain, unichainSepolia, zora, zoraSepolia } from "viem/chains";
4
- //#region src/schema/chain.ts
5
- const supportedMainnetChains = {
6
- "eth-mainnet": {
7
- ...mainnet,
8
- key: "eth-mainnet"
9
- },
10
- "opt-mainnet": {
11
- ...optimism,
12
- key: "opt-mainnet"
13
- },
14
- "polygon-mainnet": {
15
- ...polygon,
16
- key: "polygon-mainnet"
17
- },
18
- "arb-mainnet": {
19
- ...arbitrum,
20
- key: "arb-mainnet"
21
- },
22
- "zora-mainnet": {
23
- ...zora,
24
- key: "zora-mainnet"
25
- },
26
- "base-mainnet": {
27
- ...base,
28
- key: "base-mainnet"
29
- },
30
- "avax-mainnet": {
31
- ...avalanche,
32
- key: "avax-mainnet"
33
- },
34
- "unichain-mainnet": {
35
- ...unichain,
36
- key: "unichain-mainnet"
37
- },
38
- "celo-mainnet": {
39
- ...celo,
40
- key: "celo-mainnet"
41
- },
42
- "scroll-mainnet": {
43
- ...scroll,
44
- key: "scroll-mainnet"
45
- },
46
- "monad-mainnet": {
47
- ...monad,
48
- key: "monad-mainnet"
49
- }
50
- };
51
- const supportedTestnetChains = {
52
- "eth-sepolia": {
53
- ...sepolia,
54
- key: "eth-sepolia"
55
- },
56
- "opt-sepolia": {
57
- ...optimismSepolia,
58
- key: "opt-sepolia"
59
- },
60
- "polygon-amoy": {
61
- ...polygonAmoy,
62
- key: "polygon-amoy"
63
- },
64
- "arb-sepolia": {
65
- ...arbitrumSepolia,
66
- key: "arb-sepolia"
67
- },
68
- "zora-sepolia": {
69
- ...zoraSepolia,
70
- key: "zora-sepolia"
71
- },
72
- "base-sepolia": {
73
- ...baseSepolia,
74
- key: "base-sepolia"
75
- },
76
- "tempo-moderato": {
77
- ...tempoModerato,
78
- key: "tempo-moderato"
79
- },
80
- "avax-fuji": {
81
- ...avalancheFuji,
82
- key: "avax-fuji"
83
- },
84
- "unichain-sepolia": {
85
- ...unichainSepolia,
86
- key: "unichain-sepolia"
87
- },
88
- "monad-testnet": {
89
- ...monadTestnet,
90
- key: "monad-testnet"
91
- },
92
- "celo-sepolia": {
93
- ...celoSepolia,
94
- key: "celo-sepolia"
95
- },
96
- "scroll-sepolia": {
97
- ...scrollSepolia,
98
- key: "scroll-sepolia"
99
- },
100
- "arc-testnet": {
101
- ...arcTestnet,
102
- key: "arc-testnet"
103
- }
104
- };
105
- const SupportedChain = Schema.Literals([...Object.keys(supportedMainnetChains), ...Object.keys(supportedTestnetChains)]);
106
- const supportedChains = {
107
- ...supportedMainnetChains,
108
- ...supportedTestnetChains
109
- };
110
- const getChain = (chain) => {
111
- return supportedChains[chain];
112
- };
113
- const getChainFromId = (chainId) => {
114
- return Object.values(supportedChains).find((c) => c.id === chainId);
115
- };
116
- const chainIdToChainName = (chainId) => {
117
- const chain = getChainFromId(chainId);
118
- if (!chain) throw new Error(`Chain with id ${chainId} not found`);
119
- return chain.key;
120
- };
121
- //#endregion
122
- export { SupportedChain, chainIdToChainName, getChain, getChainFromId, supportedChains };
123
-
124
- //# sourceMappingURL=chain.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chain.mjs","names":[],"sources":["../../src/schema/chain.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport {\n arbitrum,\n arbitrumSepolia,\n arcTestnet,\n avalanche,\n avalancheFuji,\n base,\n baseSepolia,\n type Chain,\n celo,\n celoSepolia,\n mainnet,\n monad,\n monadTestnet,\n optimism,\n optimismSepolia,\n polygon,\n polygonAmoy,\n scroll,\n scrollSepolia,\n sepolia,\n tempoModerato,\n unichain,\n unichainSepolia,\n zora,\n zoraSepolia,\n} from \"viem/chains\";\n\nexport type ChainWithMetadata = Chain & {\n key: string;\n};\n\nconst supportedMainnetChains = {\n \"eth-mainnet\": {\n ...mainnet,\n key: \"eth-mainnet\",\n },\n \"opt-mainnet\": {\n ...optimism,\n key: \"opt-mainnet\",\n },\n \"polygon-mainnet\": {\n ...polygon,\n key: \"polygon-mainnet\",\n },\n \"arb-mainnet\": {\n ...arbitrum,\n key: \"arb-mainnet\",\n },\n \"zora-mainnet\": {\n ...zora,\n key: \"zora-mainnet\",\n },\n \"base-mainnet\": {\n ...base,\n key: \"base-mainnet\",\n },\n \"avax-mainnet\": {\n ...avalanche,\n key: \"avax-mainnet\",\n },\n \"unichain-mainnet\": {\n ...unichain,\n key: \"unichain-mainnet\",\n },\n \"celo-mainnet\": {\n ...celo,\n key: \"celo-mainnet\",\n },\n \"scroll-mainnet\": {\n ...scroll,\n key: \"scroll-mainnet\",\n },\n \"monad-mainnet\": {\n ...monad,\n key: \"monad-mainnet\",\n },\n} as const;\n\nconst supportedTestnetChains = {\n \"eth-sepolia\": {\n ...sepolia,\n key: \"eth-sepolia\",\n },\n \"opt-sepolia\": {\n ...optimismSepolia,\n key: \"opt-sepolia\",\n },\n \"polygon-amoy\": {\n ...polygonAmoy,\n key: \"polygon-amoy\",\n },\n \"arb-sepolia\": {\n ...arbitrumSepolia,\n key: \"arb-sepolia\",\n },\n \"zora-sepolia\": {\n ...zoraSepolia,\n key: \"zora-sepolia\",\n },\n \"base-sepolia\": {\n ...baseSepolia,\n key: \"base-sepolia\",\n },\n \"tempo-moderato\": {\n ...tempoModerato,\n key: \"tempo-moderato\",\n },\n \"avax-fuji\": {\n ...avalancheFuji,\n key: \"avax-fuji\",\n },\n \"unichain-sepolia\": {\n ...unichainSepolia,\n key: \"unichain-sepolia\",\n },\n \"monad-testnet\": {\n ...monadTestnet,\n key: \"monad-testnet\",\n },\n \"celo-sepolia\": {\n ...celoSepolia,\n key: \"celo-sepolia\",\n },\n \"scroll-sepolia\": {\n ...scrollSepolia,\n key: \"scroll-sepolia\",\n },\n \"arc-testnet\": {\n ...arcTestnet,\n key: \"arc-testnet\",\n },\n} as const;\n\ntype SupportedTestnetChain = keyof typeof supportedMainnetChains;\ntype SupportedMainnetChain = keyof typeof supportedTestnetChains;\n\nexport const SupportedChain = Schema.Literals([\n ...(Object.keys(supportedMainnetChains) as SupportedMainnetChain[]),\n ...(Object.keys(supportedTestnetChains) as SupportedTestnetChain[]),\n]);\n\nexport type SupportedChain = typeof SupportedChain.Type;\n\nexport const supportedChains = {\n ...supportedMainnetChains,\n ...supportedTestnetChains,\n} as Record<SupportedChain, ChainWithMetadata>;\n\nexport const getChain = (chain: SupportedChain): ChainWithMetadata => {\n return supportedChains[chain];\n};\n\nexport const getChainFromId = (\n chainId: number,\n): ChainWithMetadata | undefined => {\n return Object.values(supportedChains).find((c) => c.id === chainId);\n};\n\nexport const chainIdToChainName = (chainId: number) => {\n const chain = getChainFromId(chainId);\n\n if (!chain) {\n throw new Error(`Chain with id ${chainId} not found`);\n }\n\n return chain.key as SupportedChain;\n};\n"],"mappings":";;;;AAiCA,MAAM,yBAAyB;CAC7B,eAAe;EACb,GAAG;EACH,KAAK;EACN;CACD,eAAe;EACb,GAAG;EACH,KAAK;EACN;CACD,mBAAmB;EACjB,GAAG;EACH,KAAK;EACN;CACD,eAAe;EACb,GAAG;EACH,KAAK;EACN;CACD,gBAAgB;EACd,GAAG;EACH,KAAK;EACN;CACD,gBAAgB;EACd,GAAG;EACH,KAAK;EACN;CACD,gBAAgB;EACd,GAAG;EACH,KAAK;EACN;CACD,oBAAoB;EAClB,GAAG;EACH,KAAK;EACN;CACD,gBAAgB;EACd,GAAG;EACH,KAAK;EACN;CACD,kBAAkB;EAChB,GAAG;EACH,KAAK;EACN;CACD,iBAAiB;EACf,GAAG;EACH,KAAK;EACN;CACF;AAED,MAAM,yBAAyB;CAC7B,eAAe;EACb,GAAG;EACH,KAAK;EACN;CACD,eAAe;EACb,GAAG;EACH,KAAK;EACN;CACD,gBAAgB;EACd,GAAG;EACH,KAAK;EACN;CACD,eAAe;EACb,GAAG;EACH,KAAK;EACN;CACD,gBAAgB;EACd,GAAG;EACH,KAAK;EACN;CACD,gBAAgB;EACd,GAAG;EACH,KAAK;EACN;CACD,kBAAkB;EAChB,GAAG;EACH,KAAK;EACN;CACD,aAAa;EACX,GAAG;EACH,KAAK;EACN;CACD,oBAAoB;EAClB,GAAG;EACH,KAAK;EACN;CACD,iBAAiB;EACf,GAAG;EACH,KAAK;EACN;CACD,gBAAgB;EACd,GAAG;EACH,KAAK;EACN;CACD,kBAAkB;EAChB,GAAG;EACH,KAAK;EACN;CACD,eAAe;EACb,GAAG;EACH,KAAK;EACN;CACF;AAKD,MAAa,iBAAiB,OAAO,SAAS,CAC5C,GAAI,OAAO,KAAK,uBAAuB,EACvC,GAAI,OAAO,KAAK,uBAAuB,CACxC,CAAC;AAIF,MAAa,kBAAkB;CAC7B,GAAG;CACH,GAAG;CACJ;AAED,MAAa,YAAY,UAA6C;AACpE,QAAO,gBAAgB;;AAGzB,MAAa,kBACX,YACkC;AAClC,QAAO,OAAO,OAAO,gBAAgB,CAAC,MAAM,MAAM,EAAE,OAAO,QAAQ;;AAGrE,MAAa,sBAAsB,YAAoB;CACrD,MAAM,QAAQ,eAAe,QAAQ;AAErC,KAAI,CAAC,MACH,OAAM,IAAI,MAAM,iBAAiB,QAAQ,YAAY;AAGvD,QAAO,MAAM"}
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env node
2
- import { Schema, SchemaTransformation } from "effect";
3
- //#region src/schema/common.ts
4
- const BigIntFromString = Schema.String.pipe(Schema.decodeTo(Schema.BigInt, SchemaTransformation.transform({
5
- encode: (v) => v.toString(),
6
- decode: (v) => BigInt(v)
7
- })));
8
- const EthereumAddress = Schema.TemplateLiteral(["0x", Schema.String.check(Schema.isPattern(/^[0-9a-fA-F]{40}$/))]);
9
- const Hex = Schema.TemplateLiteral(["0x", Schema.String.check(Schema.isPattern(/^[0-9a-fA-F]*$/))]);
10
- const EntrypointVersion = Schema.Literals([
11
- "0.7",
12
- "0.8",
13
- "0.9"
14
- ]);
15
- const KernelVersion = Schema.Literals([
16
- "0.3.0",
17
- "0.3.1",
18
- "0.3.2",
19
- "0.3.3"
20
- ]);
21
- const OwnerType = Schema.Literals([
22
- "ecdsa",
23
- "passkey",
24
- "multisig"
25
- ]);
26
- //#endregion
27
- export { BigIntFromString, EntrypointVersion, EthereumAddress, Hex, KernelVersion, OwnerType };
28
-
29
- //# sourceMappingURL=common.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.mjs","names":[],"sources":["../../src/schema/common.ts"],"sourcesContent":["import { Schema, SchemaTransformation } from \"effect\";\n\nexport const BigIntFromString = Schema.String.pipe(\n Schema.decodeTo(\n Schema.BigInt,\n SchemaTransformation.transform({\n encode: (v) => v.toString(),\n decode: (v) => BigInt(v),\n }),\n ),\n);\n\nexport const EthereumAddress = Schema.TemplateLiteral([\n \"0x\",\n Schema.String.check(Schema.isPattern(/^[0-9a-fA-F]{40}$/)),\n]);\n\nexport const Hex = Schema.TemplateLiteral([\n \"0x\",\n Schema.String.check(Schema.isPattern(/^[0-9a-fA-F]*$/)),\n]);\n\nexport const EntrypointVersion = Schema.Literals([\"0.7\", \"0.8\", \"0.9\"]);\nexport const KernelVersion = Schema.Literals([\n \"0.3.0\",\n \"0.3.1\",\n \"0.3.2\",\n \"0.3.3\",\n]);\nexport const OwnerType = Schema.Literals([\"ecdsa\", \"passkey\", \"multisig\"]);\n\nexport type EntrypointVersion = typeof EntrypointVersion.Type;\nexport type KernelVersion = typeof KernelVersion.Type;\nexport type OwnerType = typeof OwnerType.Type;\nexport type Hex = typeof Hex.Type;\nexport type EthereumAddress = typeof EthereumAddress.Type;\n"],"mappings":";;;AAEA,MAAa,mBAAmB,OAAO,OAAO,KAC5C,OAAO,SACL,OAAO,QACP,qBAAqB,UAAU;CAC7B,SAAS,MAAM,EAAE,UAAU;CAC3B,SAAS,MAAM,OAAO,EAAE;CACzB,CAAC,CACH,CACF;AAED,MAAa,kBAAkB,OAAO,gBAAgB,CACpD,MACA,OAAO,OAAO,MAAM,OAAO,UAAU,oBAAoB,CAAC,CAC3D,CAAC;AAEF,MAAa,MAAM,OAAO,gBAAgB,CACxC,MACA,OAAO,OAAO,MAAM,OAAO,UAAU,iBAAiB,CAAC,CACxD,CAAC;AAEF,MAAa,oBAAoB,OAAO,SAAS;CAAC;CAAO;CAAO;CAAM,CAAC;AACvE,MAAa,gBAAgB,OAAO,SAAS;CAC3C;CACA;CACA;CACA;CACD,CAAC;AACF,MAAa,YAAY,OAAO,SAAS;CAAC;CAAS;CAAW;CAAW,CAAC"}
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import "./chain.mjs";
3
- import "./common.mjs";
4
- import "./policy.mjs";
5
- export {};
@@ -1,114 +0,0 @@
1
- #!/usr/bin/env node
2
- import { BigIntFromString, EthereumAddress, Hex } from "./common.mjs";
3
- import { Effect, Schema, Struct } from "effect";
4
- //#region src/schema/policy.ts
5
- const SudoPolicyParams = Schema.Struct({ type: Schema.Literal("sudo") });
6
- const TimestampPolicyParams = Schema.Struct({
7
- type: Schema.Literal("timestamp"),
8
- validAfter: Schema.optional(Schema.Number).pipe(Schema.withDecodingDefault(Effect.succeed(0))).annotate({ description: "The timestamp in seconds after which signer is valid. If not provided, the signer is valid immediately." }),
9
- validUntil: Schema.optional(Schema.Number).pipe(Schema.withDecodingDefault(Effect.succeed(0))).annotate({ description: "The timestamp in seconds until which signer is valid. If not provided, the signer is valid indefinitely." })
10
- });
11
- const SignatureCallerPolicyParams = Schema.Struct({
12
- type: Schema.Literal("signature-caller"),
13
- allowedCallers: Schema.mutable(Schema.Array(EthereumAddress)).annotate({ description: "List of addresses that are allowed to validate messages signed by the signer." })
14
- });
15
- const RateLimitPolicyParams = Schema.Struct({
16
- type: Schema.Literal("rate-limit"),
17
- interval: Schema.optional(Schema.Number).annotate({ description: "Length of interval in seconds" }),
18
- count: Schema.Number.annotate({ description: "The number of calls allowed within the interval" }),
19
- startAt: Schema.optional(Schema.Number).annotate({ description: "The timestamp in seconds at which the rate limit starts. Before this signer cannot sign any UserOperations" })
20
- });
21
- const GasPolicyParams = Schema.Struct({
22
- type: Schema.Literal("gas"),
23
- amount: Schema.optional(BigIntFromString).annotate({ description: "Amount, in wei that the signer can spend on gas, in total across all UserOps it sends." }),
24
- enforcePaymaster: Schema.optional(Schema.Boolean).annotate({
25
- description: "If set to true, enforce that a paymaster must be used.",
26
- default: false
27
- })
28
- });
29
- const CallPolicyVersion = Schema.Literals([
30
- "0.0.1",
31
- "0.0.2",
32
- "0.0.3",
33
- "0.0.4",
34
- "0.0.5"
35
- ]);
36
- const CallType = Schema.Literals([
37
- "call",
38
- "delegatecall",
39
- "batch-call"
40
- ]);
41
- const ParamCondition = Schema.Literals([
42
- "EQUAL",
43
- "GREATER_THAN",
44
- "LESS_THAN",
45
- "GREATER_THAN_OR_EQUAL",
46
- "LESS_THAN_OR_EQUAL",
47
- "NOT_EQUAL",
48
- "ONE_OF",
49
- "SLICE_EQUAL"
50
- ]);
51
- const ConditionValue = Schema.Union([
52
- Schema.Struct({
53
- condition: ParamCondition.pick(["ONE_OF"]),
54
- value: Schema.mutable(Schema.Array(Schema.Any)).annotate({ description: "The value of the argument to use with the operator." })
55
- }),
56
- Schema.Struct({
57
- condition: ParamCondition.pick(["SLICE_EQUAL"]),
58
- value: Schema.Any.annotate({ description: "The value of the argument to use with the operator." }),
59
- start: Schema.Number,
60
- length: Schema.Number
61
- }),
62
- Schema.Struct({
63
- condition: ParamCondition.pick([
64
- "EQUAL",
65
- "GREATER_THAN",
66
- "LESS_THAN",
67
- "GREATER_THAN_OR_EQUAL",
68
- "LESS_THAN_OR_EQUAL",
69
- "NOT_EQUAL",
70
- "SLICE_EQUAL"
71
- ]),
72
- value: Schema.Any.annotate({ description: "The value of the argument to use with the operator." })
73
- }),
74
- Schema.Null
75
- ]);
76
- const ParamRule = Schema.Struct({
77
- condition: ParamCondition,
78
- offset: Schema.Number,
79
- params: Schema.Union([Hex, Schema.mutable(Schema.Array(Hex))])
80
- });
81
- const PermissionCore = Schema.Struct({
82
- callType: Schema.optional(CallType).pipe(Schema.withDecodingDefault(Effect.succeed("call"))).annotate({
83
- description: "The type of call to make",
84
- default: "call"
85
- }),
86
- target: EthereumAddress.annotate({ description: "The target contract to call or address to send ETH to. If this is zeroAddress, then the target can be any contract as long as the ABI matches (or it can be any address if no ABI is specified)" }),
87
- selector: Schema.optional(Hex).annotate({ description: "The function selector if the target is a contract" }),
88
- valueLimit: Schema.optional(BigIntFromString).annotate({ description: "The maximum value in wei that can be sent to the target" }),
89
- rules: Schema.optional(Schema.Array(ParamRule))
90
- });
91
- const PermissionManual = PermissionCore;
92
- const PermissionWithABI = PermissionCore.mapFields(Struct.omit(["rules"])).mapFields(Struct.assign({
93
- abi: Schema.mutable(Schema.Array(Schema.Any)).annotate({ description: "The ABI of the target contract" }),
94
- functionName: Schema.String.annotate({ description: "The function name" }),
95
- args: Schema.optional(Schema.Array(ConditionValue)).annotate({ description: "An array of conditions, each corresponding to an argument, in the order that the arguments are laid out. use null to skip an argument." })
96
- }));
97
- const Permission = Schema.Union([PermissionManual, PermissionWithABI]);
98
- const CallPolicyParams = Schema.Struct({
99
- type: Schema.Literal("call"),
100
- policyVersion: CallPolicyVersion,
101
- permissions: Schema.optional(Schema.Array(Permission))
102
- });
103
- const PolicyParams = Schema.Union([
104
- SudoPolicyParams,
105
- TimestampPolicyParams,
106
- SignatureCallerPolicyParams,
107
- RateLimitPolicyParams,
108
- GasPolicyParams,
109
- CallPolicyParams
110
- ]);
111
- //#endregion
112
- export { CallPolicyParams, CallPolicyVersion, GasPolicyParams, ParamCondition, Permission, PermissionManual, PermissionWithABI, PolicyParams, RateLimitPolicyParams, SignatureCallerPolicyParams, SudoPolicyParams, TimestampPolicyParams };
113
-
114
- //# sourceMappingURL=policy.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"policy.mjs","names":[],"sources":["../../src/schema/policy.ts"],"sourcesContent":["import { Effect, Schema, Struct } from \"effect\";\n\nimport { BigIntFromString, EthereumAddress, Hex } from \"./common\";\n\nexport const SudoPolicyParams = Schema.Struct({\n type: Schema.Literal(\"sudo\"),\n});\n\nexport const TimestampPolicyParams = Schema.Struct({\n type: Schema.Literal(\"timestamp\"),\n validAfter: Schema.optional(Schema.Number)\n .pipe(Schema.withDecodingDefault(Effect.succeed(0)))\n .annotate({\n description:\n \"The timestamp in seconds after which signer is valid. If not provided, the signer is valid immediately.\",\n }),\n validUntil: Schema.optional(Schema.Number)\n .pipe(Schema.withDecodingDefault(Effect.succeed(0)))\n .annotate({\n description:\n \"The timestamp in seconds until which signer is valid. If not provided, the signer is valid indefinitely.\",\n }),\n});\n\nexport const SignatureCallerPolicyParams = Schema.Struct({\n type: Schema.Literal(\"signature-caller\"),\n allowedCallers: Schema.mutable(Schema.Array(EthereumAddress)).annotate({\n description:\n \"List of addresses that are allowed to validate messages signed by the signer.\",\n }),\n});\n\nexport const RateLimitPolicyParams = Schema.Struct({\n type: Schema.Literal(\"rate-limit\"),\n interval: Schema.optional(Schema.Number).annotate({\n description: \"Length of interval in seconds\",\n }),\n count: Schema.Number.annotate({\n description: \"The number of calls allowed within the interval\",\n }),\n startAt: Schema.optional(Schema.Number).annotate({\n description:\n \"The timestamp in seconds at which the rate limit starts. Before this signer cannot sign any UserOperations\",\n }),\n});\n\nexport const GasPolicyParams = Schema.Struct({\n type: Schema.Literal(\"gas\"),\n amount: Schema.optional(BigIntFromString).annotate({\n description:\n \"Amount, in wei that the signer can spend on gas, in total across all UserOps it sends.\",\n }),\n enforcePaymaster: Schema.optional(Schema.Boolean).annotate({\n description: \"If set to true, enforce that a paymaster must be used.\",\n default: false,\n }),\n});\n\nexport const CallPolicyVersion = Schema.Literals([\n \"0.0.1\",\n \"0.0.2\",\n \"0.0.3\",\n \"0.0.4\",\n \"0.0.5\",\n]);\n\nexport type CallPolicyVersion = typeof CallPolicyVersion.Type;\n\nconst CallType = Schema.Literals([\"call\", \"delegatecall\", \"batch-call\"]);\n\nexport const ParamCondition = Schema.Literals([\n \"EQUAL\",\n \"GREATER_THAN\",\n \"LESS_THAN\",\n \"GREATER_THAN_OR_EQUAL\",\n \"LESS_THAN_OR_EQUAL\",\n \"NOT_EQUAL\",\n \"ONE_OF\",\n \"SLICE_EQUAL\",\n]);\n\nexport type ParamCondition = typeof ParamCondition.Type;\n\nconst ConditionValue = Schema.Union([\n Schema.Struct({\n condition: ParamCondition.pick([\"ONE_OF\"]),\n value: Schema.mutable(Schema.Array(Schema.Any)).annotate({\n description: \"The value of the argument to use with the operator.\",\n }),\n }),\n Schema.Struct({\n condition: ParamCondition.pick([\"SLICE_EQUAL\"]),\n value: Schema.Any.annotate({\n description: \"The value of the argument to use with the operator.\",\n }),\n start: Schema.Number,\n length: Schema.Number,\n }),\n Schema.Struct({\n condition: ParamCondition.pick([\n \"EQUAL\",\n \"GREATER_THAN\",\n \"LESS_THAN\",\n \"GREATER_THAN_OR_EQUAL\",\n \"LESS_THAN_OR_EQUAL\",\n \"NOT_EQUAL\",\n \"SLICE_EQUAL\",\n ]),\n value: Schema.Any.annotate({\n description: \"The value of the argument to use with the operator.\",\n }),\n }),\n Schema.Null,\n]);\n\nconst ParamRule = Schema.Struct({\n condition: ParamCondition,\n offset: Schema.Number,\n params: Schema.Union([Hex, Schema.mutable(Schema.Array(Hex))]),\n});\n\nconst PermissionCore = Schema.Struct({\n callType: Schema.optional(CallType)\n .pipe(Schema.withDecodingDefault(Effect.succeed(\"call\")))\n .annotate({\n description: \"The type of call to make\",\n default: \"call\",\n }),\n target: EthereumAddress.annotate({\n description:\n \"The target contract to call or address to send ETH to. If this is zeroAddress, then the target can be any contract as long as the ABI matches (or it can be any address if no ABI is specified)\",\n }),\n selector: Schema.optional(Hex).annotate({\n description: \"The function selector if the target is a contract\",\n }),\n valueLimit: Schema.optional(BigIntFromString).annotate({\n description: \"The maximum value in wei that can be sent to the target\",\n }),\n rules: Schema.optional(Schema.Array(ParamRule)),\n});\n\nexport const PermissionManual = PermissionCore;\n\nexport const PermissionWithABI = PermissionCore.mapFields(\n Struct.omit([\"rules\"]),\n).mapFields(\n Struct.assign({\n abi: Schema.mutable(Schema.Array(Schema.Any)).annotate({\n description: \"The ABI of the target contract\",\n }),\n functionName: Schema.String.annotate({\n description: \"The function name\",\n }),\n args: Schema.optional(Schema.Array(ConditionValue)).annotate({\n description:\n \"An array of conditions, each corresponding to an argument, in the order that the arguments are laid out. use null to skip an argument.\",\n }),\n }),\n);\n\nexport const Permission = Schema.Union([PermissionManual, PermissionWithABI]);\n\nexport type PermissionManual = typeof PermissionManual.Type;\nexport type PermissionWithABI = typeof PermissionWithABI.Type;\nexport type Permission = typeof Permission.Type;\n\nexport const CallPolicyParams = Schema.Struct({\n type: Schema.Literal(\"call\"),\n policyVersion: CallPolicyVersion,\n permissions: Schema.optional(Schema.Array(Permission)),\n});\n\nexport const PolicyParams = Schema.Union([\n SudoPolicyParams,\n TimestampPolicyParams,\n SignatureCallerPolicyParams,\n RateLimitPolicyParams,\n GasPolicyParams,\n CallPolicyParams,\n]);\n\nexport type SudoPolicyParams = typeof SudoPolicyParams.Type;\nexport type TimestampPolicyParams = typeof TimestampPolicyParams.Type;\nexport type SignatureCallerPolicyParams =\n typeof SignatureCallerPolicyParams.Type;\nexport type RateLimitPolicyParams = typeof RateLimitPolicyParams.Type;\nexport type GasPolicyParams = typeof GasPolicyParams.Type;\nexport type CallPolicyParams = typeof CallPolicyParams.Type;\nexport type PolicyParams = typeof PolicyParams.Type;\n"],"mappings":"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"}
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env node
2
- import { BigIntFromString, EthereumAddress, Hex } from "./common.mjs";
3
- import { Schema } from "effect";
4
- //#region src/schema/tx.ts
5
- const Call = Schema.Struct({
6
- to: EthereumAddress.annotate({ description: "The target address to call" }),
7
- data: Hex.annotate({ description: "The data to send with the call" }),
8
- value: Schema.optional(BigIntFromString).annotate({ description: "The value to send with the call" })
9
- });
10
- const Batch = Schema.Struct({
11
- chainId: Schema.Int.annotate({ description: "The chain ID to execute the transaction on" }),
12
- nonceKey: Schema.optional(Schema.String).annotate({ description: "The nonce key to use, for 2D Parallel transactions." }),
13
- calls: Schema.mutable(Schema.Array(Call))
14
- });
15
- Schema.Struct({ batches: Schema.mutable(Schema.Array(Batch)) });
16
- //#endregion
17
- export { Batch };
18
-
19
- //# sourceMappingURL=tx.mjs.map