From 7c6c188b243d21371c94f6937ff24541070a673f Mon Sep 17 00:00:00 2001 From: Bob Lu Date: Tue, 28 Nov 2023 17:38:26 +0800 Subject: [PATCH] fix: add headers params to api build --- .changeset/three-toes-tease.md | 5 +++++ packages/api/src/api.ts | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 .changeset/three-toes-tease.md diff --git a/.changeset/three-toes-tease.md b/.changeset/three-toes-tease.md new file mode 100644 index 00000000..19cc64be --- /dev/null +++ b/.changeset/three-toes-tease.md @@ -0,0 +1,5 @@ +--- +'@protocolink/api': patch +--- + +add headers params to api build diff --git a/packages/api/src/api.ts b/packages/api/src/api.ts index 3e044cff..f4c83fb8 100644 --- a/packages/api/src/api.ts +++ b/packages/api/src/api.ts @@ -1,5 +1,5 @@ import { Permit2Type, RouterData, RouterDataEstimateResult } from './types'; -import axios from 'axios'; +import axios, { AxiosRequestConfig } from 'axios'; import axiosRetry from 'axios-retry'; import * as common from '@protocolink/common'; @@ -50,7 +50,13 @@ export async function estimateRouterData( return common.classifying(resp.data); } -export async function buildRouterTransactionRequest(routerData: RouterData): Promise { - const resp = await client.post('/v1/transactions/build', routerData); +export async function buildRouterTransactionRequest( + routerData: RouterData, + headers?: Record +): Promise { + const config: AxiosRequestConfig = { + headers: headers || {}, + }; + const resp = await client.post('/v1/transactions/build', routerData, config); return resp.data; }