Add live route matrix and stable bridge decision flows
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m25s
CI/CD Pipeline / Lint and Format (push) Has been cancelled
CI/CD Pipeline / Terraform Validation (push) Has been cancelled
CI/CD Pipeline / Kubernetes Validation (push) Has been cancelled
Deploy ChainID 138 / Deploy ChainID 138 (push) Has been cancelled
Validation / validate-genesis (push) Has been cancelled
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Validation / validate-smart-contracts (push) Has been cancelled
Validation / validate-security (push) Has been cancelled
Validation / validate-documentation (push) Has been cancelled
CI/CD Pipeline / Security Scanning (push) Successful in 13m49s
Verify Deployment / Verify Deployment (push) Failing after 1m22s
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m25s
CI/CD Pipeline / Lint and Format (push) Has been cancelled
CI/CD Pipeline / Terraform Validation (push) Has been cancelled
CI/CD Pipeline / Kubernetes Validation (push) Has been cancelled
Deploy ChainID 138 / Deploy ChainID 138 (push) Has been cancelled
Validation / validate-genesis (push) Has been cancelled
Validation / validate-terraform (push) Has been cancelled
Validation / validate-kubernetes (push) Has been cancelled
Validation / validate-smart-contracts (push) Has been cancelled
Validation / validate-security (push) Has been cancelled
Validation / validate-documentation (push) Has been cancelled
CI/CD Pipeline / Security Scanning (push) Successful in 13m49s
Verify Deployment / Verify Deployment (push) Failing after 1m22s
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
|
||||
export type PartnerName = '1inch' | '0x' | 'LiFi';
|
||||
|
||||
export interface ResolvePartnerPayloadsRequest {
|
||||
partner: PartnerName;
|
||||
amount: string;
|
||||
fromChainId?: number;
|
||||
toChainId?: number;
|
||||
routeType?: string;
|
||||
tokenIn?: string;
|
||||
tokenOut?: string;
|
||||
takerAddress?: string;
|
||||
fromAddress?: string;
|
||||
toAddress?: string;
|
||||
recipient?: string;
|
||||
slippagePercent?: string;
|
||||
slippageBps?: string;
|
||||
includeUnsupported?: boolean;
|
||||
}
|
||||
|
||||
export interface PartnerPayloadTemplate {
|
||||
partner: PartnerName;
|
||||
routeId: string;
|
||||
supported: boolean;
|
||||
reason?: string;
|
||||
endpoint: string;
|
||||
method: 'GET';
|
||||
headers: Record<string, string>;
|
||||
query: Record<string, string>;
|
||||
route: {
|
||||
routeId: string;
|
||||
status: 'live';
|
||||
fromChainId: number;
|
||||
toChainId: number;
|
||||
routeType: 'swap' | 'bridge';
|
||||
};
|
||||
docs: string[];
|
||||
}
|
||||
|
||||
export interface ResolvePartnerPayloadsResponse {
|
||||
generatedAt: string;
|
||||
format: 'partner-payload-templates-v1';
|
||||
partner: PartnerName;
|
||||
amount: string;
|
||||
count: number;
|
||||
supportedCount: number;
|
||||
payloads: PartnerPayloadTemplate[];
|
||||
}
|
||||
|
||||
export class PartnerPayloadClient {
|
||||
private readonly http: AxiosInstance;
|
||||
|
||||
constructor(baseUrl = 'http://localhost:3000') {
|
||||
this.http = axios.create({
|
||||
baseURL: baseUrl.replace(/\/+$/, ''),
|
||||
timeout: 15_000,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async resolvePartnerPayloads(
|
||||
request: ResolvePartnerPayloadsRequest
|
||||
): Promise<ResolvePartnerPayloadsResponse> {
|
||||
const response = await this.http.post<ResolvePartnerPayloadsResponse>(
|
||||
'/api/v1/routes/partner-payloads/resolve',
|
||||
request
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async getPartnerPayloads(
|
||||
request: ResolvePartnerPayloadsRequest
|
||||
): Promise<ResolvePartnerPayloadsResponse> {
|
||||
const response = await this.http.get<ResolvePartnerPayloadsResponse>(
|
||||
'/api/v1/routes/partner-payloads',
|
||||
{
|
||||
params: request,
|
||||
}
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user