@sanlim/mempool-mcp-server
Version:
A sample of MCP implementation using DDD structure with some APIs call.
32 lines (31 loc) • 1.22 kB
JavaScript
import { formatResponse } from "../helpers/format.js";
export class TxService {
requestService;
constructor(requestService) {
this.requestService = requestService;
}
async getTxInfo({ txid }) {
const data = await this.requestService.getTxInfo({ txid });
return formatResponse("Transaction Info", data);
}
async getTxStatus({ txid }) {
const data = await this.requestService.getTxStatus({ txid });
return formatResponse("Transaction Status", data);
}
async getTxRaw({ txid }) {
const data = await this.requestService.getTxRaw({ txid });
return `Transaction Raw Hex: ${data}`;
}
async getTxMerkleblockProof({ txid }) {
const data = await this.requestService.getTxMerkleblockProof({ txid });
return `Transaction Merkleblock Proof: ${data}`;
}
async getTxOutspend({ txid, vout, }) {
const data = await this.requestService.getTxOutspend({ txid, vout });
return formatResponse("Transaction Outspend", data);
}
async getTxOutspends({ txid }) {
const data = await this.requestService.getTxOutspends({ txid });
return formatResponse("Transaction Outspends", data);
}
}