Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m22s
CI/CD Pipeline / Security Scanning (push) Successful in 2m30s
CI/CD Pipeline / Lint and Format (push) Failing after 44s
CI/CD Pipeline / Terraform Validation (push) Failing after 27s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 31s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 56s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 29s
Validation / validate-genesis (push) Successful in 34s
Validation / validate-terraform (push) Failing after 39s
Validation / validate-kubernetes (push) Failing after 14s
Validation / validate-smart-contracts (push) Failing after 20s
Validation / validate-security (push) Failing after 1m19s
Validation / validate-documentation (push) Failing after 27s
Verify Deployment / Verify Deployment (push) Failing after 1m13s
Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
2.1 KiB
JavaScript
53 lines
2.1 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.fetchQuote = fetchQuote;
|
|
exports.fetchRoutePlan = fetchRoutePlan;
|
|
exports.fetchExecutionPlan = fetchExecutionPlan;
|
|
exports.fetchProviderCapabilities = fetchProviderCapabilities;
|
|
const axios_1 = __importDefault(require("axios"));
|
|
const config_1 = require("../config");
|
|
async function fetchQuote(params) {
|
|
const base = (0, config_1.tokenAggUrl)();
|
|
const q = new URLSearchParams({
|
|
chainId: String(params.chainId),
|
|
tokenIn: params.tokenIn,
|
|
tokenOut: params.tokenOut,
|
|
amountIn: params.amountIn,
|
|
});
|
|
const { data } = await axios_1.default.get(`${base}/api/v1/quote?${q}`, { timeout: 60000 });
|
|
return data;
|
|
}
|
|
async function fetchRoutePlan(body) {
|
|
const { data } = await axios_1.default.post(`${(0, config_1.tokenAggUrl)()}/api/v2/routes/plan`, {
|
|
sourceChainId: body.sourceChainId,
|
|
destinationChainId: body.destinationChainId,
|
|
tokenIn: body.tokenIn,
|
|
tokenOut: body.tokenOut,
|
|
amountIn: body.amountIn,
|
|
recipient: body.recipient,
|
|
constraints: { maxSlippageBps: body.maxSlippageBps ?? 50, allowBridge: false },
|
|
}, { timeout: 120000 });
|
|
return data;
|
|
}
|
|
async function fetchExecutionPlan(body) {
|
|
const { data } = await axios_1.default.post(`${(0, config_1.tokenAggUrl)()}/api/v2/routes/internal-execution-plan`, {
|
|
sourceChainId: body.sourceChainId,
|
|
destinationChainId: body.destinationChainId,
|
|
tokenIn: body.tokenIn,
|
|
tokenOut: body.tokenOut,
|
|
amountIn: body.amountIn,
|
|
recipient: body.recipient,
|
|
constraints: { maxSlippageBps: body.maxSlippageBps ?? 50, allowBridge: false },
|
|
}, { timeout: 120000 });
|
|
return data;
|
|
}
|
|
async function fetchProviderCapabilities(chainId) {
|
|
const { data } = await axios_1.default.get(`${(0, config_1.tokenAggUrl)()}/api/v2/providers/capabilities?chainId=${chainId}`, {
|
|
timeout: 30000,
|
|
});
|
|
return data;
|
|
}
|