create_wallet
Generate a new Hyperion wallet with a mnemonic phrase using Rootstock MCP Server. Optionally assign a name to the wallet for easy management.
Instructions
Create a new Hyperion wallet with a generated mnemonic phrase
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Optional name for the wallet |
Input Schema (JSON Schema)
{
"properties": {
"name": {
"description": "Optional name for the wallet",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/wallet-manager.ts:58-81 (handler)Core implementation of wallet creation: generates BIP39 mnemonic, creates ethers HD wallet, stores it, and returns WalletInfo including address, privateKey, mnemonic.createWallet(_name?: string): WalletInfo { try { // Generate a random mnemonic const mnemonic = bip39.generateMnemonic(); const wallet = ethers.Wallet.fromPhrase(mnemonic); // Store the wallet this.wallets.set(wallet.address.toLowerCase(), wallet); // Set as current wallet if it's the first one if (!this.currentWallet) { this.currentWallet = wallet.address.toLowerCase(); } return { address: wallet.address, privateKey: wallet.privateKey, mnemonic, publicKey: wallet.publicKey, }; } catch (error) { throw new Error(`Failed to create wallet: ${error}`); } }
- src/index.ts:574-584 (handler)MCP server handler for 'create_wallet' tool call: delegates to walletManager.createWallet and formats the success response with address and mnemonic.private async handleCreateWallet(params: CreateWalletParams) { const walletInfo = this.walletManager.createWallet(params.name); return { content: [ { type: 'text', text: `Wallet created successfully!\n\nAddress: ${walletInfo.address}\nMnemonic: ${walletInfo.mnemonic}\n\n⚠️ IMPORTANT: Save your mnemonic phrase securely. It's the only way to recover your wallet!`, }, ], }; }
- src/index.ts:165-177 (registration)Registration of 'create_wallet' tool in getAvailableTools(): defines name, description, and inputSchema for list tools request.{ name: 'create_wallet', description: 'Create a new Hyperion wallet with a generated mnemonic phrase', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Optional name for the wallet', }, }, }, },
- src/types.ts:107-110 (schema)TypeScript interface defining parameters for create_wallet handler (name optional, mnemonic optional but unused in create).export interface CreateWalletParams { name?: string; mnemonic?: string; }
- src/smithery-server.ts:79-107 (handler)Alternative handler and registration in Smithery server using McpServer.tool() with Zod schema, delegates to walletManager.createWallet.server.tool( "create_wallet", "Create a new Rootstock wallet with a generated mnemonic phrase", { name: z.string().optional().describe("Optional name for the wallet"), }, async ({ name }) => { try { const walletInfo = walletManager.createWallet(name); return { content: [ { type: "text", text: `Wallet created successfully!\n\nAddress: ${walletInfo.address}\nMnemonic: ${walletInfo.mnemonic}\n\n⚠️ IMPORTANT: Save your mnemonic phrase securely. It's the only way to recover your wallet!`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error creating wallet: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } );