@openzeppelin/contracts-mcp 0.5.9 → 0.6.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 (153) hide show
  1. package/README.md +20 -1
  2. package/apps/cairo-account.html +20 -0
  3. package/apps/cairo-custom.html +20 -0
  4. package/apps/cairo-erc1155.html +20 -0
  5. package/apps/cairo-erc20.html +20 -0
  6. package/apps/cairo-erc721.html +20 -0
  7. package/apps/cairo-governor.html +20 -0
  8. package/apps/cairo-multisig.html +20 -0
  9. package/apps/cairo-vesting.html +20 -0
  10. package/apps/confidential-erc7984.html +20 -0
  11. package/apps/solidity-account.html +22 -0
  12. package/apps/solidity-custom.html +22 -0
  13. package/apps/solidity-erc1155.html +22 -0
  14. package/apps/solidity-erc20.html +22 -0
  15. package/apps/solidity-erc721.html +22 -0
  16. package/apps/solidity-governor.html +22 -0
  17. package/apps/solidity-rwa.html +22 -0
  18. package/apps/solidity-stablecoin.html +22 -0
  19. package/apps/stellar-fungible.html +20 -0
  20. package/apps/stellar-governor.html +20 -0
  21. package/apps/stellar-non-fungible.html +20 -0
  22. package/apps/stellar-stablecoin.html +20 -0
  23. package/apps/stellar-vault.html +20 -0
  24. package/apps/stylus-erc1155.html +20 -0
  25. package/apps/stylus-erc20.html +20 -0
  26. package/apps/stylus-erc721.html +20 -0
  27. package/apps/uniswap-hooks.html +20 -0
  28. package/dist/apps/register.d.ts +50 -0
  29. package/dist/apps/register.d.ts.map +1 -0
  30. package/dist/apps/register.js +129 -0
  31. package/dist/apps/register.js.map +1 -0
  32. package/dist/cairo/tools/account.d.ts.map +1 -1
  33. package/dist/cairo/tools/account.js +7 -9
  34. package/dist/cairo/tools/account.js.map +1 -1
  35. package/dist/cairo/tools/custom.d.ts.map +1 -1
  36. package/dist/cairo/tools/custom.js +7 -9
  37. package/dist/cairo/tools/custom.js.map +1 -1
  38. package/dist/cairo/tools/erc1155.d.ts.map +1 -1
  39. package/dist/cairo/tools/erc1155.js +7 -9
  40. package/dist/cairo/tools/erc1155.js.map +1 -1
  41. package/dist/cairo/tools/erc20.d.ts.map +1 -1
  42. package/dist/cairo/tools/erc20.js +7 -9
  43. package/dist/cairo/tools/erc20.js.map +1 -1
  44. package/dist/cairo/tools/erc721.d.ts.map +1 -1
  45. package/dist/cairo/tools/erc721.js +7 -9
  46. package/dist/cairo/tools/erc721.js.map +1 -1
  47. package/dist/cairo/tools/governor.d.ts.map +1 -1
  48. package/dist/cairo/tools/governor.js +7 -9
  49. package/dist/cairo/tools/governor.js.map +1 -1
  50. package/dist/cairo/tools/multisig.d.ts.map +1 -1
  51. package/dist/cairo/tools/multisig.js +7 -9
  52. package/dist/cairo/tools/multisig.js.map +1 -1
  53. package/dist/cairo/tools/vesting.d.ts.map +1 -1
  54. package/dist/cairo/tools/vesting.js +7 -9
  55. package/dist/cairo/tools/vesting.js.map +1 -1
  56. package/dist/cli.js +0 -0
  57. package/dist/confidential/tools/erc7984.d.ts.map +1 -1
  58. package/dist/confidential/tools/erc7984.js +7 -9
  59. package/dist/confidential/tools/erc7984.js.map +1 -1
  60. package/dist/server.d.ts.map +1 -1
  61. package/dist/server.js +5 -0
  62. package/dist/server.js.map +1 -1
  63. package/dist/solidity/tools/account.d.ts.map +1 -1
  64. package/dist/solidity/tools/account.js +7 -9
  65. package/dist/solidity/tools/account.js.map +1 -1
  66. package/dist/solidity/tools/custom.d.ts.map +1 -1
  67. package/dist/solidity/tools/custom.js +7 -9
  68. package/dist/solidity/tools/custom.js.map +1 -1
  69. package/dist/solidity/tools/erc1155.d.ts.map +1 -1
  70. package/dist/solidity/tools/erc1155.js +9 -9
  71. package/dist/solidity/tools/erc1155.js.map +1 -1
  72. package/dist/solidity/tools/erc20.d.ts.map +1 -1
  73. package/dist/solidity/tools/erc20.js +7 -9
  74. package/dist/solidity/tools/erc20.js.map +1 -1
  75. package/dist/solidity/tools/erc721.d.ts.map +1 -1
  76. package/dist/solidity/tools/erc721.js +9 -9
  77. package/dist/solidity/tools/erc721.js.map +1 -1
  78. package/dist/solidity/tools/governor.d.ts.map +1 -1
  79. package/dist/solidity/tools/governor.js +8 -9
  80. package/dist/solidity/tools/governor.js.map +1 -1
  81. package/dist/solidity/tools/rwa.d.ts +2 -2
  82. package/dist/solidity/tools/rwa.d.ts.map +1 -1
  83. package/dist/solidity/tools/rwa.js +7 -9
  84. package/dist/solidity/tools/rwa.js.map +1 -1
  85. package/dist/solidity/tools/stablecoin.d.ts.map +1 -1
  86. package/dist/solidity/tools/stablecoin.js +7 -9
  87. package/dist/solidity/tools/stablecoin.js.map +1 -1
  88. package/dist/stellar/tools/fungible.d.ts.map +1 -1
  89. package/dist/stellar/tools/fungible.js +7 -9
  90. package/dist/stellar/tools/fungible.js.map +1 -1
  91. package/dist/stellar/tools/governor.d.ts.map +1 -1
  92. package/dist/stellar/tools/governor.js +7 -9
  93. package/dist/stellar/tools/governor.js.map +1 -1
  94. package/dist/stellar/tools/non-fungible.d.ts.map +1 -1
  95. package/dist/stellar/tools/non-fungible.js +7 -9
  96. package/dist/stellar/tools/non-fungible.js.map +1 -1
  97. package/dist/stellar/tools/stablecoin.d.ts.map +1 -1
  98. package/dist/stellar/tools/stablecoin.js +7 -9
  99. package/dist/stellar/tools/stablecoin.js.map +1 -1
  100. package/dist/stellar/tools/vault.d.ts +3 -0
  101. package/dist/stellar/tools/vault.d.ts.map +1 -0
  102. package/dist/stellar/tools/vault.js +28 -0
  103. package/dist/stellar/tools/vault.js.map +1 -0
  104. package/dist/stellar/tools.d.ts.map +1 -1
  105. package/dist/stellar/tools.js +2 -0
  106. package/dist/stellar/tools.js.map +1 -1
  107. package/dist/stylus/tools/erc1155.d.ts.map +1 -1
  108. package/dist/stylus/tools/erc1155.js +7 -9
  109. package/dist/stylus/tools/erc1155.js.map +1 -1
  110. package/dist/stylus/tools/erc20.d.ts.map +1 -1
  111. package/dist/stylus/tools/erc20.js +7 -9
  112. package/dist/stylus/tools/erc20.js.map +1 -1
  113. package/dist/stylus/tools/erc721.d.ts.map +1 -1
  114. package/dist/stylus/tools/erc721.js +7 -9
  115. package/dist/stylus/tools/erc721.js.map +1 -1
  116. package/dist/uniswap-hooks/tools/hooks.d.ts.map +1 -1
  117. package/dist/uniswap-hooks/tools/hooks.js +7 -9
  118. package/dist/uniswap-hooks/tools/hooks.js.map +1 -1
  119. package/dist/utils.d.ts +4 -15
  120. package/dist/utils.d.ts.map +1 -1
  121. package/dist/utils.js +15 -39
  122. package/dist/utils.js.map +1 -1
  123. package/package.json +7 -4
  124. package/src/apps/register.ts +152 -0
  125. package/src/cairo/tools/account.ts +10 -12
  126. package/src/cairo/tools/custom.ts +10 -12
  127. package/src/cairo/tools/erc1155.ts +10 -12
  128. package/src/cairo/tools/erc20.ts +10 -12
  129. package/src/cairo/tools/erc721.ts +10 -12
  130. package/src/cairo/tools/governor.ts +10 -12
  131. package/src/cairo/tools/multisig.ts +10 -12
  132. package/src/cairo/tools/vesting.ts +10 -12
  133. package/src/confidential/tools/erc7984.ts +11 -13
  134. package/src/server.ts +5 -0
  135. package/src/solidity/tools/account.ts +10 -12
  136. package/src/solidity/tools/custom.ts +10 -12
  137. package/src/solidity/tools/erc1155.ts +26 -13
  138. package/src/solidity/tools/erc20.ts +10 -12
  139. package/src/solidity/tools/erc721.ts +14 -12
  140. package/src/solidity/tools/governor.ts +12 -12
  141. package/src/solidity/tools/rwa.ts +12 -14
  142. package/src/solidity/tools/stablecoin.ts +10 -12
  143. package/src/stellar/tools/fungible.ts +10 -12
  144. package/src/stellar/tools/governor.ts +10 -12
  145. package/src/stellar/tools/non-fungible.ts +10 -12
  146. package/src/stellar/tools/stablecoin.ts +10 -12
  147. package/src/stellar/tools/vault.ts +32 -0
  148. package/src/stellar/tools.ts +2 -0
  149. package/src/stylus/tools/erc1155.ts +10 -12
  150. package/src/stylus/tools/erc20.ts +10 -12
  151. package/src/stylus/tools/erc721.ts +10 -12
  152. package/src/uniswap-hooks/tools/hooks.ts +10 -13
  153. package/src/utils.ts +15 -38
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../../../src/stellar/tools/vault.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAQzF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CAuBtE"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerStellarVault = registerStellarVault;
4
+ const wizard_stellar_1 = require("@openzeppelin/wizard-stellar");
5
+ const utils_1 = require("../../utils");
6
+ const schemas_1 = require("@openzeppelin/wizard-common/schemas");
7
+ const wizard_common_1 = require("@openzeppelin/wizard-common");
8
+ const register_1 = require("../../apps/register");
9
+ function registerStellarVault(server) {
10
+ return (0, register_1.registerWizardAppTool)(server, 'stellar-vault', {
11
+ description: (0, utils_1.makeDetailedPrompt)(wizard_common_1.stellarPrompts.Vault),
12
+ inputSchema: schemas_1.stellarVaultSchema,
13
+ title: 'Stellar Vault',
14
+ }, async ({ name, symbol, decimalsOffset, pausable, upgradeable, access, explicitImplementations, info }) => {
15
+ const opts = {
16
+ name,
17
+ symbol,
18
+ decimalsOffset,
19
+ pausable,
20
+ upgradeable,
21
+ access,
22
+ explicitImplementations,
23
+ info,
24
+ };
25
+ return (0, register_1.wizardAppPrintResult)(opts, () => wizard_stellar_1.vault.print(opts), 'rust');
26
+ });
27
+ }
28
+ //# sourceMappingURL=vault.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vault.js","sourceRoot":"","sources":["../../../src/stellar/tools/vault.ts"],"names":[],"mappings":";;AAQA,oDAuBC;AA7BD,iEAAqD;AACrD,uCAAiD;AACjD,iEAAyE;AACzE,+DAA6D;AAC7D,kDAAkF;AAElF,SAAgB,oBAAoB,CAAC,MAAiB;IACpD,OAAO,IAAA,gCAAqB,EAC1B,MAAM,EACN,eAAe,EACf;QACE,WAAW,EAAE,IAAA,0BAAkB,EAAC,8BAAc,CAAC,KAAK,CAAC;QACrD,WAAW,EAAE,4BAAkB;QAC/B,KAAK,EAAE,eAAe;KACvB,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,uBAAuB,EAAE,IAAI,EAAE,EAAE,EAAE;QACvG,MAAM,IAAI,GAAiB;YACzB,IAAI;YACJ,MAAM;YACN,cAAc;YACd,QAAQ;YACR,WAAW;YACX,MAAM;YACN,uBAAuB;YACvB,IAAI;SACL,CAAC;QACF,OAAO,IAAA,+BAAoB,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,sBAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/stellar/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAqBzE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,QAIrD"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/stellar/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAuBzE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,QAIrD"}
@@ -5,12 +5,14 @@ const fungible_js_1 = require("./tools/fungible.js");
5
5
  const governor_js_1 = require("./tools/governor.js");
6
6
  const stablecoin_js_1 = require("./tools/stablecoin.js");
7
7
  const non_fungible_js_1 = require("./tools/non-fungible.js");
8
+ const vault_js_1 = require("./tools/vault.js");
8
9
  function getRegisterFunctions(server) {
9
10
  return {
10
11
  Fungible: () => (0, fungible_js_1.registerStellarFungible)(server),
11
12
  Governor: () => (0, governor_js_1.registerStellarGovernor)(server),
12
13
  Stablecoin: () => (0, stablecoin_js_1.registerStellarStablecoin)(server),
13
14
  NonFungible: () => (0, non_fungible_js_1.registerStellarNonFungible)(server),
15
+ Vault: () => (0, vault_js_1.registerStellarVault)(server),
14
16
  };
15
17
  }
16
18
  function registerStellarTools(server) {
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/stellar/tools.ts"],"names":[],"mappings":";;AAqBA,oDAIC;AAxBD,qDAA8D;AAC9D,qDAA8D;AAC9D,yDAAkE;AAClE,6DAAqE;AAQrE,SAAS,oBAAoB,CAAC,MAAiB;IAC7C,OAAO;QACL,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAA,qCAAuB,EAAC,MAAM,CAAC;QAC/C,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAA,qCAAuB,EAAC,MAAM,CAAC;QAC/C,UAAU,EAAE,GAAG,EAAE,CAAC,IAAA,yCAAyB,EAAC,MAAM,CAAC;QACnD,WAAW,EAAE,GAAG,EAAE,CAAC,IAAA,4CAA0B,EAAC,MAAM,CAAC;KACtD,CAAC;AACJ,CAAC;AAED,SAAgB,oBAAoB,CAAC,MAAiB;IACpD,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;QACjE,YAAY,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/stellar/tools.ts"],"names":[],"mappings":";;AAuBA,oDAIC;AA1BD,qDAA8D;AAC9D,qDAA8D;AAC9D,yDAAkE;AAClE,6DAAqE;AACrE,+CAAwD;AAQxD,SAAS,oBAAoB,CAAC,MAAiB;IAC7C,OAAO;QACL,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAA,qCAAuB,EAAC,MAAM,CAAC;QAC/C,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAA,qCAAuB,EAAC,MAAM,CAAC;QAC/C,UAAU,EAAE,GAAG,EAAE,CAAC,IAAA,yCAAyB,EAAC,MAAM,CAAC;QACnD,WAAW,EAAE,GAAG,EAAE,CAAC,IAAA,4CAA0B,EAAC,MAAM,CAAC;QACrD,KAAK,EAAE,GAAG,EAAE,CAAC,IAAA,+BAAoB,EAAC,MAAM,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,SAAgB,oBAAoB,CAAC,MAAiB;IACpD,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;QACjE,YAAY,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"erc1155.d.ts","sourceRoot":"","sources":["../../../src/stylus/tools/erc1155.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAOzF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CAsBvE"}
1
+ {"version":3,"file":"erc1155.d.ts","sourceRoot":"","sources":["../../../src/stylus/tools/erc1155.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAQzF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CAmBvE"}
@@ -5,22 +5,20 @@ const wizard_stylus_1 = require("@openzeppelin/wizard-stylus");
5
5
  const utils_1 = require("../../utils");
6
6
  const schemas_1 = require("@openzeppelin/wizard-common/schemas");
7
7
  const wizard_common_1 = require("@openzeppelin/wizard-common");
8
+ const register_1 = require("../../apps/register");
8
9
  function registerStylusERC1155(server) {
9
- return server.tool('stylus-erc1155', (0, utils_1.makeDetailedPrompt)(wizard_common_1.stylusPrompts.ERC1155), schemas_1.stylusERC1155Schema, async ({ name, burnable, supply, info }) => {
10
+ return (0, register_1.registerWizardAppTool)(server, 'stylus-erc1155', {
11
+ description: (0, utils_1.makeDetailedPrompt)(wizard_common_1.stylusPrompts.ERC1155),
12
+ inputSchema: schemas_1.stylusERC1155Schema,
13
+ title: 'Stylus ERC1155',
14
+ }, async ({ name, burnable, supply, info }) => {
10
15
  const opts = {
11
16
  name,
12
17
  burnable,
13
18
  supply,
14
19
  info,
15
20
  };
16
- return {
17
- content: [
18
- {
19
- type: 'text',
20
- text: (0, utils_1.safePrintRustCodeBlock)(() => wizard_stylus_1.erc1155.print(opts)),
21
- },
22
- ],
23
- };
21
+ return (0, register_1.wizardAppPrintResult)(opts, () => wizard_stylus_1.erc1155.print(opts), 'rust');
24
22
  });
25
23
  }
26
24
  //# sourceMappingURL=erc1155.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"erc1155.js","sourceRoot":"","sources":["../../../src/stylus/tools/erc1155.ts"],"names":[],"mappings":";;AAOA,sDAsBC;AA3BD,+DAAsD;AACtD,uCAAyE;AACzE,iEAA0E;AAC1E,+DAA4D;AAE5D,SAAgB,qBAAqB,CAAC,MAAiB;IACrD,OAAO,MAAM,CAAC,IAAI,CAChB,gBAAgB,EAChB,IAAA,0BAAkB,EAAC,6BAAa,CAAC,OAAO,CAAC,EACzC,6BAAmB,EACnB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;QACzC,MAAM,IAAI,GAAmB;YAC3B,IAAI;YACJ,QAAQ;YACR,MAAM;YACN,IAAI;SACL,CAAC;QACF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAA,8BAAsB,EAAC,GAAG,EAAE,CAAC,uBAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;iBACxD;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"erc1155.js","sourceRoot":"","sources":["../../../src/stylus/tools/erc1155.ts"],"names":[],"mappings":";;AAQA,sDAmBC;AAzBD,+DAAsD;AACtD,uCAAiD;AACjD,iEAA0E;AAC1E,+DAA4D;AAC5D,kDAAkF;AAElF,SAAgB,qBAAqB,CAAC,MAAiB;IACrD,OAAO,IAAA,gCAAqB,EAC1B,MAAM,EACN,gBAAgB,EAChB;QACE,WAAW,EAAE,IAAA,0BAAkB,EAAC,6BAAa,CAAC,OAAO,CAAC;QACtD,WAAW,EAAE,6BAAmB;QAChC,KAAK,EAAE,gBAAgB;KACxB,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;QACzC,MAAM,IAAI,GAAmB;YAC3B,IAAI;YACJ,QAAQ;YACR,MAAM;YACN,IAAI;SACL,CAAC;QACF,OAAO,IAAA,+BAAoB,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,uBAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IACvE,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"erc20.d.ts","sourceRoot":"","sources":["../../../src/stylus/tools/erc20.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAOzF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CAuBrE"}
1
+ {"version":3,"file":"erc20.d.ts","sourceRoot":"","sources":["../../../src/stylus/tools/erc20.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAQzF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CAoBrE"}
@@ -5,8 +5,13 @@ const wizard_stylus_1 = require("@openzeppelin/wizard-stylus");
5
5
  const utils_1 = require("../../utils");
6
6
  const schemas_1 = require("@openzeppelin/wizard-common/schemas");
7
7
  const wizard_common_1 = require("@openzeppelin/wizard-common");
8
+ const register_1 = require("../../apps/register");
8
9
  function registerStylusERC20(server) {
9
- return server.tool('stylus-erc20', (0, utils_1.makeDetailedPrompt)(wizard_common_1.stylusPrompts.ERC20), schemas_1.stylusERC20Schema, async ({ name, burnable, permit, flashmint, info }) => {
10
+ return (0, register_1.registerWizardAppTool)(server, 'stylus-erc20', {
11
+ description: (0, utils_1.makeDetailedPrompt)(wizard_common_1.stylusPrompts.ERC20),
12
+ inputSchema: schemas_1.stylusERC20Schema,
13
+ title: 'Stylus ERC20',
14
+ }, async ({ name, burnable, permit, flashmint, info }) => {
10
15
  const opts = {
11
16
  name,
12
17
  burnable,
@@ -14,14 +19,7 @@ function registerStylusERC20(server) {
14
19
  flashmint,
15
20
  info,
16
21
  };
17
- return {
18
- content: [
19
- {
20
- type: 'text',
21
- text: (0, utils_1.safePrintRustCodeBlock)(() => wizard_stylus_1.erc20.print(opts)),
22
- },
23
- ],
24
- };
22
+ return (0, register_1.wizardAppPrintResult)(opts, () => wizard_stylus_1.erc20.print(opts), 'rust');
25
23
  });
26
24
  }
27
25
  //# sourceMappingURL=erc20.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../src/stylus/tools/erc20.ts"],"names":[],"mappings":";;AAOA,kDAuBC;AA5BD,+DAAoD;AACpD,uCAAyE;AACzE,iEAAwE;AACxE,+DAA4D;AAE5D,SAAgB,mBAAmB,CAAC,MAAiB;IACnD,OAAO,MAAM,CAAC,IAAI,CAChB,cAAc,EACd,IAAA,0BAAkB,EAAC,6BAAa,CAAC,KAAK,CAAC,EACvC,2BAAiB,EACjB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE;QACpD,MAAM,IAAI,GAAiB;YACzB,IAAI;YACJ,QAAQ;YACR,MAAM;YACN,SAAS;YACT,IAAI;SACL,CAAC;QACF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAA,8BAAsB,EAAC,GAAG,EAAE,CAAC,qBAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;iBACtD;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../src/stylus/tools/erc20.ts"],"names":[],"mappings":";;AAQA,kDAoBC;AA1BD,+DAAoD;AACpD,uCAAiD;AACjD,iEAAwE;AACxE,+DAA4D;AAC5D,kDAAkF;AAElF,SAAgB,mBAAmB,CAAC,MAAiB;IACnD,OAAO,IAAA,gCAAqB,EAC1B,MAAM,EACN,cAAc,EACd;QACE,WAAW,EAAE,IAAA,0BAAkB,EAAC,6BAAa,CAAC,KAAK,CAAC;QACpD,WAAW,EAAE,2BAAiB;QAC9B,KAAK,EAAE,cAAc;KACtB,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE;QACpD,MAAM,IAAI,GAAiB;YACzB,IAAI;YACJ,QAAQ;YACR,MAAM;YACN,SAAS;YACT,IAAI;SACL,CAAC;QACF,OAAO,IAAA,+BAAoB,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,qBAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"erc721.d.ts","sourceRoot":"","sources":["../../../src/stylus/tools/erc721.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAOzF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CAsBtE"}
1
+ {"version":3,"file":"erc721.d.ts","sourceRoot":"","sources":["../../../src/stylus/tools/erc721.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAQzF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CAmBtE"}
@@ -5,22 +5,20 @@ const wizard_stylus_1 = require("@openzeppelin/wizard-stylus");
5
5
  const utils_1 = require("../../utils");
6
6
  const schemas_1 = require("@openzeppelin/wizard-common/schemas");
7
7
  const wizard_common_1 = require("@openzeppelin/wizard-common");
8
+ const register_1 = require("../../apps/register");
8
9
  function registerStylusERC721(server) {
9
- return server.tool('stylus-erc721', (0, utils_1.makeDetailedPrompt)(wizard_common_1.stylusPrompts.ERC721), schemas_1.stylusERC721Schema, async ({ name, burnable, enumerable, info }) => {
10
+ return (0, register_1.registerWizardAppTool)(server, 'stylus-erc721', {
11
+ description: (0, utils_1.makeDetailedPrompt)(wizard_common_1.stylusPrompts.ERC721),
12
+ inputSchema: schemas_1.stylusERC721Schema,
13
+ title: 'Stylus ERC721',
14
+ }, async ({ name, burnable, enumerable, info }) => {
10
15
  const opts = {
11
16
  name,
12
17
  burnable,
13
18
  enumerable,
14
19
  info,
15
20
  };
16
- return {
17
- content: [
18
- {
19
- type: 'text',
20
- text: (0, utils_1.safePrintRustCodeBlock)(() => wizard_stylus_1.erc721.print(opts)),
21
- },
22
- ],
23
- };
21
+ return (0, register_1.wizardAppPrintResult)(opts, () => wizard_stylus_1.erc721.print(opts), 'rust');
24
22
  });
25
23
  }
26
24
  //# sourceMappingURL=erc721.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"erc721.js","sourceRoot":"","sources":["../../../src/stylus/tools/erc721.ts"],"names":[],"mappings":";;AAOA,oDAsBC;AA3BD,+DAAqD;AACrD,uCAAyE;AACzE,iEAAyE;AACzE,+DAA4D;AAE5D,SAAgB,oBAAoB,CAAC,MAAiB;IACpD,OAAO,MAAM,CAAC,IAAI,CAChB,eAAe,EACf,IAAA,0BAAkB,EAAC,6BAAa,CAAC,MAAM,CAAC,EACxC,4BAAkB,EAClB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;QAC7C,MAAM,IAAI,GAAkB;YAC1B,IAAI;YACJ,QAAQ;YACR,UAAU;YACV,IAAI;SACL,CAAC;QACF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAA,8BAAsB,EAAC,GAAG,EAAE,CAAC,sBAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;iBACvD;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"erc721.js","sourceRoot":"","sources":["../../../src/stylus/tools/erc721.ts"],"names":[],"mappings":";;AAQA,oDAmBC;AAzBD,+DAAqD;AACrD,uCAAiD;AACjD,iEAAyE;AACzE,+DAA4D;AAC5D,kDAAkF;AAElF,SAAgB,oBAAoB,CAAC,MAAiB;IACpD,OAAO,IAAA,gCAAqB,EAC1B,MAAM,EACN,eAAe,EACf;QACE,WAAW,EAAE,IAAA,0BAAkB,EAAC,6BAAa,CAAC,MAAM,CAAC;QACrD,WAAW,EAAE,4BAAkB;QAC/B,KAAK,EAAE,eAAe;KACvB,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;QAC7C,MAAM,IAAI,GAAkB;YAC1B,IAAI;YACJ,QAAQ;YACR,UAAU;YACV,IAAI;SACL,CAAC;QACF,OAAO,IAAA,+BAAoB,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,sBAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/uniswap-hooks/tools/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAMzF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CA0CtE"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/uniswap-hooks/tools/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAOzF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CAsCtE"}
@@ -5,8 +5,13 @@ const wizard_uniswap_hooks_1 = require("@openzeppelin/wizard-uniswap-hooks");
5
5
  const schemas_1 = require("@openzeppelin/wizard-common/schemas");
6
6
  const utils_1 = require("../../utils");
7
7
  const wizard_common_1 = require("@openzeppelin/wizard-common");
8
+ const register_1 = require("../../apps/register");
8
9
  function registerUniswapHooks(server) {
9
- return server.tool('uniswap-hooks', (0, utils_1.makeDetailedPrompt)(wizard_common_1.uniswapHooksPrompts.Hooks), schemas_1.uniswapHooksHooksSchema, async ({ hook, name, pausable, currencySettler, safeCast, transientStorage, shares, permissions, inputs, access, info, }) => {
10
+ return (0, register_1.registerWizardAppTool)(server, 'uniswap-hooks', {
11
+ description: (0, utils_1.makeDetailedPrompt)(wizard_common_1.uniswapHooksPrompts.Hooks),
12
+ inputSchema: schemas_1.uniswapHooksHooksSchema,
13
+ title: 'Uniswap Hooks',
14
+ }, async ({ hook, name, pausable, currencySettler, safeCast, transientStorage, shares, permissions, inputs, access, info, }) => {
10
15
  const opts = {
11
16
  hook,
12
17
  name,
@@ -20,14 +25,7 @@ function registerUniswapHooks(server) {
20
25
  access,
21
26
  info,
22
27
  };
23
- return {
24
- content: [
25
- {
26
- type: 'text',
27
- text: (0, utils_1.safePrintSolidityCodeBlock)(() => wizard_uniswap_hooks_1.hooks.print(opts)),
28
- },
29
- ],
30
- };
28
+ return (0, register_1.wizardAppPrintResult)(opts, () => wizard_uniswap_hooks_1.hooks.print(opts), 'solidity');
31
29
  });
32
30
  }
33
31
  //# sourceMappingURL=hooks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/uniswap-hooks/tools/hooks.ts"],"names":[],"mappings":";;AAMA,oDA0CC;AA/CD,6EAA8E;AAC9E,iEAA8E;AAC9E,uCAA6E;AAC7E,+DAAkE;AAElE,SAAgB,oBAAoB,CAAC,MAAiB;IACpD,OAAO,MAAM,CAAC,IAAI,CAChB,eAAe,EACf,IAAA,0BAAkB,EAAC,mCAAmB,CAAC,KAAK,CAAC,EAC7C,iCAAuB,EACvB,KAAK,EAAE,EACL,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,WAAW,EACX,MAAM,EACN,MAAM,EACN,IAAI,GACL,EAAE,EAAE;QACH,MAAM,IAAI,GAAiB;YACzB,IAAI;YACJ,IAAI;YACJ,QAAQ;YACR,eAAe;YACf,QAAQ;YACR,gBAAgB;YAChB,MAAM;YACN,WAAW;YACX,MAAM;YACN,MAAM;YACN,IAAI;SACL,CAAC;QAEF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAA,kCAA0B,EAAC,GAAG,EAAE,CAAC,4BAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;iBAC1D;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/uniswap-hooks/tools/hooks.ts"],"names":[],"mappings":";;AAOA,oDAsCC;AA5CD,6EAA8E;AAC9E,iEAA8E;AAC9E,uCAAiD;AACjD,+DAAkE;AAClE,kDAAkF;AAElF,SAAgB,oBAAoB,CAAC,MAAiB;IACpD,OAAO,IAAA,gCAAqB,EAC1B,MAAM,EACN,eAAe,EACf;QACE,WAAW,EAAE,IAAA,0BAAkB,EAAC,mCAAmB,CAAC,KAAK,CAAC;QAC1D,WAAW,EAAE,iCAAuB;QACpC,KAAK,EAAE,eAAe;KACvB,EACD,KAAK,EAAE,EACL,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,WAAW,EACX,MAAM,EACN,MAAM,EACN,IAAI,GACL,EAAE,EAAE;QACH,MAAM,IAAI,GAAiB;YACzB,IAAI;YACJ,IAAI;YACJ,QAAQ;YACR,eAAe;YACf,QAAQ;YACR,gBAAgB;YAChB,MAAM;YACN,WAAW;YACX,MAAM;YACN,MAAM;YACN,IAAI;SACL,CAAC;QACF,OAAO,IAAA,+BAAoB,EAAC,IAAI,EAAE,GAAG,EAAE,CAAC,4BAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC;IACzE,CAAC,CACF,CAAC;AACJ,CAAC"}
package/dist/utils.d.ts CHANGED
@@ -1,18 +1,7 @@
1
- /**
2
- * Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `solidity`.
3
- * Or prints the error message if an error occurs.
4
- */
5
- export declare function safePrintSolidityCodeBlock(printFn: () => string): string;
6
- /**
7
- * Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `cairo`.
8
- * Or prints the error message if an error occurs.
9
- */
10
- export declare function safePrintCairoCodeBlock(printFn: () => string): string;
11
- /**
12
- * Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `rust`.
13
- * Or prints the error message if an error occurs.
14
- */
15
- export declare function safePrintRustCodeBlock(printFn: () => string): string;
1
+ /** Wraps contract source code in a Markdown code block with the given syntax highlighting. */
2
+ export declare function codeBlock(code: string, syntaxHighlightingLanguage: string): string;
3
+ /** Renders a failed contract print as Markdown, detailing per-field messages for Wizard options errors. */
4
+ export declare function formatPrintError(e: unknown): string;
16
5
  /**
17
6
  * Adds a description to the prompt that explains the return format of the tool.
18
7
  */
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AA0BA;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,MAAM,GAAG,MAAM,CAExE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,MAAM,GAAG,MAAM,CAErE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,MAAM,GAAG,MAAM,CAEpE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAK7D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAKA,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,0BAA0B,EAAE,MAAM,GAAG,MAAM,CAMlF;AAED,2GAA2G;AAC3G,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAUnD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAK7D"}
package/dist/utils.js CHANGED
@@ -1,53 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.safePrintSolidityCodeBlock = safePrintSolidityCodeBlock;
4
- exports.safePrintCairoCodeBlock = safePrintCairoCodeBlock;
5
- exports.safePrintRustCodeBlock = safePrintRustCodeBlock;
3
+ exports.codeBlock = codeBlock;
4
+ exports.formatPrintError = formatPrintError;
6
5
  exports.makeDetailedPrompt = makeDetailedPrompt;
7
6
  const wizard_1 = require("@openzeppelin/wizard");
8
7
  const wizard_cairo_1 = require("@openzeppelin/wizard-cairo");
9
8
  const wizard_stylus_1 = require("@openzeppelin/wizard-stylus");
10
9
  const wizard_stellar_1 = require("@openzeppelin/wizard-stellar");
11
- function safePrintCodeBlock(printFn, syntaxHighlightingLanguage) {
12
- try {
13
- return `\
10
+ /** Wraps contract source code in a Markdown code block with the given syntax highlighting. */
11
+ function codeBlock(code, syntaxHighlightingLanguage) {
12
+ return `\
14
13
  \`\`\`${syntaxHighlightingLanguage}
15
- ${printFn()}
14
+ ${code}
16
15
  \`\`\`
17
16
  `;
18
- }
19
- catch (e) {
20
- if (e instanceof wizard_1.OptionsError ||
21
- e instanceof wizard_cairo_1.OptionsError ||
22
- e instanceof wizard_stylus_1.OptionsError ||
23
- e instanceof wizard_stellar_1.OptionsError) {
24
- return `${e.message}\n\n${JSON.stringify(e.messages, null, 2)}`;
25
- }
26
- else {
27
- return `Unexpected error: ${e}`;
28
- }
29
- }
30
- }
31
- /**
32
- * Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `solidity`.
33
- * Or prints the error message if an error occurs.
34
- */
35
- function safePrintSolidityCodeBlock(printFn) {
36
- return safePrintCodeBlock(printFn, 'solidity');
37
17
  }
38
- /**
39
- * Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `cairo`.
40
- * Or prints the error message if an error occurs.
41
- */
42
- function safePrintCairoCodeBlock(printFn) {
43
- return safePrintCodeBlock(printFn, 'cairo');
44
- }
45
- /**
46
- * Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `rust`.
47
- * Or prints the error message if an error occurs.
48
- */
49
- function safePrintRustCodeBlock(printFn) {
50
- return safePrintCodeBlock(printFn, 'rust');
18
+ /** Renders a failed contract print as Markdown, detailing per-field messages for Wizard options errors. */
19
+ function formatPrintError(e) {
20
+ if (e instanceof wizard_1.OptionsError ||
21
+ e instanceof wizard_cairo_1.OptionsError ||
22
+ e instanceof wizard_stylus_1.OptionsError ||
23
+ e instanceof wizard_stellar_1.OptionsError) {
24
+ return `${e.message}\n\n${JSON.stringify(e.messages, null, 2)}`;
25
+ }
26
+ return `Unexpected error: ${e}`;
51
27
  }
52
28
  /**
53
29
  * Adds a description to the prompt that explains the return format of the tool.
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AA8BA,gEAEC;AAMD,0DAEC;AAMD,wDAEC;AAKD,gDAKC;AA1DD,iDAA4E;AAC5E,6DAA+E;AAC/E,+DAAiF;AACjF,iEAAmF;AAEnF,SAAS,kBAAkB,CAAC,OAAqB,EAAE,0BAAkC;IACnF,IAAI,CAAC;QACH,OAAO;QACH,0BAA0B;EAChC,OAAO,EAAE;;CAEV,CAAC;IACA,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IACE,CAAC,YAAY,qBAAoB;YACjC,CAAC,YAAY,2BAAiB;YAC9B,CAAC,YAAY,4BAAkB;YAC/B,CAAC,YAAY,6BAAmB,EAChC,CAAC;YACD,OAAO,GAAG,CAAC,CAAC,OAAO,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QAClE,CAAC;aAAM,CAAC;YACN,OAAO,qBAAqB,CAAC,EAAE,CAAC;QAClC,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAgB,0BAA0B,CAAC,OAAqB;IAC9D,OAAO,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,OAAqB;IAC3D,OAAO,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,OAAqB;IAC1D,OAAO,kBAAkB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,UAAkB;IACnD,OAAO;EACP,UAAU;;+GAEmG,CAAC;AAChH,CAAC"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AAMA,8BAMC;AAGD,4CAUC;AAKD,gDAKC;AAnCD,iDAA4E;AAC5E,6DAA+E;AAC/E,+DAAiF;AACjF,iEAAmF;AAEnF,8FAA8F;AAC9F,SAAgB,SAAS,CAAC,IAAY,EAAE,0BAAkC;IACxE,OAAO;QACD,0BAA0B;EAChC,IAAI;;CAEL,CAAC;AACF,CAAC;AAED,2GAA2G;AAC3G,SAAgB,gBAAgB,CAAC,CAAU;IACzC,IACE,CAAC,YAAY,qBAAoB;QACjC,CAAC,YAAY,2BAAiB;QAC9B,CAAC,YAAY,4BAAkB;QAC/B,CAAC,YAAY,6BAAmB,EAChC,CAAC;QACD,OAAO,GAAG,CAAC,CAAC,OAAO,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;IAClE,CAAC;IACD,OAAO,qBAAqB,CAAC,EAAE,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,UAAkB;IACnD,OAAO;EACP,UAAU;;+GAEmG,CAAC;AAChH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openzeppelin/contracts-mcp",
3
- "version": "0.5.9",
3
+ "version": "0.6.0",
4
4
  "description": "OpenZeppelin Contracts MCP Server",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": "https://github.com/OpenZeppelin/contracts-wizard",
@@ -13,10 +13,13 @@
13
13
  "NOTICE",
14
14
  "/dist",
15
15
  "/src",
16
+ "/apps",
16
17
  "!**/*.test.*"
17
18
  ],
18
19
  "scripts": {
20
+ "build:apps": "yarn --cwd ../ui build:mcp-apps",
19
21
  "prepare": "tsc",
22
+ "prepublishOnly": "yarn build:apps",
20
23
  "watch": "tsc --watch",
21
24
  "test": "ava",
22
25
  "test:update-snapshots": "ava --update-snapshots",
@@ -24,10 +27,10 @@
24
27
  },
25
28
  "dependencies": {
26
29
  "@modelcontextprotocol/sdk": "^1.29.0",
27
- "@openzeppelin/wizard-common": "^0.5.2",
28
- "@openzeppelin/wizard": "^0.10.10",
30
+ "@openzeppelin/wizard-common": "^0.5.4",
31
+ "@openzeppelin/wizard": "^0.10.12",
29
32
  "@openzeppelin/wizard-stylus": "^0.3.0",
30
- "@openzeppelin/wizard-stellar": "^0.6.1",
33
+ "@openzeppelin/wizard-stellar": "^0.6.3",
31
34
  "@openzeppelin/wizard-cairo": "^3.0.0",
32
35
  "@openzeppelin/wizard-confidential": "^0.1.2",
33
36
  "@openzeppelin/wizard-uniswap-hooks": "^0.1.1"
@@ -0,0 +1,152 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import type { McpServer, RegisteredTool, ToolCallback } from '@modelcontextprotocol/sdk/server/mcp.js';
4
+ import type { ZodRawShapeCompat } from '@modelcontextprotocol/sdk/server/zod-compat.js';
5
+ import { codeBlock, formatPrintError } from '../utils';
6
+
7
+ /** MIME type for MCP Apps HTML resources. */
8
+ export const RESOURCE_MIME_TYPE = 'text/html;profile=mcp-app';
9
+
10
+ const RESOURCE_URI_META_KEY = 'ui/resourceUri';
11
+
12
+ const APPS_DIR = path.join(__dirname, '..', '..', 'apps');
13
+
14
+ export function appResourceUri(toolName: string): string {
15
+ return `ui://openzeppelin/${toolName}.html`;
16
+ }
17
+
18
+ /** Resolve HTML for a tool, throwing build guidance when the artifact is missing. */
19
+ function resolveAppHtmlPath(toolName: string): string {
20
+ const toolPath = path.join(APPS_DIR, `${toolName}.html`);
21
+ if (fs.existsSync(toolPath)) {
22
+ return toolPath;
23
+ }
24
+ throw new Error(
25
+ `MCP App HTML missing for ${toolName} (looked in ${APPS_DIR}). ` +
26
+ `Run: yarn --cwd packages/mcp build:apps ` +
27
+ `(npm consumers: reinstall the package or report a packaging bug).`,
28
+ );
29
+ }
30
+
31
+ /**
32
+ * App HTML is an immutable build artifact, so it is read from disk at most once per tool and then
33
+ * served from memory. Keyed by tool name rather than per request or per session, so the hosted
34
+ * server holds one copy no matter how many sessions open the same app; memory is bounded by the
35
+ * number of tools, not by traffic.
36
+ *
37
+ * The in-flight promise is cached so concurrent first reads share a single disk read, and a failed
38
+ * read is evicted so a transient error cannot poison a tool for the process lifetime.
39
+ *
40
+ * Both properties are asserted by `App HTML reads are async and memoized per tool` in
41
+ * register.test.ts — a synchronous or per-request read is a deliberate test failure, not a
42
+ * refactor. See that test for why the hosted server depends on them.
43
+ */
44
+ const htmlCache = new Map<string, Promise<string>>();
45
+
46
+ export function readAppHtml(toolName: string): Promise<string> {
47
+ const cached = htmlCache.get(toolName);
48
+ if (cached !== undefined) {
49
+ return cached;
50
+ }
51
+ const pending = fs.promises.readFile(resolveAppHtmlPath(toolName), 'utf-8').catch((e: unknown) => {
52
+ htmlCache.delete(toolName);
53
+ throw e;
54
+ });
55
+ htmlCache.set(toolName, pending);
56
+ return pending;
57
+ }
58
+
59
+ /** Register an MCP App UI resource for a tool. */
60
+ function registerWizardAppResource(server: McpServer, toolName: string, options?: { title?: string }): void {
61
+ const uri = appResourceUri(toolName);
62
+ // Fail closed: do not register a UI resource that cannot be served.
63
+ resolveAppHtmlPath(toolName);
64
+ server.registerResource(
65
+ options?.title ?? `${toolName} UI`,
66
+ uri,
67
+ {
68
+ mimeType: RESOURCE_MIME_TYPE,
69
+ description: `Interactive Wizard UI for ${toolName}`,
70
+ },
71
+ async () => ({
72
+ contents: [
73
+ {
74
+ uri,
75
+ mimeType: RESOURCE_MIME_TYPE,
76
+ text: await readAppHtml(toolName),
77
+ },
78
+ ],
79
+ }),
80
+ );
81
+ }
82
+
83
+ type AppToolConfig<Args extends ZodRawShapeCompat> = {
84
+ description: string;
85
+ inputSchema: Args;
86
+ title?: string;
87
+ };
88
+
89
+ /**
90
+ * Register a generation tool with MCP Apps UI metadata and a matching UI resource.
91
+ * Uses SDK `registerTool` / `registerResource` (CJS-safe; no ESM ext-apps import).
92
+ *
93
+ * Requires App HTML on disk (fail closed). Tool callbacks still return markdown text so
94
+ * hosts without MCP Apps support continue to work once the server has started.
95
+ */
96
+ export function registerWizardAppTool<Args extends ZodRawShapeCompat>(
97
+ server: McpServer,
98
+ toolName: string,
99
+ config: AppToolConfig<Args>,
100
+ cb: ToolCallback<Args>,
101
+ ): RegisteredTool {
102
+ const resourceUri = appResourceUri(toolName);
103
+ // Fail closed before advertising UI meta: the resource registration resolves the HTML first.
104
+ registerWizardAppResource(server, toolName, {
105
+ title: config.title,
106
+ });
107
+
108
+ return server.registerTool(
109
+ toolName,
110
+ {
111
+ title: config.title,
112
+ description: config.description,
113
+ inputSchema: config.inputSchema,
114
+ _meta: {
115
+ ui: { resourceUri },
116
+ [RESOURCE_URI_META_KEY]: resourceUri,
117
+ },
118
+ },
119
+ cb,
120
+ );
121
+ }
122
+
123
+ /**
124
+ * Print a contract and build the tool result: a Markdown code block plus raw code for the App on
125
+ * success, or the formatted options error with `isError` on failure. `print` runs exactly once.
126
+ */
127
+ export function wizardAppPrintResult(opts: unknown, print: () => string, syntaxHighlightingLanguage: string) {
128
+ try {
129
+ const code = print();
130
+ return wizardAppResult(opts, codeBlock(code, syntaxHighlightingLanguage), code);
131
+ } catch (e: unknown) {
132
+ return wizardAppResult(opts, formatPrintError(e), undefined, true);
133
+ }
134
+ }
135
+
136
+ /** Build a standard tool result with text for non-Apps hosts and structured data for the App. */
137
+ export function wizardAppResult(opts: unknown, markdownText: string, rawCode?: string, isError?: boolean) {
138
+ return {
139
+ content: [
140
+ {
141
+ type: 'text' as const,
142
+ text: markdownText,
143
+ },
144
+ ],
145
+ structuredContent: {
146
+ opts,
147
+ code: isError ? undefined : rawCode,
148
+ error: isError ? markdownText : undefined,
149
+ },
150
+ ...(isError ? { isError: true as const } : {}),
151
+ };
152
+ }
@@ -1,15 +1,20 @@
1
1
  import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { AccountOptions } from '@openzeppelin/wizard-cairo';
3
3
  import { account } from '@openzeppelin/wizard-cairo';
4
- import { safePrintCairoCodeBlock, makeDetailedPrompt } from '../../utils';
4
+ import { makeDetailedPrompt } from '../../utils';
5
5
  import { cairoAccountSchema } from '@openzeppelin/wizard-common/schemas';
6
6
  import { cairoPrompts } from '@openzeppelin/wizard-common';
7
+ import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
7
8
 
8
9
  export function registerCairoAccount(server: McpServer): RegisteredTool {
9
- return server.tool(
10
+ return registerWizardAppTool(
11
+ server,
10
12
  'cairo-account',
11
- makeDetailedPrompt(cairoPrompts.Account),
12
- cairoAccountSchema,
13
+ {
14
+ description: makeDetailedPrompt(cairoPrompts.Account),
15
+ inputSchema: cairoAccountSchema,
16
+ title: 'Cairo Account',
17
+ },
13
18
  async ({ name, type, declare, deploy, pubkey, outsideExecution, upgradeable, info, macros }) => {
14
19
  const opts: AccountOptions = {
15
20
  name,
@@ -22,14 +27,7 @@ export function registerCairoAccount(server: McpServer): RegisteredTool {
22
27
  info,
23
28
  macros,
24
29
  };
25
- return {
26
- content: [
27
- {
28
- type: 'text',
29
- text: safePrintCairoCodeBlock(() => account.print(opts)),
30
- },
31
- ],
32
- };
30
+ return wizardAppPrintResult(opts, () => account.print(opts), 'cairo');
33
31
  },
34
32
  );
35
33
  }
@@ -1,15 +1,20 @@
1
1
  import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { CustomOptions } from '@openzeppelin/wizard-cairo';
3
3
  import { custom } from '@openzeppelin/wizard-cairo';
4
- import { safePrintCairoCodeBlock, makeDetailedPrompt } from '../../utils';
4
+ import { makeDetailedPrompt } from '../../utils';
5
5
  import { cairoCustomSchema } from '@openzeppelin/wizard-common/schemas';
6
6
  import { cairoPrompts } from '@openzeppelin/wizard-common';
7
+ import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
7
8
 
8
9
  export function registerCairoCustom(server: McpServer): RegisteredTool {
9
- return server.tool(
10
+ return registerWizardAppTool(
11
+ server,
10
12
  'cairo-custom',
11
- makeDetailedPrompt(cairoPrompts.Custom),
12
- cairoCustomSchema,
13
+ {
14
+ description: makeDetailedPrompt(cairoPrompts.Custom),
15
+ inputSchema: cairoCustomSchema,
16
+ title: 'Cairo Custom',
17
+ },
13
18
  async ({ name, pausable, access, upgradeable, info, macros }) => {
14
19
  const opts: CustomOptions = {
15
20
  name,
@@ -19,14 +24,7 @@ export function registerCairoCustom(server: McpServer): RegisteredTool {
19
24
  info,
20
25
  macros,
21
26
  };
22
- return {
23
- content: [
24
- {
25
- type: 'text',
26
- text: safePrintCairoCodeBlock(() => custom.print(opts)),
27
- },
28
- ],
29
- };
27
+ return wizardAppPrintResult(opts, () => custom.print(opts), 'cairo');
30
28
  },
31
29
  );
32
30
  }