Skip to main content
Glama
get-info-by-pri-key.ts1.17 kB
import { z } from 'zod'; import { getKeypairFromPrivateKey } from '../../utils/keypair.js'; import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'; import { BaseTool } from '../base.js'; const getInfoByPrivateKeyParamsSchema = z.object({ privateKey: z.string(), }); type GetInfoByPrivateKeyParams = z.output<typeof getInfoByPrivateKeyParamsSchema>; export class GetAccountInfoByPrivateKeyTool extends BaseTool<GetInfoByPrivateKeyParams> { name = 'get_account_info_by_private_key'; description = 'Get account info by private key'; paramsSchema = getInfoByPrivateKeyParamsSchema; async cb(args: GetInfoByPrivateKeyParams) { if (!args.privateKey) { throw new Error('Private key is required'); } const keypair = getKeypairFromPrivateKey(args.privateKey) as Ed25519Keypair; const publicKey = keypair.getPublicKey().toSuiPublicKey(); const privateKey = keypair.getSecretKey(); const address = keypair.toSuiAddress(); const accountInfo = { publicKey, privateKey, address, }; return this.createTextResponse(JSON.stringify(accountInfo)); } } export default new GetAccountInfoByPrivateKeyTool();

Implementation Reference

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/0xdwong/sui-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server