Skip to content

Commit c39f350

Browse files
committed
fix(external-match): route getMarkets through auth server
1 parent 8137e48 commit c39f350

1 file changed

Lines changed: 7 additions & 38 deletions

File tree

packages/external-match/src/client.ts

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ const ARBITRUM_ONE_BASE_URL = "https://arbitrum-one.v2.auth-server.renegade.fi";
5151
const BASE_SEPOLIA_BASE_URL = "https://base-sepolia.v2.auth-server.renegade.fi";
5252
const BASE_MAINNET_BASE_URL = "https://base-mainnet.v2.auth-server.renegade.fi";
5353

54-
// Constants for relayer URLs
55-
const ARBITRUM_SEPOLIA_RELAYER_URL = "https://arbitrum-sepolia.v2.relayer.renegade.fi";
56-
const ARBITRUM_ONE_RELAYER_URL = "https://arbitrum-one.v2.relayer.renegade.fi";
57-
const BASE_SEPOLIA_RELAYER_URL = "https://base-sepolia.v2.relayer.renegade.fi";
58-
const BASE_MAINNET_RELAYER_URL = "https://base-mainnet.v2.relayer.renegade.fi";
59-
6054
// Header constants
6155
const RENEGADE_API_KEY_HEADER = "x-renegade-api-key";
6256
const RENEGADE_SDK_VERSION_HEADER = "x-renegade-sdk-version";
@@ -291,70 +285,45 @@ function buildDirectOrderRequest(
291285
export class ExternalMatchClient {
292286
private apiKey: string;
293287
private httpClient: RelayerHttpClient;
294-
private relayerHttpClient?: RelayerHttpClient;
295288

296289
/**
297290
* Initialize a new ExternalMatchClient.
298291
*
299292
* @param apiKey The API key for authentication
300293
* @param apiSecret The API secret for request signing
301294
* @param baseUrl The base URL of the auth server API
302-
* @param relayerBaseUrl The base URL of the relayer API (for market endpoints)
303295
*/
304-
constructor(apiKey: string, apiSecret: string, baseUrl: string, relayerBaseUrl?: string) {
296+
constructor(apiKey: string, apiSecret: string, baseUrl: string) {
305297
this.apiKey = apiKey;
306298
this.httpClient = new RelayerHttpClient(baseUrl, apiSecret);
307-
if (relayerBaseUrl) {
308-
this.relayerHttpClient = new RelayerHttpClient(relayerBaseUrl, apiSecret);
309-
}
310299
}
311300

312301
/**
313302
* Create a new client configured for the Arbitrum Sepolia testnet.
314303
*/
315304
static newArbitrumSepoliaClient(apiKey: string, apiSecret: string): ExternalMatchClient {
316-
return new ExternalMatchClient(
317-
apiKey,
318-
apiSecret,
319-
ARBITRUM_SEPOLIA_BASE_URL,
320-
ARBITRUM_SEPOLIA_RELAYER_URL,
321-
);
305+
return new ExternalMatchClient(apiKey, apiSecret, ARBITRUM_SEPOLIA_BASE_URL);
322306
}
323307

324308
/**
325309
* Create a new client configured for the Base Sepolia testnet.
326310
*/
327311
static newBaseSepoliaClient(apiKey: string, apiSecret: string): ExternalMatchClient {
328-
return new ExternalMatchClient(
329-
apiKey,
330-
apiSecret,
331-
BASE_SEPOLIA_BASE_URL,
332-
BASE_SEPOLIA_RELAYER_URL,
333-
);
312+
return new ExternalMatchClient(apiKey, apiSecret, BASE_SEPOLIA_BASE_URL);
334313
}
335314

336315
/**
337316
* Create a new client configured for the Arbitrum One mainnet.
338317
*/
339318
static newArbitrumOneClient(apiKey: string, apiSecret: string): ExternalMatchClient {
340-
return new ExternalMatchClient(
341-
apiKey,
342-
apiSecret,
343-
ARBITRUM_ONE_BASE_URL,
344-
ARBITRUM_ONE_RELAYER_URL,
345-
);
319+
return new ExternalMatchClient(apiKey, apiSecret, ARBITRUM_ONE_BASE_URL);
346320
}
347321

348322
/**
349323
* Create a new client configured for the Base mainnet.
350324
*/
351325
static newBaseMainnetClient(apiKey: string, apiSecret: string): ExternalMatchClient {
352-
return new ExternalMatchClient(
353-
apiKey,
354-
apiSecret,
355-
BASE_MAINNET_BASE_URL,
356-
BASE_MAINNET_RELAYER_URL,
357-
);
326+
return new ExternalMatchClient(apiKey, apiSecret, BASE_MAINNET_BASE_URL);
358327
}
359328

360329
// --- Quote methods (v1 signature, v2 internally) ---
@@ -549,8 +518,8 @@ export class ExternalMatchClient {
549518
* Get all tradable markets.
550519
*/
551520
async getMarkets(): Promise<GetMarketsResponse> {
552-
const client = this.relayerHttpClient ?? this.httpClient;
553-
const response = await client.get<any>(GET_MARKETS_ROUTE);
521+
const headers = this.getHeaders();
522+
const response = await this.httpClient.get<any>(GET_MARKETS_ROUTE, headers);
554523

555524
if (response.status !== 200 || !response.data) {
556525
throw new ExternalMatchClientError("Failed to get markets", response.status);

0 commit comments

Comments
 (0)