Skip to content

Commit 1bd7355

Browse files
authored
Merge pull request #52 from deso-protocol/fix/add-twap-query-params
Fix: Adding more query params for get my twap orders request
2 parents 3964632 + 0f81194 commit 1bd7355

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/transactions/amm.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,30 @@ export type GetMyTwapOrdersResponse = {
145145
};
146146

147147
export const getMyTwapOrders = async (
148-
params: { publicKey: string; limit?: number; offset?: number },
148+
params: {
149+
publicKey: string;
150+
limit?: number;
151+
offset?: number;
152+
baseCurrencyPubKey?: string;
153+
status?: string;
154+
},
149155
options?: RequestOptions
150156
): Promise<GetMyTwapOrdersResponse> => {
151157
const jwt = await identity.jwt();
158+
const queryParams = new URLSearchParams({
159+
limit: (params.limit ?? 0).toString(),
160+
offset: (params.offset ?? 0).toString(),
161+
...(params.baseCurrencyPubKey
162+
? { baseCurrencyPubKey: params.baseCurrencyPubKey }
163+
: {}),
164+
...(params.status ? { status: params.status } : {}),
165+
});
166+
152167
const endpoint = cleanURL(
153168
options?.nodeURI ?? '',
154-
`api/v0/twaps/${params.publicKey}?limit=${params.limit ?? 0}&offset=${
155-
params.offset ?? 0
156-
}`
169+
`api/v0/twaps/${params.publicKey}?${queryParams.toString()}`
157170
);
171+
158172
return amm.get(endpoint, {
159173
headers: {
160174
Authorization: `Bearer ${jwt}`,

0 commit comments

Comments
 (0)