@mcp-dockmaster/mcp-cryptowallet-evm 1.0.4 → 1.0.5
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/build/handlers/utils.d.ts +4 -4
- package/build/handlers/utils.js +20 -10
- package/build/handlers/utils.js.map +1 -1
- package/build/handlers/wallet.d.ts +1 -0
- package/build/handlers/wallet.js +64 -70
- package/build/handlers/wallet.js.map +1 -1
- package/build/tools.d.ts +61 -109
- package/build/tools.js +36 -50
- package/build/tools.js.map +1 -1
- package/package.json +1 -1
- package/src/handlers/utils.ts +21 -12
- package/src/handlers/wallet.ts +68 -88
- package/src/tools.ts +37 -50
package/src/handlers/wallet.ts
CHANGED
@@ -1,10 +1,24 @@
|
|
1
|
-
import { ethers } from "ethers";
|
1
|
+
import { ethers, providers } from "ethers";
|
2
2
|
import { ToolResultSchema } from "../types.js";
|
3
|
-
import { createSuccessResponse, createErrorResponse, getProvider, getWallet } from "./utils.js";
|
3
|
+
import { createSuccessResponse, createErrorResponse, getProvider, getWallet, setProvider } from "./utils.js";
|
4
4
|
import { fromPrivateKeyHandlerInput, createMnemonicPhraseHandlerInput } from "./wallet.types.js";
|
5
5
|
import { generateMnemonic, } from '@scure/bip39';
|
6
|
-
// Wallet Creation and Management
|
7
6
|
|
7
|
+
// Provider handlers
|
8
|
+
|
9
|
+
export const setProviderHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
10
|
+
try {
|
11
|
+
setProvider(input.providerURL);
|
12
|
+
return createSuccessResponse({}, `Provider set successfully:
|
13
|
+
Provider URL: ${input.providerURL}
|
14
|
+
`);
|
15
|
+
} catch (error) {
|
16
|
+
return createErrorResponse(`Failed to set provider: ${(error as Error).message}`);
|
17
|
+
}
|
18
|
+
};
|
19
|
+
|
20
|
+
|
21
|
+
// Wallet Creation and Management
|
8
22
|
export const createWalletHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
9
23
|
try {
|
10
24
|
const options: any = {};
|
@@ -50,7 +64,7 @@ export const fromPrivateKeyHandler = async (input: fromPrivateKeyHandlerInput):
|
|
50
64
|
return createErrorResponse("Private key is required");
|
51
65
|
}
|
52
66
|
|
53
|
-
const provider =
|
67
|
+
const provider = getProvider()
|
54
68
|
const wallet = new ethers.Wallet(input.privateKey, provider);
|
55
69
|
|
56
70
|
return createSuccessResponse({
|
@@ -98,7 +112,7 @@ export const fromMnemonicHandler = async (input: any): Promise<ToolResultSchema<
|
|
98
112
|
wordlist: (input.locale && ethers.wordlists[input.locale]) || ethers.wordlists.en
|
99
113
|
};
|
100
114
|
|
101
|
-
const provider =
|
115
|
+
const provider = getProvider();
|
102
116
|
const wallet = ethers.Wallet.fromMnemonic(input.mnemonic, options.path, options.wordlist);
|
103
117
|
|
104
118
|
if (provider) wallet.connect(provider);
|
@@ -129,7 +143,7 @@ export const fromEncryptedJsonHandler = async (input: any): Promise<ToolResultSc
|
|
129
143
|
}
|
130
144
|
|
131
145
|
const wallet = await ethers.Wallet.fromEncryptedJson(input.json, input.password);
|
132
|
-
const provider =
|
146
|
+
const provider = getProvider()
|
133
147
|
|
134
148
|
if (provider) {
|
135
149
|
wallet.connect(provider);
|
@@ -213,11 +227,7 @@ export const getPrivateKeyHandler = async (input: any): Promise<ToolResultSchema
|
|
213
227
|
|
214
228
|
export const getBalanceHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
215
229
|
try {
|
216
|
-
|
217
|
-
return createErrorResponse("Provider URL is required to get balance");
|
218
|
-
}
|
219
|
-
|
220
|
-
const wallet = await getWallet(input.wallet, input.password, input.provider);
|
230
|
+
const wallet = await getWallet(input.wallet, input.password);
|
221
231
|
|
222
232
|
const balance = await wallet.getBalance(input.blockTag ?? "latest");
|
223
233
|
|
@@ -235,10 +245,10 @@ export const getBalanceHandler = async (input: any): Promise<ToolResultSchema<an
|
|
235
245
|
|
236
246
|
export const getChainIdHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
237
247
|
try {
|
238
|
-
const wallet = await getWallet(input.wallet, input.password
|
248
|
+
const wallet = await getWallet(input.wallet, input.password);
|
239
249
|
|
240
250
|
if (!wallet.provider) {
|
241
|
-
return createErrorResponse("Provider is required to get chain ID");
|
251
|
+
return createErrorResponse("Provider is required to get chain ID, please set the provider URL");
|
242
252
|
}
|
243
253
|
|
244
254
|
const chainId = await wallet.getChainId();
|
@@ -255,10 +265,10 @@ export const getChainIdHandler = async (input: any): Promise<ToolResultSchema<an
|
|
255
265
|
|
256
266
|
export const getGasPriceHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
257
267
|
try {
|
258
|
-
const wallet = await getWallet(input.wallet, input.password
|
268
|
+
const wallet = await getWallet(input.wallet, input.password);
|
259
269
|
|
260
270
|
if (!wallet.provider) {
|
261
|
-
return createErrorResponse("Provider is required to get gas price");
|
271
|
+
return createErrorResponse("Provider is required to get gas price, please set the provider URL");
|
262
272
|
}
|
263
273
|
|
264
274
|
const gasPrice = await wallet.getGasPrice();
|
@@ -277,10 +287,10 @@ export const getGasPriceHandler = async (input: any): Promise<ToolResultSchema<a
|
|
277
287
|
|
278
288
|
export const getTransactionCountHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
279
289
|
try {
|
280
|
-
const wallet = await getWallet(input.wallet, input.password
|
290
|
+
const wallet = await getWallet(input.wallet, input.password);
|
281
291
|
|
282
292
|
if (!wallet.provider) {
|
283
|
-
return createErrorResponse("Provider is required to get transaction count");
|
293
|
+
return createErrorResponse("Provider is required to get transaction count, please set the provider URL");
|
284
294
|
}
|
285
295
|
|
286
296
|
const transactionCount = await wallet.getTransactionCount(input.blockTag);
|
@@ -301,10 +311,10 @@ export const callHandler = async (input: any): Promise<ToolResultSchema<any>> =>
|
|
301
311
|
return createErrorResponse("Transaction is required");
|
302
312
|
}
|
303
313
|
|
304
|
-
const wallet = await getWallet(input.wallet, input.password
|
314
|
+
const wallet = await getWallet(input.wallet, input.password);
|
305
315
|
|
306
316
|
if (!wallet.provider) {
|
307
|
-
return createErrorResponse("Provider is required to call a contract");
|
317
|
+
return createErrorResponse("Provider is required to call a contract, please set the provider URL");
|
308
318
|
}
|
309
319
|
|
310
320
|
const result = await wallet.call(input.transaction, input.blockTag);
|
@@ -327,10 +337,9 @@ export const sendTransactionHandler = async (input: any): Promise<ToolResultSche
|
|
327
337
|
return createErrorResponse("Transaction is required");
|
328
338
|
}
|
329
339
|
|
330
|
-
const wallet = await getWallet(input.wallet, input.password
|
331
|
-
|
340
|
+
const wallet = await getWallet(input.wallet, input.password);
|
332
341
|
if (!wallet.provider) {
|
333
|
-
return createErrorResponse("Provider is required to send a transaction");
|
342
|
+
return createErrorResponse("Provider is required to send a transaction, please set the provider URL");
|
334
343
|
}
|
335
344
|
|
336
345
|
const tx = await wallet.sendTransaction(input.transaction);
|
@@ -364,7 +373,7 @@ export const signTransactionHandler = async (input: any): Promise<ToolResultSche
|
|
364
373
|
return createErrorResponse("Transaction is required");
|
365
374
|
}
|
366
375
|
|
367
|
-
const wallet = await getWallet(input.wallet, input.password
|
376
|
+
const wallet = await getWallet(input.wallet, input.password);
|
368
377
|
|
369
378
|
// For signing a transaction, we need to populate it first
|
370
379
|
const populatedTx = await wallet.populateTransaction(input.transaction);
|
@@ -386,10 +395,10 @@ export const populateTransactionHandler = async (input: any): Promise<ToolResult
|
|
386
395
|
return createErrorResponse("Transaction is required");
|
387
396
|
}
|
388
397
|
|
389
|
-
const wallet = await getWallet(input.wallet, input.password
|
398
|
+
const wallet = await getWallet(input.wallet, input.password);
|
390
399
|
|
391
400
|
if (!wallet.provider) {
|
392
|
-
return createErrorResponse("Provider is required to populate a transaction");
|
401
|
+
return createErrorResponse("Provider is required to populate a transaction, please set the provider URL");
|
393
402
|
}
|
394
403
|
|
395
404
|
const populatedTx = await wallet.populateTransaction(input.transaction);
|
@@ -536,15 +545,11 @@ export const verifyTypedDataHandler = async (input: any): Promise<ToolResultSche
|
|
536
545
|
|
537
546
|
export const getBlockHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
538
547
|
try {
|
539
|
-
if (!input.provider) {
|
540
|
-
return createErrorResponse("Provider is required");
|
541
|
-
}
|
542
|
-
|
543
548
|
if (!input.blockHashOrBlockTag) {
|
544
549
|
return createErrorResponse("Block hash or block tag is required");
|
545
550
|
}
|
546
551
|
|
547
|
-
const provider = getProvider(
|
552
|
+
const provider = getProvider();
|
548
553
|
// In ethers.js v5, getBlock can take includeTransactions as a second parameter
|
549
554
|
// but TypeScript definitions might not reflect this
|
550
555
|
const block = await (provider as any).getBlock(input.blockHashOrBlockTag, input.includeTransactions);
|
@@ -564,15 +569,11 @@ export const getBlockHandler = async (input: any): Promise<ToolResultSchema<any>
|
|
564
569
|
|
565
570
|
export const getTransactionHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
566
571
|
try {
|
567
|
-
if (!input.provider) {
|
568
|
-
return createErrorResponse("Provider is required");
|
569
|
-
}
|
570
|
-
|
571
572
|
if (!input.transactionHash) {
|
572
573
|
return createErrorResponse("Transaction hash is required");
|
573
574
|
}
|
574
575
|
|
575
|
-
const provider = getProvider(
|
576
|
+
const provider = getProvider();
|
576
577
|
const transaction = await provider.getTransaction(input.transactionHash);
|
577
578
|
|
578
579
|
return createSuccessResponse({
|
@@ -588,15 +589,11 @@ export const getTransactionHandler = async (input: any): Promise<ToolResultSchem
|
|
588
589
|
|
589
590
|
export const getTransactionReceiptHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
590
591
|
try {
|
591
|
-
if (!input.provider) {
|
592
|
-
return createErrorResponse("Provider is required");
|
593
|
-
}
|
594
|
-
|
595
592
|
if (!input.transactionHash) {
|
596
593
|
return createErrorResponse("Transaction hash is required");
|
597
594
|
}
|
598
595
|
|
599
|
-
const provider = getProvider(
|
596
|
+
const provider = getProvider();
|
600
597
|
const receipt = await provider.getTransactionReceipt(input.transactionHash);
|
601
598
|
|
602
599
|
return createSuccessResponse({
|
@@ -612,15 +609,11 @@ export const getTransactionReceiptHandler = async (input: any): Promise<ToolResu
|
|
612
609
|
|
613
610
|
export const getCodeHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
614
611
|
try {
|
615
|
-
if (!input.provider) {
|
616
|
-
return createErrorResponse("Provider is required");
|
617
|
-
}
|
618
|
-
|
619
612
|
if (!input.address) {
|
620
613
|
return createErrorResponse("Address is required");
|
621
614
|
}
|
622
615
|
|
623
|
-
const provider = getProvider(
|
616
|
+
const provider = getProvider();
|
624
617
|
const code = await provider.getCode(input.address, input.blockTag);
|
625
618
|
|
626
619
|
return createSuccessResponse({
|
@@ -636,10 +629,6 @@ export const getCodeHandler = async (input: any): Promise<ToolResultSchema<any>>
|
|
636
629
|
|
637
630
|
export const getStorageAtHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
638
631
|
try {
|
639
|
-
if (!input.provider) {
|
640
|
-
return createErrorResponse("Provider is required");
|
641
|
-
}
|
642
|
-
|
643
632
|
if (!input.address) {
|
644
633
|
return createErrorResponse("Address is required");
|
645
634
|
}
|
@@ -648,7 +637,7 @@ export const getStorageAtHandler = async (input: any): Promise<ToolResultSchema<
|
|
648
637
|
return createErrorResponse("Position is required");
|
649
638
|
}
|
650
639
|
|
651
|
-
const provider = getProvider(
|
640
|
+
const provider = getProvider();
|
652
641
|
const storage = await provider.getStorageAt(input.address, input.position, input.blockTag);
|
653
642
|
|
654
643
|
return createSuccessResponse({
|
@@ -665,15 +654,14 @@ export const getStorageAtHandler = async (input: any): Promise<ToolResultSchema<
|
|
665
654
|
|
666
655
|
export const estimateGasHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
667
656
|
try {
|
668
|
-
if (!input.provider) {
|
669
|
-
return createErrorResponse("Provider is required");
|
670
|
-
}
|
671
|
-
|
672
657
|
if (!input.transaction) {
|
673
658
|
return createErrorResponse("Transaction is required");
|
674
659
|
}
|
675
660
|
|
676
|
-
const provider = getProvider(
|
661
|
+
const provider = getProvider();
|
662
|
+
if (!provider) {
|
663
|
+
return createErrorResponse("Provider is required to estimate gas, please set the provider URL");
|
664
|
+
}
|
677
665
|
const gasEstimate = await provider.estimateGas(input.transaction);
|
678
666
|
|
679
667
|
return createSuccessResponse({
|
@@ -688,15 +676,14 @@ export const estimateGasHandler = async (input: any): Promise<ToolResultSchema<a
|
|
688
676
|
|
689
677
|
export const getLogsHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
690
678
|
try {
|
691
|
-
if (!input.provider) {
|
692
|
-
return createErrorResponse("Provider is required");
|
693
|
-
}
|
694
|
-
|
695
679
|
if (!input.filter) {
|
696
680
|
return createErrorResponse("Filter is required");
|
697
681
|
}
|
698
682
|
|
699
|
-
const provider = getProvider(
|
683
|
+
const provider = getProvider();
|
684
|
+
if (!provider) {
|
685
|
+
return createErrorResponse("Provider is required to get logs, please set the provider URL");
|
686
|
+
}
|
700
687
|
const logs = await provider.getLogs(input.filter);
|
701
688
|
|
702
689
|
return createSuccessResponse({
|
@@ -711,15 +698,14 @@ export const getLogsHandler = async (input: any): Promise<ToolResultSchema<any>>
|
|
711
698
|
|
712
699
|
export const getEnsResolverHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
713
700
|
try {
|
714
|
-
if (!input.provider) {
|
715
|
-
return createErrorResponse("Provider is required");
|
716
|
-
}
|
717
|
-
|
718
701
|
if (!input.name) {
|
719
702
|
return createErrorResponse("ENS name is required");
|
720
703
|
}
|
721
704
|
|
722
|
-
const provider = getProvider(
|
705
|
+
const provider = getProvider();
|
706
|
+
if (!provider) {
|
707
|
+
return createErrorResponse("Provider is required to get ENS resolver, please set the provider URL");
|
708
|
+
}
|
723
709
|
// In ethers.js v5, getResolver might not be directly on the provider type
|
724
710
|
// but it's available in the implementation
|
725
711
|
const resolver = await (provider as any).getResolver(input.name);
|
@@ -740,15 +726,14 @@ export const getEnsResolverHandler = async (input: any): Promise<ToolResultSchem
|
|
740
726
|
|
741
727
|
export const lookupAddressHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
742
728
|
try {
|
743
|
-
if (!input.provider) {
|
744
|
-
return createErrorResponse("Provider is required");
|
745
|
-
}
|
746
|
-
|
747
729
|
if (!input.address) {
|
748
730
|
return createErrorResponse("Address is required");
|
749
731
|
}
|
750
732
|
|
751
|
-
const provider = getProvider(
|
733
|
+
const provider = getProvider();
|
734
|
+
if (!provider) {
|
735
|
+
return createErrorResponse("Provider is required to lookup ENS name, please set the provider URL");
|
736
|
+
}
|
752
737
|
const name = await provider.lookupAddress(input.address);
|
753
738
|
|
754
739
|
return createSuccessResponse({
|
@@ -763,15 +748,14 @@ export const lookupAddressHandler = async (input: any): Promise<ToolResultSchema
|
|
763
748
|
|
764
749
|
export const resolveNameHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
765
750
|
try {
|
766
|
-
if (!input.provider) {
|
767
|
-
return createErrorResponse("Provider is required");
|
768
|
-
}
|
769
|
-
|
770
751
|
if (!input.name) {
|
771
752
|
return createErrorResponse("ENS name is required");
|
772
753
|
}
|
773
754
|
|
774
|
-
const provider = getProvider(
|
755
|
+
const provider = getProvider();
|
756
|
+
if (!provider) {
|
757
|
+
return createErrorResponse("Provider is required to resolve ENS name, please set the provider URL");
|
758
|
+
}
|
775
759
|
const address = await provider.resolveName(input.name);
|
776
760
|
|
777
761
|
return createSuccessResponse({
|
@@ -789,11 +773,10 @@ export const resolveNameHandler = async (input: any): Promise<ToolResultSchema<a
|
|
789
773
|
|
790
774
|
export const getNetworkHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
791
775
|
try {
|
792
|
-
|
793
|
-
|
776
|
+
const provider = getProvider();
|
777
|
+
if (!provider) {
|
778
|
+
return createErrorResponse("Provider is required to get network information, please set the provider URL");
|
794
779
|
}
|
795
|
-
|
796
|
-
const provider = getProvider(input.provider);
|
797
780
|
const network = await provider.getNetwork();
|
798
781
|
|
799
782
|
return createSuccessResponse({
|
@@ -814,11 +797,10 @@ export const getNetworkHandler = async (input: any): Promise<ToolResultSchema<an
|
|
814
797
|
|
815
798
|
export const getBlockNumberHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
816
799
|
try {
|
817
|
-
|
818
|
-
|
800
|
+
const provider = getProvider();
|
801
|
+
if (!provider) {
|
802
|
+
return createErrorResponse("Provider is required to get block number, please set the provider URL");
|
819
803
|
}
|
820
|
-
|
821
|
-
const provider = getProvider(input.provider);
|
822
804
|
const blockNumber = await provider.getBlockNumber();
|
823
805
|
|
824
806
|
return createSuccessResponse({
|
@@ -833,12 +815,10 @@ export const getBlockNumberHandler = async (input: any): Promise<ToolResultSchem
|
|
833
815
|
|
834
816
|
export const getFeeDataHandler = async (input: any): Promise<ToolResultSchema<any>> => {
|
835
817
|
try {
|
836
|
-
|
837
|
-
|
818
|
+
const provider = getProvider();
|
819
|
+
if (!provider) {
|
820
|
+
return createErrorResponse("Provider is required to get fee data, please set the provider URL");
|
838
821
|
}
|
839
|
-
|
840
|
-
const provider = getProvider(input.provider);
|
841
|
-
|
842
822
|
// getFeeData is available in ethers v5.5.0+
|
843
823
|
// @ts-ignore - getFeeData might not be in the type definitions depending on the version
|
844
824
|
const feeData = await provider.getFeeData();
|
package/src/tools.ts
CHANGED
@@ -32,10 +32,22 @@ import {
|
|
32
32
|
getNetworkHandler,
|
33
33
|
getBlockNumberHandler,
|
34
34
|
getFeeDataHandler,
|
35
|
-
createMnemonicPhraseHandler
|
35
|
+
createMnemonicPhraseHandler,
|
36
|
+
setProviderHandler
|
36
37
|
} from "./handlers/wallet.js";
|
37
38
|
|
38
39
|
export const tools = [
|
40
|
+
{
|
41
|
+
name: "wallet_provider_set",
|
42
|
+
description: "Set the provider URL. By default, the provider URL is set to the ETH mainnet or the URL set in the PROVIDER_URL environment variable.",
|
43
|
+
inputSchema: {
|
44
|
+
type: "object",
|
45
|
+
properties: {
|
46
|
+
providerURL: { type: "string", description: "The provider RPC URL" }
|
47
|
+
},
|
48
|
+
required: ["providerURL"]
|
49
|
+
}
|
50
|
+
},
|
39
51
|
// Wallet Creation and Management
|
40
52
|
{
|
41
53
|
name: "wallet_create_random",
|
@@ -56,8 +68,7 @@ export const tools = [
|
|
56
68
|
inputSchema: {
|
57
69
|
type: "object",
|
58
70
|
properties: {
|
59
|
-
privateKey: { type: "string", description: "The private key" }
|
60
|
-
provider: { type: "string", description: "Optional JSON RPC provider URL" }
|
71
|
+
privateKey: { type: "string", description: "The private key" }
|
61
72
|
},
|
62
73
|
required: ["privateKey"]
|
63
74
|
}
|
@@ -82,8 +93,7 @@ export const tools = [
|
|
82
93
|
properties: {
|
83
94
|
mnemonic: { type: "string", description: "The mnemonic phrase" },
|
84
95
|
path: { type: "string", description: "Optional HD path" },
|
85
|
-
locale: { type: "string", description: "Optional locale for the wordlist" }
|
86
|
-
provider: { type: "string", description: "Optional JSON RPC provider URL" }
|
96
|
+
locale: { type: "string", description: "Optional locale for the wordlist" }
|
87
97
|
},
|
88
98
|
required: ["mnemonic"]
|
89
99
|
}
|
@@ -95,8 +105,7 @@ export const tools = [
|
|
95
105
|
type: "object",
|
96
106
|
properties: {
|
97
107
|
json: { type: "string", description: "The encrypted JSON wallet" },
|
98
|
-
password: { type: "string", description: "The password to decrypt the wallet" }
|
99
|
-
provider: { type: "string", description: "Optional JSON RPC provider URL" }
|
108
|
+
password: { type: "string", description: "The password to decrypt the wallet" }
|
100
109
|
},
|
101
110
|
required: ["json", "password"]
|
102
111
|
}
|
@@ -171,10 +180,9 @@ export const tools = [
|
|
171
180
|
type: "object",
|
172
181
|
properties: {
|
173
182
|
wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." },
|
174
|
-
provider: { type: "string", description: "Optional JSON RPC provider URL" },
|
175
183
|
blockTag: { type: "string", description: "Optional block tag (latest, pending, etc.)" }
|
176
184
|
},
|
177
|
-
required: [
|
185
|
+
required: []
|
178
186
|
}
|
179
187
|
},
|
180
188
|
{
|
@@ -183,8 +191,7 @@ export const tools = [
|
|
183
191
|
inputSchema: {
|
184
192
|
type: "object",
|
185
193
|
properties: {
|
186
|
-
wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." }
|
187
|
-
provider: { type: "string", description: "Optional JSON RPC provider URL" }
|
194
|
+
wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." }
|
188
195
|
},
|
189
196
|
required: []
|
190
197
|
}
|
@@ -195,8 +202,7 @@ export const tools = [
|
|
195
202
|
inputSchema: {
|
196
203
|
type: "object",
|
197
204
|
properties: {
|
198
|
-
wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." }
|
199
|
-
provider: { type: "string", description: "Optional JSON RPC provider URL" }
|
205
|
+
wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." }
|
200
206
|
},
|
201
207
|
required: []
|
202
208
|
}
|
@@ -208,7 +214,6 @@ export const tools = [
|
|
208
214
|
type: "object",
|
209
215
|
properties: {
|
210
216
|
wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." },
|
211
|
-
provider: { type: "string", description: "Optional JSON RPC provider URL" },
|
212
217
|
blockTag: { type: "string", description: "Optional block tag (latest, pending, etc.)" }
|
213
218
|
},
|
214
219
|
required: []
|
@@ -221,7 +226,6 @@ export const tools = [
|
|
221
226
|
type: "object",
|
222
227
|
properties: {
|
223
228
|
wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." },
|
224
|
-
provider: { type: "string", description: "Optional JSON RPC provider URL" },
|
225
229
|
transaction: {
|
226
230
|
type: "object",
|
227
231
|
description: "The transaction to call",
|
@@ -249,7 +253,6 @@ export const tools = [
|
|
249
253
|
type: "object",
|
250
254
|
properties: {
|
251
255
|
wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." },
|
252
|
-
provider: { type: "string", description: "Optional JSON RPC provider URL" },
|
253
256
|
transaction: {
|
254
257
|
type: "object",
|
255
258
|
description: "The transaction to send",
|
@@ -278,7 +281,6 @@ export const tools = [
|
|
278
281
|
type: "object",
|
279
282
|
properties: {
|
280
283
|
wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." },
|
281
|
-
provider: { type: "string", description: "Optional JSON RPC provider URL" },
|
282
284
|
transaction: {
|
283
285
|
type: "object",
|
284
286
|
description: "The transaction to sign",
|
@@ -307,7 +309,6 @@ export const tools = [
|
|
307
309
|
type: "object",
|
308
310
|
properties: {
|
309
311
|
wallet: { type: "string", description: "The wallet (private key, mnemonic, or JSON). If not provided, uses PRIVATE_KEY environment variable if set." },
|
310
|
-
provider: { type: "string", description: "Optional JSON RPC provider URL" },
|
311
312
|
transaction: {
|
312
313
|
type: "object",
|
313
314
|
description: "The transaction to populate",
|
@@ -393,11 +394,10 @@ export const tools = [
|
|
393
394
|
inputSchema: {
|
394
395
|
type: "object",
|
395
396
|
properties: {
|
396
|
-
provider: { type: "string", description: "JSON RPC provider URL" },
|
397
397
|
blockHashOrBlockTag: { type: "string", description: "Block hash or block tag (latest, pending, etc.)" },
|
398
398
|
includeTransactions: { type: "boolean", description: "Whether to include full transactions or just hashes" }
|
399
399
|
},
|
400
|
-
required: ["
|
400
|
+
required: ["blockHashOrBlockTag"]
|
401
401
|
}
|
402
402
|
},
|
403
403
|
{
|
@@ -406,10 +406,9 @@ export const tools = [
|
|
406
406
|
inputSchema: {
|
407
407
|
type: "object",
|
408
408
|
properties: {
|
409
|
-
provider: { type: "string", description: "JSON RPC provider URL" },
|
410
409
|
transactionHash: { type: "string", description: "The transaction hash" }
|
411
410
|
},
|
412
|
-
required: ["
|
411
|
+
required: ["transactionHash"]
|
413
412
|
}
|
414
413
|
},
|
415
414
|
{
|
@@ -418,10 +417,9 @@ export const tools = [
|
|
418
417
|
inputSchema: {
|
419
418
|
type: "object",
|
420
419
|
properties: {
|
421
|
-
provider: { type: "string", description: "JSON RPC provider URL" },
|
422
420
|
transactionHash: { type: "string", description: "The transaction hash" }
|
423
421
|
},
|
424
|
-
required: ["
|
422
|
+
required: ["transactionHash"]
|
425
423
|
}
|
426
424
|
},
|
427
425
|
{
|
@@ -430,11 +428,10 @@ export const tools = [
|
|
430
428
|
inputSchema: {
|
431
429
|
type: "object",
|
432
430
|
properties: {
|
433
|
-
provider: { type: "string", description: "JSON RPC provider URL" },
|
434
431
|
address: { type: "string", description: "The address to get code from" },
|
435
432
|
blockTag: { type: "string", description: "Optional block tag (latest, pending, etc.)" }
|
436
433
|
},
|
437
|
-
required: ["
|
434
|
+
required: ["address"]
|
438
435
|
}
|
439
436
|
},
|
440
437
|
{
|
@@ -443,12 +440,11 @@ export const tools = [
|
|
443
440
|
inputSchema: {
|
444
441
|
type: "object",
|
445
442
|
properties: {
|
446
|
-
provider: { type: "string", description: "JSON RPC provider URL" },
|
447
443
|
address: { type: "string", description: "The address to get storage from" },
|
448
444
|
position: { type: "string", description: "The storage position" },
|
449
445
|
blockTag: { type: "string", description: "Optional block tag (latest, pending, etc.)" }
|
450
446
|
},
|
451
|
-
required: ["
|
447
|
+
required: ["address", "position"]
|
452
448
|
}
|
453
449
|
},
|
454
450
|
{
|
@@ -457,7 +453,6 @@ export const tools = [
|
|
457
453
|
inputSchema: {
|
458
454
|
type: "object",
|
459
455
|
properties: {
|
460
|
-
provider: { type: "string", description: "JSON RPC provider URL" },
|
461
456
|
transaction: {
|
462
457
|
type: "object",
|
463
458
|
description: "The transaction to estimate gas for",
|
@@ -469,7 +464,7 @@ export const tools = [
|
|
469
464
|
}
|
470
465
|
}
|
471
466
|
},
|
472
|
-
required: ["
|
467
|
+
required: ["transaction"]
|
473
468
|
}
|
474
469
|
},
|
475
470
|
{
|
@@ -478,7 +473,6 @@ export const tools = [
|
|
478
473
|
inputSchema: {
|
479
474
|
type: "object",
|
480
475
|
properties: {
|
481
|
-
provider: { type: "string", description: "JSON RPC provider URL" },
|
482
476
|
filter: {
|
483
477
|
type: "object",
|
484
478
|
description: "The filter to apply",
|
@@ -490,7 +484,7 @@ export const tools = [
|
|
490
484
|
}
|
491
485
|
}
|
492
486
|
},
|
493
|
-
required: ["
|
487
|
+
required: ["filter"]
|
494
488
|
}
|
495
489
|
},
|
496
490
|
{
|
@@ -499,10 +493,9 @@ export const tools = [
|
|
499
493
|
inputSchema: {
|
500
494
|
type: "object",
|
501
495
|
properties: {
|
502
|
-
provider: { type: "string", description: "JSON RPC provider URL" },
|
503
496
|
name: { type: "string", description: "The ENS name" }
|
504
497
|
},
|
505
|
-
required: ["
|
498
|
+
required: ["name"]
|
506
499
|
}
|
507
500
|
},
|
508
501
|
{
|
@@ -511,10 +504,9 @@ export const tools = [
|
|
511
504
|
inputSchema: {
|
512
505
|
type: "object",
|
513
506
|
properties: {
|
514
|
-
provider: { type: "string", description: "JSON RPC provider URL" },
|
515
507
|
address: { type: "string", description: "The address to lookup" }
|
516
508
|
},
|
517
|
-
required: ["
|
509
|
+
required: ["address"]
|
518
510
|
}
|
519
511
|
},
|
520
512
|
{
|
@@ -523,10 +515,9 @@ export const tools = [
|
|
523
515
|
inputSchema: {
|
524
516
|
type: "object",
|
525
517
|
properties: {
|
526
|
-
provider: { type: "string", description: "JSON RPC provider URL" },
|
527
518
|
name: { type: "string", description: "The ENS name to resolve" }
|
528
519
|
},
|
529
|
-
required: ["
|
520
|
+
required: ["name"]
|
530
521
|
}
|
531
522
|
},
|
532
523
|
|
@@ -536,10 +527,8 @@ export const tools = [
|
|
536
527
|
description: "Get the current network information",
|
537
528
|
inputSchema: {
|
538
529
|
type: "object",
|
539
|
-
properties: {
|
540
|
-
|
541
|
-
},
|
542
|
-
required: ["provider"]
|
530
|
+
properties: {},
|
531
|
+
required: []
|
543
532
|
}
|
544
533
|
},
|
545
534
|
{
|
@@ -547,10 +536,8 @@ export const tools = [
|
|
547
536
|
description: "Get the current block number",
|
548
537
|
inputSchema: {
|
549
538
|
type: "object",
|
550
|
-
properties: {
|
551
|
-
|
552
|
-
},
|
553
|
-
required: ["provider"]
|
539
|
+
properties: {},
|
540
|
+
required: []
|
554
541
|
}
|
555
542
|
},
|
556
543
|
{
|
@@ -558,10 +545,8 @@ export const tools = [
|
|
558
545
|
description: "Get the current fee data (base fee, max priority fee, etc.)",
|
559
546
|
inputSchema: {
|
560
547
|
type: "object",
|
561
|
-
properties: {
|
562
|
-
|
563
|
-
},
|
564
|
-
required: ["provider"]
|
548
|
+
properties: {},
|
549
|
+
required: []
|
565
550
|
}
|
566
551
|
}
|
567
552
|
];
|
@@ -569,6 +554,8 @@ export const tools = [
|
|
569
554
|
type HandlerDictionary = Record<string, (input: any) => any>;
|
570
555
|
|
571
556
|
export const handlers: HandlerDictionary = {
|
557
|
+
// Provider Methods
|
558
|
+
"wallet_provider_set": setProviderHandler,
|
572
559
|
// Wallet Creation and Management
|
573
560
|
"wallet_create_random": createWalletHandler,
|
574
561
|
"wallet_from_private_key": fromPrivateKeyHandler,
|