Skip to content

Commit

Permalink
Merge pull request #17 from LuPoYi/feature/add_headers_params_to_api_…
Browse files Browse the repository at this point in the history
…build_20231128

fix: add headers params to api build
  • Loading branch information
LuPoYi authored Nov 28, 2023
2 parents d156957 + 7c6c188 commit 11fab87
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-toes-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@protocolink/api': patch
---

add headers params to api build
12 changes: 9 additions & 3 deletions packages/api/src/api.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -50,7 +50,13 @@ export async function estimateRouterData(
return common.classifying(resp.data);
}

export async function buildRouterTransactionRequest(routerData: RouterData): Promise<common.TransactionRequest> {
const resp = await client.post('/v1/transactions/build', routerData);
export async function buildRouterTransactionRequest(
routerData: RouterData,
headers?: Record<string, string>
): Promise<common.TransactionRequest> {
const config: AxiosRequestConfig = {
headers: headers || {},
};
const resp = await client.post('/v1/transactions/build', routerData, config);
return resp.data;
}

0 comments on commit 11fab87

Please sign in to comment.