@openzeppelin/contracts-mcp 0.6.4 → 0.6.6
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 +1 -0
- package/apps/cairo.html +1 -1
- package/apps/confidential.html +1 -1
- package/apps/solidity.html +2 -2
- package/apps/stellar.html +1 -1
- package/apps/stylus.html +1 -1
- package/apps/tron.html +22 -0
- package/apps/uniswap-hooks.html +1 -1
- package/dist/apps/register.d.ts +1 -1
- package/dist/apps/register.d.ts.map +1 -1
- package/dist/apps/register.js +5 -0
- package/dist/apps/register.js.map +1 -1
- package/dist/cli.js +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -2
- package/dist/server.js.map +1 -1
- package/dist/tron/tools/custom.d.ts +3 -0
- package/dist/tron/tools/custom.d.ts.map +1 -0
- package/dist/tron/tools/custom.js +26 -0
- package/dist/tron/tools/custom.js.map +1 -0
- package/dist/tron/tools/erc1155.d.ts +3 -0
- package/dist/tron/tools/erc1155.d.ts.map +1 -0
- package/dist/tron/tools/erc1155.js +33 -0
- package/dist/tron/tools/erc1155.js.map +1 -0
- package/dist/tron/tools/erc20.d.ts +3 -0
- package/dist/tron/tools/erc20.d.ts.map +1 -0
- package/dist/tron/tools/erc20.js +38 -0
- package/dist/tron/tools/erc20.js.map +1 -0
- package/dist/tron/tools/erc721.d.ts +3 -0
- package/dist/tron/tools/erc721.d.ts.map +1 -0
- package/dist/tron/tools/erc721.js +37 -0
- package/dist/tron/tools/erc721.js.map +1 -0
- package/dist/tron/tools/governor.d.ts +3 -0
- package/dist/tron/tools/governor.d.ts.map +1 -0
- package/dist/tron/tools/governor.js +41 -0
- package/dist/tron/tools/governor.js.map +1 -0
- package/dist/tron/tools.d.ts +3 -0
- package/dist/tron/tools.d.ts.map +1 -0
- package/dist/tron/tools.js +21 -0
- package/dist/tron/tools.js.map +1 -0
- package/package.json +3 -3
- package/src/apps/register.ts +7 -1
- package/src/index.ts +1 -0
- package/src/server.ts +2 -0
- package/src/tron/tools/custom.ts +30 -0
- package/src/tron/tools/erc1155.ts +50 -0
- package/src/tron/tools/erc20.ts +60 -0
- package/src/tron/tools/erc721.ts +58 -0
- package/src/tron/tools/governor.ts +69 -0
- package/src/tron/tools.ts +19 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ERC20Options } from '@openzeppelin/wizard';
|
|
3
|
+
import { buildGeneric, printContract, tronPrintProfile, sanitizeTronOptions } from '@openzeppelin/wizard';
|
|
4
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { solidityERC20Schema } from '@openzeppelin/wizard-common/schemas';
|
|
6
|
+
import { tronPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
8
|
+
|
|
9
|
+
export function registerTronTRC20(server: McpServer): RegisteredTool {
|
|
10
|
+
return registerWizardAppTool(
|
|
11
|
+
server,
|
|
12
|
+
'tron-trc20',
|
|
13
|
+
{
|
|
14
|
+
description: makeDetailedPrompt(tronPrompts.TRC20),
|
|
15
|
+
inputSchema: solidityERC20Schema,
|
|
16
|
+
title: 'TRON TRC20',
|
|
17
|
+
},
|
|
18
|
+
async ({
|
|
19
|
+
name,
|
|
20
|
+
symbol,
|
|
21
|
+
decimals,
|
|
22
|
+
burnable,
|
|
23
|
+
pausable,
|
|
24
|
+
premint,
|
|
25
|
+
premintChainId,
|
|
26
|
+
mintable,
|
|
27
|
+
callback,
|
|
28
|
+
permit,
|
|
29
|
+
votes,
|
|
30
|
+
flashmint,
|
|
31
|
+
crossChainBridging,
|
|
32
|
+
crossChainLinkAllowOverride,
|
|
33
|
+
access,
|
|
34
|
+
upgradeable,
|
|
35
|
+
info,
|
|
36
|
+
}) => {
|
|
37
|
+
const opts: ERC20Options = {
|
|
38
|
+
name,
|
|
39
|
+
symbol,
|
|
40
|
+
decimals,
|
|
41
|
+
burnable,
|
|
42
|
+
pausable,
|
|
43
|
+
premint,
|
|
44
|
+
premintChainId,
|
|
45
|
+
mintable,
|
|
46
|
+
callback,
|
|
47
|
+
permit,
|
|
48
|
+
votes,
|
|
49
|
+
flashmint,
|
|
50
|
+
crossChainBridging,
|
|
51
|
+
crossChainLinkAllowOverride,
|
|
52
|
+
access,
|
|
53
|
+
upgradeable,
|
|
54
|
+
info,
|
|
55
|
+
};
|
|
56
|
+
const tronOpts = sanitizeTronOptions({ kind: 'ERC20' as const, ...opts });
|
|
57
|
+
return wizardAppPrintResult(tronOpts, () => printContract(buildGeneric(tronOpts), tronPrintProfile), 'solidity');
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { ERC721Options } from '@openzeppelin/wizard';
|
|
3
|
+
import { buildGeneric, printContract, tronPrintProfile, sanitizeTronOptions } from '@openzeppelin/wizard';
|
|
4
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
5
|
+
import { solidityERC721Schema } from '@openzeppelin/wizard-common/schemas';
|
|
6
|
+
import { tronPrompts } from '@openzeppelin/wizard-common';
|
|
7
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
8
|
+
|
|
9
|
+
export function registerTronTRC721(server: McpServer): RegisteredTool {
|
|
10
|
+
return registerWizardAppTool(
|
|
11
|
+
server,
|
|
12
|
+
'tron-trc721',
|
|
13
|
+
{
|
|
14
|
+
description: makeDetailedPrompt(tronPrompts.TRC721),
|
|
15
|
+
inputSchema: solidityERC721Schema,
|
|
16
|
+
title: 'TRON TRC721',
|
|
17
|
+
},
|
|
18
|
+
async ({
|
|
19
|
+
name,
|
|
20
|
+
symbol,
|
|
21
|
+
baseUri,
|
|
22
|
+
enumerable,
|
|
23
|
+
uriStorage,
|
|
24
|
+
burnable,
|
|
25
|
+
pausable,
|
|
26
|
+
mintable,
|
|
27
|
+
incremental,
|
|
28
|
+
votes,
|
|
29
|
+
crossChainBridging,
|
|
30
|
+
crossChainLinkAllowOverride,
|
|
31
|
+
access,
|
|
32
|
+
upgradeable,
|
|
33
|
+
namespacePrefix,
|
|
34
|
+
info,
|
|
35
|
+
}) => {
|
|
36
|
+
const opts: ERC721Options = {
|
|
37
|
+
name,
|
|
38
|
+
symbol,
|
|
39
|
+
baseUri,
|
|
40
|
+
enumerable,
|
|
41
|
+
uriStorage,
|
|
42
|
+
burnable,
|
|
43
|
+
pausable,
|
|
44
|
+
mintable,
|
|
45
|
+
incremental,
|
|
46
|
+
votes,
|
|
47
|
+
crossChainBridging,
|
|
48
|
+
crossChainLinkAllowOverride,
|
|
49
|
+
access,
|
|
50
|
+
upgradeable,
|
|
51
|
+
namespacePrefix,
|
|
52
|
+
info,
|
|
53
|
+
};
|
|
54
|
+
const tronOpts = sanitizeTronOptions({ kind: 'ERC721' as const, ...opts });
|
|
55
|
+
return wizardAppPrintResult(tronOpts, () => printContract(buildGeneric(tronOpts), tronPrintProfile), 'solidity');
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { GovernorOptions } from '@openzeppelin/wizard';
|
|
3
|
+
import {
|
|
4
|
+
buildGeneric,
|
|
5
|
+
printContract,
|
|
6
|
+
tronPrintProfile,
|
|
7
|
+
TRON_DEFAULT_BLOCK_TIME,
|
|
8
|
+
sanitizeTronOptions,
|
|
9
|
+
} from '@openzeppelin/wizard';
|
|
10
|
+
import { makeDetailedPrompt } from '../../utils';
|
|
11
|
+
import { tronGovernorSchema } from '@openzeppelin/wizard-common/schemas';
|
|
12
|
+
import { tronPrompts } from '@openzeppelin/wizard-common';
|
|
13
|
+
import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
|
|
14
|
+
|
|
15
|
+
export function registerTronGovernor(server: McpServer): RegisteredTool {
|
|
16
|
+
return registerWizardAppTool(
|
|
17
|
+
server,
|
|
18
|
+
'tron-governor',
|
|
19
|
+
{
|
|
20
|
+
description: makeDetailedPrompt(tronPrompts.Governor),
|
|
21
|
+
inputSchema: tronGovernorSchema,
|
|
22
|
+
title: 'TRON Governor',
|
|
23
|
+
},
|
|
24
|
+
async ({
|
|
25
|
+
name,
|
|
26
|
+
delay,
|
|
27
|
+
period,
|
|
28
|
+
votes,
|
|
29
|
+
clockMode,
|
|
30
|
+
timelock,
|
|
31
|
+
blockTime,
|
|
32
|
+
decimals,
|
|
33
|
+
proposalThreshold,
|
|
34
|
+
quorumMode,
|
|
35
|
+
quorumPercent,
|
|
36
|
+
quorumAbsolute,
|
|
37
|
+
storage,
|
|
38
|
+
settings,
|
|
39
|
+
crossChainExecution,
|
|
40
|
+
upgradeable,
|
|
41
|
+
info,
|
|
42
|
+
}) => {
|
|
43
|
+
const opts: GovernorOptions = {
|
|
44
|
+
name,
|
|
45
|
+
delay,
|
|
46
|
+
period,
|
|
47
|
+
votes,
|
|
48
|
+
clockMode,
|
|
49
|
+
timelock,
|
|
50
|
+
// TRON produces blocks every ~3s (vs ~12s on Ethereum); apply that
|
|
51
|
+
// default when the caller hasn't supplied one so the generated
|
|
52
|
+
// voting delay/period in blocks matches TRON's chain.
|
|
53
|
+
blockTime: blockTime ?? TRON_DEFAULT_BLOCK_TIME,
|
|
54
|
+
decimals,
|
|
55
|
+
proposalThreshold,
|
|
56
|
+
quorumMode,
|
|
57
|
+
quorumPercent,
|
|
58
|
+
quorumAbsolute,
|
|
59
|
+
storage,
|
|
60
|
+
settings,
|
|
61
|
+
crossChainExecution,
|
|
62
|
+
upgradeable,
|
|
63
|
+
info,
|
|
64
|
+
};
|
|
65
|
+
const tronOpts = sanitizeTronOptions({ kind: 'Governor' as const, ...opts });
|
|
66
|
+
return wizardAppPrintResult(tronOpts, () => printContract(buildGeneric(tronOpts), tronPrintProfile), 'solidity');
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { registerTronTRC20 } from './tools/erc20.js';
|
|
3
|
+
import { registerTronTRC721 } from './tools/erc721.js';
|
|
4
|
+
import { registerTronTRC1155 } from './tools/erc1155.js';
|
|
5
|
+
import { registerTronGovernor } from './tools/governor.js';
|
|
6
|
+
import { registerTronCustom } from './tools/custom.js';
|
|
7
|
+
|
|
8
|
+
// TRON tools reuse the Solidity schemas (options are identical) and render the
|
|
9
|
+
// output through `tronPrintProfile` so token standards become TRC* and imports
|
|
10
|
+
// resolve from `@openzeppelin/tron-contracts`. Excluded on purpose: Account
|
|
11
|
+
// (ERC-4337 EntryPoint out of scope) and Stablecoin / RealWorldAsset (they
|
|
12
|
+
// depend on @openzeppelin/community-contracts, which is not ported to TRON).
|
|
13
|
+
export function registerTronTools(server: McpServer) {
|
|
14
|
+
registerTronTRC20(server);
|
|
15
|
+
registerTronTRC721(server);
|
|
16
|
+
registerTronTRC1155(server);
|
|
17
|
+
registerTronGovernor(server);
|
|
18
|
+
registerTronCustom(server);
|
|
19
|
+
}
|