@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.
- package/README.md +20 -1
- package/apps/cairo-account.html +20 -0
- package/apps/cairo-custom.html +20 -0
- package/apps/cairo-erc1155.html +20 -0
- package/apps/cairo-erc20.html +20 -0
- package/apps/cairo-erc721.html +20 -0
- package/apps/cairo-governor.html +20 -0
- package/apps/cairo-multisig.html +20 -0
- package/apps/cairo-vesting.html +20 -0
- package/apps/confidential-erc7984.html +20 -0
- package/apps/solidity-account.html +22 -0
- package/apps/solidity-custom.html +22 -0
- package/apps/solidity-erc1155.html +22 -0
- package/apps/solidity-erc20.html +22 -0
- package/apps/solidity-erc721.html +22 -0
- package/apps/solidity-governor.html +22 -0
- package/apps/solidity-rwa.html +22 -0
- package/apps/solidity-stablecoin.html +22 -0
- package/apps/stellar-fungible.html +20 -0
- package/apps/stellar-governor.html +20 -0
- package/apps/stellar-non-fungible.html +20 -0
- package/apps/stellar-stablecoin.html +20 -0
- package/apps/stellar-vault.html +20 -0
- package/apps/stylus-erc1155.html +20 -0
- package/apps/stylus-erc20.html +20 -0
- package/apps/stylus-erc721.html +20 -0
- package/apps/uniswap-hooks.html +20 -0
- package/dist/apps/register.d.ts +50 -0
- package/dist/apps/register.d.ts.map +1 -0
- package/dist/apps/register.js +129 -0
- package/dist/apps/register.js.map +1 -0
- package/dist/cairo/tools/account.d.ts.map +1 -1
- package/dist/cairo/tools/account.js +7 -9
- package/dist/cairo/tools/account.js.map +1 -1
- package/dist/cairo/tools/custom.d.ts.map +1 -1
- package/dist/cairo/tools/custom.js +7 -9
- package/dist/cairo/tools/custom.js.map +1 -1
- package/dist/cairo/tools/erc1155.d.ts.map +1 -1
- package/dist/cairo/tools/erc1155.js +7 -9
- package/dist/cairo/tools/erc1155.js.map +1 -1
- package/dist/cairo/tools/erc20.d.ts.map +1 -1
- package/dist/cairo/tools/erc20.js +7 -9
- package/dist/cairo/tools/erc20.js.map +1 -1
- package/dist/cairo/tools/erc721.d.ts.map +1 -1
- package/dist/cairo/tools/erc721.js +7 -9
- package/dist/cairo/tools/erc721.js.map +1 -1
- package/dist/cairo/tools/governor.d.ts.map +1 -1
- package/dist/cairo/tools/governor.js +7 -9
- package/dist/cairo/tools/governor.js.map +1 -1
- package/dist/cairo/tools/multisig.d.ts.map +1 -1
- package/dist/cairo/tools/multisig.js +7 -9
- package/dist/cairo/tools/multisig.js.map +1 -1
- package/dist/cairo/tools/vesting.d.ts.map +1 -1
- package/dist/cairo/tools/vesting.js +7 -9
- package/dist/cairo/tools/vesting.js.map +1 -1
- package/dist/cli.js +0 -0
- package/dist/confidential/tools/erc7984.d.ts.map +1 -1
- package/dist/confidential/tools/erc7984.js +7 -9
- package/dist/confidential/tools/erc7984.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +5 -0
- package/dist/server.js.map +1 -1
- package/dist/solidity/tools/account.d.ts.map +1 -1
- package/dist/solidity/tools/account.js +7 -9
- package/dist/solidity/tools/account.js.map +1 -1
- package/dist/solidity/tools/custom.d.ts.map +1 -1
- package/dist/solidity/tools/custom.js +7 -9
- package/dist/solidity/tools/custom.js.map +1 -1
- package/dist/solidity/tools/erc1155.d.ts.map +1 -1
- package/dist/solidity/tools/erc1155.js +9 -9
- package/dist/solidity/tools/erc1155.js.map +1 -1
- package/dist/solidity/tools/erc20.d.ts.map +1 -1
- package/dist/solidity/tools/erc20.js +7 -9
- package/dist/solidity/tools/erc20.js.map +1 -1
- package/dist/solidity/tools/erc721.d.ts.map +1 -1
- package/dist/solidity/tools/erc721.js +9 -9
- package/dist/solidity/tools/erc721.js.map +1 -1
- package/dist/solidity/tools/governor.d.ts.map +1 -1
- package/dist/solidity/tools/governor.js +8 -9
- package/dist/solidity/tools/governor.js.map +1 -1
- package/dist/solidity/tools/rwa.d.ts +2 -2
- package/dist/solidity/tools/rwa.d.ts.map +1 -1
- package/dist/solidity/tools/rwa.js +7 -9
- package/dist/solidity/tools/rwa.js.map +1 -1
- package/dist/solidity/tools/stablecoin.d.ts.map +1 -1
- package/dist/solidity/tools/stablecoin.js +7 -9
- package/dist/solidity/tools/stablecoin.js.map +1 -1
- package/dist/stellar/tools/fungible.d.ts.map +1 -1
- package/dist/stellar/tools/fungible.js +7 -9
- package/dist/stellar/tools/fungible.js.map +1 -1
- package/dist/stellar/tools/governor.d.ts.map +1 -1
- package/dist/stellar/tools/governor.js +7 -9
- package/dist/stellar/tools/governor.js.map +1 -1
- package/dist/stellar/tools/non-fungible.d.ts.map +1 -1
- package/dist/stellar/tools/non-fungible.js +7 -9
- package/dist/stellar/tools/non-fungible.js.map +1 -1
- package/dist/stellar/tools/stablecoin.d.ts.map +1 -1
- package/dist/stellar/tools/stablecoin.js +7 -9
- package/dist/stellar/tools/stablecoin.js.map +1 -1
- package/dist/stellar/tools/vault.d.ts +3 -0
- package/dist/stellar/tools/vault.d.ts.map +1 -0
- package/dist/stellar/tools/vault.js +28 -0
- package/dist/stellar/tools/vault.js.map +1 -0
- package/dist/stellar/tools.d.ts.map +1 -1
- package/dist/stellar/tools.js +2 -0
- package/dist/stellar/tools.js.map +1 -1
- package/dist/stylus/tools/erc1155.d.ts.map +1 -1
- package/dist/stylus/tools/erc1155.js +7 -9
- package/dist/stylus/tools/erc1155.js.map +1 -1
- package/dist/stylus/tools/erc20.d.ts.map +1 -1
- package/dist/stylus/tools/erc20.js +7 -9
- package/dist/stylus/tools/erc20.js.map +1 -1
- package/dist/stylus/tools/erc721.d.ts.map +1 -1
- package/dist/stylus/tools/erc721.js +7 -9
- package/dist/stylus/tools/erc721.js.map +1 -1
- package/dist/uniswap-hooks/tools/hooks.d.ts.map +1 -1
- package/dist/uniswap-hooks/tools/hooks.js +7 -9
- package/dist/uniswap-hooks/tools/hooks.js.map +1 -1
- package/dist/utils.d.ts +4 -15
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +15 -39
- package/dist/utils.js.map +1 -1
- package/package.json +7 -4
- package/src/apps/register.ts +152 -0
- package/src/cairo/tools/account.ts +10 -12
- package/src/cairo/tools/custom.ts +10 -12
- package/src/cairo/tools/erc1155.ts +10 -12
- package/src/cairo/tools/erc20.ts +10 -12
- package/src/cairo/tools/erc721.ts +10 -12
- package/src/cairo/tools/governor.ts +10 -12
- package/src/cairo/tools/multisig.ts +10 -12
- package/src/cairo/tools/vesting.ts +10 -12
- package/src/confidential/tools/erc7984.ts +11 -13
- package/src/server.ts +5 -0
- package/src/solidity/tools/account.ts +10 -12
- package/src/solidity/tools/custom.ts +10 -12
- package/src/solidity/tools/erc1155.ts +26 -13
- package/src/solidity/tools/erc20.ts +10 -12
- package/src/solidity/tools/erc721.ts +14 -12
- package/src/solidity/tools/governor.ts +12 -12
- package/src/solidity/tools/rwa.ts +12 -14
- package/src/solidity/tools/stablecoin.ts +10 -12
- package/src/stellar/tools/fungible.ts +10 -12
- package/src/stellar/tools/governor.ts +10 -12
- package/src/stellar/tools/non-fungible.ts +10 -12
- package/src/stellar/tools/stablecoin.ts +10 -12
- package/src/stellar/tools/vault.ts +32 -0
- package/src/stellar/tools.ts +2 -0
- package/src/stylus/tools/erc1155.ts +10 -12
- package/src/stylus/tools/erc20.ts +10 -12
- package/src/stylus/tools/erc721.ts +10 -12
- package/src/uniswap-hooks/tools/hooks.ts +10 -13
- package/src/utils.ts +15 -38
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { StablecoinOptions } from '@openzeppelin/wizard';
|
|
3
3
|
import { stablecoin } from '@openzeppelin/wizard';
|
|
4
|
-
import {
|
|
4
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
5
5
|
import { solidityStablecoinSchema } from '@openzeppelin/wizard-common/schemas';
|
|
6
6
|
import { solidityPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
7
8
|
|
|
8
9
|
export function registerSolidityStablecoin(server: McpServer): RegisteredTool {
|
|
9
|
-
return
|
|
10
|
+
return registerWizardAppTool(
|
|
11
|
+
server,
|
|
10
12
|
'solidity-stablecoin',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
{
|
|
14
|
+
description: makeDetailedPrompt(solidityPrompts.Stablecoin),
|
|
15
|
+
inputSchema: solidityStablecoinSchema,
|
|
16
|
+
title: 'Solidity Stablecoin',
|
|
17
|
+
},
|
|
13
18
|
async ({
|
|
14
19
|
name,
|
|
15
20
|
symbol,
|
|
@@ -50,14 +55,7 @@ export function registerSolidityStablecoin(server: McpServer): RegisteredTool {
|
|
|
50
55
|
restrictions,
|
|
51
56
|
freezable,
|
|
52
57
|
};
|
|
53
|
-
return
|
|
54
|
-
content: [
|
|
55
|
-
{
|
|
56
|
-
type: 'text',
|
|
57
|
-
text: safePrintSolidityCodeBlock(() => stablecoin.print(opts)),
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
};
|
|
58
|
+
return wizardAppPrintResult(opts, () => stablecoin.print(opts), 'solidity');
|
|
61
59
|
},
|
|
62
60
|
);
|
|
63
61
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { FungibleOptions } from '@openzeppelin/wizard-stellar';
|
|
3
3
|
import { fungible } from '@openzeppelin/wizard-stellar';
|
|
4
|
-
import {
|
|
4
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
5
5
|
import { stellarFungibleSchema } from '@openzeppelin/wizard-common/schemas';
|
|
6
6
|
import { stellarPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
7
8
|
|
|
8
9
|
export function registerStellarFungible(server: McpServer): RegisteredTool {
|
|
9
|
-
return
|
|
10
|
+
return registerWizardAppTool(
|
|
11
|
+
server,
|
|
10
12
|
'stellar-fungible',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
{
|
|
14
|
+
description: makeDetailedPrompt(stellarPrompts.Fungible),
|
|
15
|
+
inputSchema: stellarFungibleSchema,
|
|
16
|
+
title: 'Stellar Fungible',
|
|
17
|
+
},
|
|
13
18
|
async ({
|
|
14
19
|
name,
|
|
15
20
|
symbol,
|
|
@@ -38,14 +43,7 @@ export function registerStellarFungible(server: McpServer): RegisteredTool {
|
|
|
38
43
|
info,
|
|
39
44
|
explicitImplementations,
|
|
40
45
|
};
|
|
41
|
-
return
|
|
42
|
-
content: [
|
|
43
|
-
{
|
|
44
|
-
type: 'text',
|
|
45
|
-
text: safePrintRustCodeBlock(() => fungible.print(opts)),
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
};
|
|
46
|
+
return wizardAppPrintResult(opts, () => fungible.print(opts), 'rust');
|
|
49
47
|
},
|
|
50
48
|
);
|
|
51
49
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { GovernorOptions } from '@openzeppelin/wizard-stellar';
|
|
3
3
|
import { governor } from '@openzeppelin/wizard-stellar';
|
|
4
|
-
import {
|
|
4
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
5
5
|
import { stellarGovernorSchema } from '@openzeppelin/wizard-common/schemas';
|
|
6
6
|
import { stellarPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
7
8
|
|
|
8
9
|
export function registerStellarGovernor(server: McpServer): RegisteredTool {
|
|
9
|
-
return
|
|
10
|
+
return registerWizardAppTool(
|
|
11
|
+
server,
|
|
10
12
|
'stellar-governor',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
{
|
|
14
|
+
description: makeDetailedPrompt(stellarPrompts.Governor),
|
|
15
|
+
inputSchema: stellarGovernorSchema,
|
|
16
|
+
title: 'Stellar Governor',
|
|
17
|
+
},
|
|
13
18
|
async ({
|
|
14
19
|
name,
|
|
15
20
|
version,
|
|
@@ -36,14 +41,7 @@ export function registerStellarGovernor(server: McpServer): RegisteredTool {
|
|
|
36
41
|
explicitImplementations,
|
|
37
42
|
info,
|
|
38
43
|
};
|
|
39
|
-
return
|
|
40
|
-
content: [
|
|
41
|
-
{
|
|
42
|
-
type: 'text',
|
|
43
|
-
text: safePrintRustCodeBlock(() => governor.print(opts)),
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
};
|
|
44
|
+
return wizardAppPrintResult(opts, () => governor.print(opts), 'rust');
|
|
47
45
|
},
|
|
48
46
|
);
|
|
49
47
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { NonFungibleOptions } from '@openzeppelin/wizard-stellar';
|
|
3
3
|
import { nonFungible } from '@openzeppelin/wizard-stellar';
|
|
4
|
-
import {
|
|
4
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
5
5
|
import { stellarNonFungibleSchema } from '@openzeppelin/wizard-common/schemas';
|
|
6
6
|
import { stellarPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
7
8
|
|
|
8
9
|
export function registerStellarNonFungible(server: McpServer): RegisteredTool {
|
|
9
|
-
return
|
|
10
|
+
return registerWizardAppTool(
|
|
11
|
+
server,
|
|
10
12
|
'stellar-non-fungible',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
{
|
|
14
|
+
description: makeDetailedPrompt(stellarPrompts.NonFungible),
|
|
15
|
+
inputSchema: stellarNonFungibleSchema,
|
|
16
|
+
title: 'Stellar Non-Fungible',
|
|
17
|
+
},
|
|
13
18
|
async ({
|
|
14
19
|
name,
|
|
15
20
|
symbol,
|
|
@@ -40,14 +45,7 @@ export function registerStellarNonFungible(server: McpServer): RegisteredTool {
|
|
|
40
45
|
info,
|
|
41
46
|
explicitImplementations,
|
|
42
47
|
};
|
|
43
|
-
return
|
|
44
|
-
content: [
|
|
45
|
-
{
|
|
46
|
-
type: 'text',
|
|
47
|
-
text: safePrintRustCodeBlock(() => nonFungible.print(opts)),
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
};
|
|
48
|
+
return wizardAppPrintResult(opts, () => nonFungible.print(opts), 'rust');
|
|
51
49
|
},
|
|
52
50
|
);
|
|
53
51
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { StablecoinOptions } from '@openzeppelin/wizard-stellar';
|
|
3
3
|
import { stablecoin } from '@openzeppelin/wizard-stellar';
|
|
4
|
-
import {
|
|
4
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
5
5
|
import { stellarStablecoinSchema } from '@openzeppelin/wizard-common/schemas';
|
|
6
6
|
import { stellarPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
7
8
|
|
|
8
9
|
export function registerStellarStablecoin(server: McpServer): RegisteredTool {
|
|
9
|
-
return
|
|
10
|
+
return registerWizardAppTool(
|
|
11
|
+
server,
|
|
10
12
|
'stellar-stablecoin',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
{
|
|
14
|
+
description: makeDetailedPrompt(stellarPrompts.Stablecoin),
|
|
15
|
+
inputSchema: stellarStablecoinSchema,
|
|
16
|
+
title: 'Stellar Stablecoin',
|
|
17
|
+
},
|
|
13
18
|
async ({
|
|
14
19
|
name,
|
|
15
20
|
symbol,
|
|
@@ -40,14 +45,7 @@ export function registerStellarStablecoin(server: McpServer): RegisteredTool {
|
|
|
40
45
|
explicitImplementations,
|
|
41
46
|
info,
|
|
42
47
|
};
|
|
43
|
-
return
|
|
44
|
-
content: [
|
|
45
|
-
{
|
|
46
|
-
type: 'text',
|
|
47
|
-
text: safePrintRustCodeBlock(() => stablecoin.print(opts)),
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
};
|
|
48
|
+
return wizardAppPrintResult(opts, () => stablecoin.print(opts), 'rust');
|
|
51
49
|
},
|
|
52
50
|
);
|
|
53
51
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { VaultOptions } from '@openzeppelin/wizard-stellar';
|
|
3
|
+
import { vault } from '@openzeppelin/wizard-stellar';
|
|
4
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { stellarVaultSchema } from '@openzeppelin/wizard-common/schemas';
|
|
6
|
+
import { stellarPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
8
|
+
|
|
9
|
+
export function registerStellarVault(server: McpServer): RegisteredTool {
|
|
10
|
+
return registerWizardAppTool(
|
|
11
|
+
server,
|
|
12
|
+
'stellar-vault',
|
|
13
|
+
{
|
|
14
|
+
description: makeDetailedPrompt(stellarPrompts.Vault),
|
|
15
|
+
inputSchema: stellarVaultSchema,
|
|
16
|
+
title: 'Stellar Vault',
|
|
17
|
+
},
|
|
18
|
+
async ({ name, symbol, decimalsOffset, pausable, upgradeable, access, explicitImplementations, info }) => {
|
|
19
|
+
const opts: VaultOptions = {
|
|
20
|
+
name,
|
|
21
|
+
symbol,
|
|
22
|
+
decimalsOffset,
|
|
23
|
+
pausable,
|
|
24
|
+
upgradeable,
|
|
25
|
+
access,
|
|
26
|
+
explicitImplementations,
|
|
27
|
+
info,
|
|
28
|
+
};
|
|
29
|
+
return wizardAppPrintResult(opts, () => vault.print(opts), 'rust');
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
}
|
package/src/stellar/tools.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { registerStellarFungible } from './tools/fungible.js';
|
|
|
3
3
|
import { registerStellarGovernor } from './tools/governor.js';
|
|
4
4
|
import { registerStellarStablecoin } from './tools/stablecoin.js';
|
|
5
5
|
import { registerStellarNonFungible } from './tools/non-fungible.js';
|
|
6
|
+
import { registerStellarVault } from './tools/vault.js';
|
|
6
7
|
import type { KindedOptions } from '@openzeppelin/wizard-stellar';
|
|
7
8
|
import type { RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
8
9
|
|
|
@@ -16,6 +17,7 @@ function getRegisterFunctions(server: McpServer): StellarToolRegisterFunctions {
|
|
|
16
17
|
Governor: () => registerStellarGovernor(server),
|
|
17
18
|
Stablecoin: () => registerStellarStablecoin(server),
|
|
18
19
|
NonFungible: () => registerStellarNonFungible(server),
|
|
20
|
+
Vault: () => registerStellarVault(server),
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { ERC1155Options } from '@openzeppelin/wizard-stylus';
|
|
3
3
|
import { erc1155 } from '@openzeppelin/wizard-stylus';
|
|
4
|
-
import {
|
|
4
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
5
5
|
import { stylusERC1155Schema } from '@openzeppelin/wizard-common/schemas';
|
|
6
6
|
import { stylusPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
7
8
|
|
|
8
9
|
export function registerStylusERC1155(server: McpServer): RegisteredTool {
|
|
9
|
-
return
|
|
10
|
+
return registerWizardAppTool(
|
|
11
|
+
server,
|
|
10
12
|
'stylus-erc1155',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
{
|
|
14
|
+
description: makeDetailedPrompt(stylusPrompts.ERC1155),
|
|
15
|
+
inputSchema: stylusERC1155Schema,
|
|
16
|
+
title: 'Stylus ERC1155',
|
|
17
|
+
},
|
|
13
18
|
async ({ name, burnable, supply, info }) => {
|
|
14
19
|
const opts: ERC1155Options = {
|
|
15
20
|
name,
|
|
@@ -17,14 +22,7 @@ export function registerStylusERC1155(server: McpServer): RegisteredTool {
|
|
|
17
22
|
supply,
|
|
18
23
|
info,
|
|
19
24
|
};
|
|
20
|
-
return
|
|
21
|
-
content: [
|
|
22
|
-
{
|
|
23
|
-
type: 'text',
|
|
24
|
-
text: safePrintRustCodeBlock(() => erc1155.print(opts)),
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
};
|
|
25
|
+
return wizardAppPrintResult(opts, () => erc1155.print(opts), 'rust');
|
|
28
26
|
},
|
|
29
27
|
);
|
|
30
28
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { ERC20Options } from '@openzeppelin/wizard-stylus';
|
|
3
3
|
import { erc20 } from '@openzeppelin/wizard-stylus';
|
|
4
|
-
import {
|
|
4
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
5
5
|
import { stylusERC20Schema } from '@openzeppelin/wizard-common/schemas';
|
|
6
6
|
import { stylusPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
7
8
|
|
|
8
9
|
export function registerStylusERC20(server: McpServer): RegisteredTool {
|
|
9
|
-
return
|
|
10
|
+
return registerWizardAppTool(
|
|
11
|
+
server,
|
|
10
12
|
'stylus-erc20',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
{
|
|
14
|
+
description: makeDetailedPrompt(stylusPrompts.ERC20),
|
|
15
|
+
inputSchema: stylusERC20Schema,
|
|
16
|
+
title: 'Stylus ERC20',
|
|
17
|
+
},
|
|
13
18
|
async ({ name, burnable, permit, flashmint, info }) => {
|
|
14
19
|
const opts: ERC20Options = {
|
|
15
20
|
name,
|
|
@@ -18,14 +23,7 @@ export function registerStylusERC20(server: McpServer): RegisteredTool {
|
|
|
18
23
|
flashmint,
|
|
19
24
|
info,
|
|
20
25
|
};
|
|
21
|
-
return
|
|
22
|
-
content: [
|
|
23
|
-
{
|
|
24
|
-
type: 'text',
|
|
25
|
-
text: safePrintRustCodeBlock(() => erc20.print(opts)),
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
};
|
|
26
|
+
return wizardAppPrintResult(opts, () => erc20.print(opts), 'rust');
|
|
29
27
|
},
|
|
30
28
|
);
|
|
31
29
|
}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { ERC721Options } from '@openzeppelin/wizard-stylus';
|
|
3
3
|
import { erc721 } from '@openzeppelin/wizard-stylus';
|
|
4
|
-
import {
|
|
4
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
5
5
|
import { stylusERC721Schema } from '@openzeppelin/wizard-common/schemas';
|
|
6
6
|
import { stylusPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
7
8
|
|
|
8
9
|
export function registerStylusERC721(server: McpServer): RegisteredTool {
|
|
9
|
-
return
|
|
10
|
+
return registerWizardAppTool(
|
|
11
|
+
server,
|
|
10
12
|
'stylus-erc721',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
{
|
|
14
|
+
description: makeDetailedPrompt(stylusPrompts.ERC721),
|
|
15
|
+
inputSchema: stylusERC721Schema,
|
|
16
|
+
title: 'Stylus ERC721',
|
|
17
|
+
},
|
|
13
18
|
async ({ name, burnable, enumerable, info }) => {
|
|
14
19
|
const opts: ERC721Options = {
|
|
15
20
|
name,
|
|
@@ -17,14 +22,7 @@ export function registerStylusERC721(server: McpServer): RegisteredTool {
|
|
|
17
22
|
enumerable,
|
|
18
23
|
info,
|
|
19
24
|
};
|
|
20
|
-
return
|
|
21
|
-
content: [
|
|
22
|
-
{
|
|
23
|
-
type: 'text',
|
|
24
|
-
text: safePrintRustCodeBlock(() => erc721.print(opts)),
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
};
|
|
25
|
+
return wizardAppPrintResult(opts, () => erc721.print(opts), 'rust');
|
|
28
26
|
},
|
|
29
27
|
);
|
|
30
28
|
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { hooks, type HooksOptions } from '@openzeppelin/wizard-uniswap-hooks';
|
|
3
3
|
import { uniswapHooksHooksSchema } from '@openzeppelin/wizard-common/schemas';
|
|
4
|
-
import { makeDetailedPrompt
|
|
4
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
5
5
|
import { uniswapHooksPrompts } from '@openzeppelin/wizard-common';
|
|
6
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
6
7
|
|
|
7
8
|
export function registerUniswapHooks(server: McpServer): RegisteredTool {
|
|
8
|
-
return
|
|
9
|
+
return registerWizardAppTool(
|
|
10
|
+
server,
|
|
9
11
|
'uniswap-hooks',
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
{
|
|
13
|
+
description: makeDetailedPrompt(uniswapHooksPrompts.Hooks),
|
|
14
|
+
inputSchema: uniswapHooksHooksSchema,
|
|
15
|
+
title: 'Uniswap Hooks',
|
|
16
|
+
},
|
|
12
17
|
async ({
|
|
13
18
|
hook,
|
|
14
19
|
name,
|
|
@@ -35,15 +40,7 @@ export function registerUniswapHooks(server: McpServer): RegisteredTool {
|
|
|
35
40
|
access,
|
|
36
41
|
info,
|
|
37
42
|
};
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
content: [
|
|
41
|
-
{
|
|
42
|
-
type: 'text',
|
|
43
|
-
text: safePrintSolidityCodeBlock(() => hooks.print(opts)),
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
};
|
|
43
|
+
return wizardAppPrintResult(opts, () => hooks.print(opts), 'solidity');
|
|
47
44
|
},
|
|
48
45
|
);
|
|
49
46
|
}
|
package/src/utils.ts
CHANGED
|
@@ -3,49 +3,26 @@ import { OptionsError as OptionsErrorCairo } from '@openzeppelin/wizard-cairo';
|
|
|
3
3
|
import { OptionsError as OptionsErrorStylus } from '@openzeppelin/wizard-stylus';
|
|
4
4
|
import { OptionsError as OptionsErrorStellar } from '@openzeppelin/wizard-stellar';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/** Wraps contract source code in a Markdown code block with the given syntax highlighting. */
|
|
7
|
+
export function codeBlock(code: string, syntaxHighlightingLanguage: string): string {
|
|
8
|
+
return `\
|
|
9
9
|
\`\`\`${syntaxHighlightingLanguage}
|
|
10
|
-
${
|
|
10
|
+
${code}
|
|
11
11
|
\`\`\`
|
|
12
12
|
`;
|
|
13
|
-
} catch (e) {
|
|
14
|
-
if (
|
|
15
|
-
e instanceof OptionsErrorSolidity ||
|
|
16
|
-
e instanceof OptionsErrorCairo ||
|
|
17
|
-
e instanceof OptionsErrorStylus ||
|
|
18
|
-
e instanceof OptionsErrorStellar
|
|
19
|
-
) {
|
|
20
|
-
return `${e.message}\n\n${JSON.stringify(e.messages, null, 2)}`;
|
|
21
|
-
} else {
|
|
22
|
-
return `Unexpected error: ${e}`;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
13
|
}
|
|
26
14
|
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*/
|
|
39
|
-
export function safePrintCairoCodeBlock(printFn: () => string): string {
|
|
40
|
-
return safePrintCodeBlock(printFn, 'cairo');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `rust`.
|
|
45
|
-
* Or prints the error message if an error occurs.
|
|
46
|
-
*/
|
|
47
|
-
export function safePrintRustCodeBlock(printFn: () => string): string {
|
|
48
|
-
return safePrintCodeBlock(printFn, 'rust');
|
|
15
|
+
/** Renders a failed contract print as Markdown, detailing per-field messages for Wizard options errors. */
|
|
16
|
+
export function formatPrintError(e: unknown): string {
|
|
17
|
+
if (
|
|
18
|
+
e instanceof OptionsErrorSolidity ||
|
|
19
|
+
e instanceof OptionsErrorCairo ||
|
|
20
|
+
e instanceof OptionsErrorStylus ||
|
|
21
|
+
e instanceof OptionsErrorStellar
|
|
22
|
+
) {
|
|
23
|
+
return `${e.message}\n\n${JSON.stringify(e.messages, null, 2)}`;
|
|
24
|
+
}
|
|
25
|
+
return `Unexpected error: ${e}`;
|
|
49
26
|
}
|
|
50
27
|
|
|
51
28
|
/**
|