send_edu
Transfer EDU native tokens securely to any wallet address by specifying the sender's private key, recipient address, and token amount. Simplify blockchain transactions and manage token distribution effectively.
Instructions
Send EDU native token to another wallet address
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount of EDU to send | |
| privateKey | Yes | Private key of the sender wallet | |
| toAddress | Yes | Recipient wallet address |
Input Schema (JSON Schema)
{
"properties": {
"amount": {
"description": "Amount of EDU to send",
"type": "string"
},
"privateKey": {
"description": "Private key of the sender wallet",
"type": "string"
},
"toAddress": {
"description": "Recipient wallet address",
"type": "string"
}
},
"required": [
"privateKey",
"toAddress",
"amount"
],
"type": "object"
}
Implementation Reference
- src/blockchain.ts:279-319 (handler)The core handler function that executes the EDU token transfer using ethers.js Wallet and Provider.export async function sendEdu( privateKey: string, toAddress: string, amount: string ): Promise<{ hash: string, from: string, to: string, amount: string }> { try { const provider = getProvider(); const wallet = new ethers.Wallet(privateKey, provider); // Convert amount to wei const amountWei = ethers.parseEther(amount); // Create and send transaction const tx = await wallet.sendTransaction({ to: toAddress, value: amountWei }); // Wait for transaction to be mined const receipt = await tx.wait(); if (!receipt) { throw new Error('Transaction failed'); } return { hash: tx.hash, from: wallet.address, to: toAddress, amount }; } catch (error) { console.error('Error sending EDU:', error); throw error; } }
- src/index.ts:426-446 (schema)Input schema definition for the 'send_edu' tool, including parameters and validation.name: 'send_edu', description: 'Send EDU native token to another wallet address', inputSchema: { type: 'object', properties: { privateKey: { type: 'string', description: 'Private key of the sender wallet', }, toAddress: { type: 'string', description: 'Recipient wallet address', }, amount: { type: 'string', description: 'Amount of EDU to send', }, }, required: ['privateKey', 'toAddress', 'amount'], }, },
- src/index.ts:1017-1050 (registration)MCP tool call handler for 'send_edu' that validates inputs, calls the blockchain.sendEdu function, and formats the response.case 'send_edu': { if (!args.privateKey || typeof args.privateKey !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Private key is required'); } if (!args.toAddress || typeof args.toAddress !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Recipient address is required'); } if (!args.amount || typeof args.amount !== 'string') { throw new McpError(ErrorCode.InvalidParams, 'Amount is required'); } // Get wallet address from private key for information const fromAddress = blockchain.getWalletAddressFromPrivateKey(args.privateKey); // Proceed with the transaction const result = await blockchain.sendEdu(args.privateKey, args.toAddress, args.amount); // Add from address to the result for better context const enhancedResult = { ...result, fromAddress }; return { content: [ { type: 'text', text: JSON.stringify(enhancedResult, null, 2), }, ], }; }