UNPKG

@iqai/mcp-odos

Version:
35 lines 1.17 kB
import { ODOS_API_URL } from "../constants.js"; export class AssembleService { walletService; constructor(walletService) { this.walletService = walletService; } async execute(pathId) { const walletClient = this.walletService.getWalletClient(); const userAddr = walletClient?.account?.address; if (!userAddr) { throw new Error("User address is not defined"); } try { const response = await fetch(`${ODOS_API_URL}/sor/assemble`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ userAddr, pathId, }), }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status} - ${response.statusText}`); } const data = (await response.json()); return data.transaction; } catch (error) { console.error("Error assembling path:", error); } } } //# sourceMappingURL=assemble.js.map