wallet_from_encrypted_json
Generate a wallet by decrypting an encrypted JSON file using a password. Ideal for accessing Ethereum and EVM-compatible wallets securely.
Instructions
Create a wallet by decrypting an encrypted JSON wallet
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| json | Yes | The encrypted JSON wallet | |
| password | Yes | The password to decrypt the wallet |
Implementation Reference
- src/handlers/wallet.ts:128-154 (handler)The core handler function that decrypts an encrypted JSON wallet file using ethers.Wallet.fromEncryptedJson, optionally connects it to the current provider, and returns the wallet's address, private key, and public key.export const fromEncryptedJsonHandler = async (input: any): Promise<ToolResultSchema> => { try { if (!input.json) { return createErrorResponse("Encrypted JSON is required"); } if (!input.password) { return createErrorResponse("Password is required"); } const wallet = await ethers.Wallet.fromEncryptedJson(input.json, input.password); const provider = getProvider() if (provider) { wallet.connect(provider); } return createSuccessResponse( `Wallet created from encrypted JSON successfully Address: ${wallet.address} Private Key: ${wallet.privateKey} Public Key: ${wallet.publicKey} `); } catch (error) { return createErrorResponse(`Failed to create wallet from encrypted JSON: ${(error as Error).message}`); } };
- src/tools.ts:101-112 (schema)Tool definition including name, description, and input schema specifying required 'json' and 'password' parameters.{ name: "wallet_from_encrypted_json", description: "Create a wallet by decrypting an encrypted JSON wallet", inputSchema: { type: "object", properties: { json: { type: "string", description: "The encrypted JSON wallet" }, password: { type: "string", description: "The password to decrypt the wallet" } }, required: ["json", "password"] } },
- src/tools.ts:563-563 (registration)Maps the tool name 'wallet_from_encrypted_json' to its handler function in the central handlers dictionary."wallet_from_encrypted_json": fromEncryptedJsonHandler,