@iqai/mcp-odos
Version:
Mcp server for Odos access
35 lines • 1.17 kB
JavaScript
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