@medialane/sdk 0.70.1 → 0.71.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/evm/index.d.cts +1 -1
- package/dist/evm/index.d.ts +1 -1
- package/dist/index.cjs +21 -10761
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +22 -10693
- package/dist/index.js.map +1 -1
- package/dist/services-Byw4_DBm.d.ts +1359 -0
- package/dist/services-CGbMik_G.d.cts +1359 -0
- package/dist/solana/index.d.cts +1 -1
- package/dist/solana/index.d.ts +1 -1
- package/dist/starknet/index.cjs +16 -6
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +8098 -3
- package/dist/starknet/index.d.ts +8098 -3
- package/dist/starknet/index.js +16 -6
- package/dist/starknet/index.js.map +1 -1
- package/dist/stellar/index.d.cts +1 -1
- package/dist/stellar/index.d.ts +1 -1
- package/dist/{types-Du_-QoQ1.d.cts → types-Cdwb6lXp.d.cts} +1 -1
- package/dist/{types-Du_-QoQ1.d.ts → types-Cdwb6lXp.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/index-BayGCrpT.d.ts +0 -9449
- package/dist/index-D-ugU7Tw.d.cts +0 -9449
package/dist/solana/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PublicKey, Transaction, Connection } from '@solana/web3.js';
|
|
2
|
-
import { V as VenueAdapter, C as Chain, R as RegisterOrderParams, A as AdapterTxResult, O as OrderRef } from '../types-
|
|
2
|
+
import { V as VenueAdapter, C as Chain, R as RegisterOrderParams, A as AdapterTxResult, O as OrderRef } from '../types-Cdwb6lXp.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Anchor wire encoding for the Medialane Solana programs — discriminators,
|
package/dist/solana/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PublicKey, Transaction, Connection } from '@solana/web3.js';
|
|
2
|
-
import { V as VenueAdapter, C as Chain, R as RegisterOrderParams, A as AdapterTxResult, O as OrderRef } from '../types-
|
|
2
|
+
import { V as VenueAdapter, C as Chain, R as RegisterOrderParams, A as AdapterTxResult, O as OrderRef } from '../types-Cdwb6lXp.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Anchor wire encoding for the Medialane Solana programs — discriminators,
|
package/dist/starknet/index.cjs
CHANGED
|
@@ -220,15 +220,16 @@ async function withRetry(fn, opts) {
|
|
|
220
220
|
return await fn();
|
|
221
221
|
} catch (err) {
|
|
222
222
|
lastError = err;
|
|
223
|
-
if (err instanceof MedialaneApiError && err.status < 500) {
|
|
223
|
+
if (err instanceof MedialaneApiError && err.status < 500 && err.status !== 429) {
|
|
224
224
|
throw err;
|
|
225
225
|
}
|
|
226
|
-
const isRetryable = err instanceof MedialaneApiError && err.status >= 500 || err instanceof TypeError;
|
|
226
|
+
const isRetryable = err instanceof MedialaneApiError && (err.status >= 500 || err.status === 429) || err instanceof TypeError;
|
|
227
227
|
if (!isRetryable || attempt === maxAttempts - 1) {
|
|
228
228
|
throw err;
|
|
229
229
|
}
|
|
230
|
-
const
|
|
231
|
-
const
|
|
230
|
+
const retryAfterMs = err instanceof MedialaneApiError ? err.retryAfterMs : void 0;
|
|
231
|
+
const backoff = baseDelayMs * Math.pow(2, attempt) + Math.random() * baseDelayMs;
|
|
232
|
+
const delay = Math.min(retryAfterMs ?? backoff, maxDelayMs);
|
|
232
233
|
await sleep(delay);
|
|
233
234
|
}
|
|
234
235
|
}
|
|
@@ -245,13 +246,22 @@ function deriveErrorCode(status) {
|
|
|
245
246
|
return "UNKNOWN";
|
|
246
247
|
}
|
|
247
248
|
var MedialaneApiError = class extends Error {
|
|
248
|
-
constructor(status, message) {
|
|
249
|
+
constructor(status, message, retryAfterMs) {
|
|
249
250
|
super(message);
|
|
250
251
|
this.status = status;
|
|
252
|
+
this.retryAfterMs = retryAfterMs;
|
|
251
253
|
this.name = "MedialaneApiError";
|
|
252
254
|
this.code = deriveErrorCode(status);
|
|
253
255
|
}
|
|
254
256
|
};
|
|
257
|
+
function parseRetryAfter(value) {
|
|
258
|
+
if (!value) return void 0;
|
|
259
|
+
const seconds = Number(value);
|
|
260
|
+
if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
|
|
261
|
+
const date = Date.parse(value);
|
|
262
|
+
if (!Number.isNaN(date)) return Math.max(0, date - Date.now());
|
|
263
|
+
return void 0;
|
|
264
|
+
}
|
|
255
265
|
var ApiClient = class {
|
|
256
266
|
constructor(baseUrl, apiKey, retryOptions, chain = "STARKNET") {
|
|
257
267
|
this.baseUrl = baseUrl;
|
|
@@ -290,7 +300,7 @@ var ApiClient = class {
|
|
|
290
300
|
if (body.error) message = body.error;
|
|
291
301
|
} catch {
|
|
292
302
|
}
|
|
293
|
-
throw new MedialaneApiError(response.status, message);
|
|
303
|
+
throw new MedialaneApiError(response.status, message, parseRetryAfter(response.headers.get("retry-after")));
|
|
294
304
|
}
|
|
295
305
|
return response;
|
|
296
306
|
}, this.retryOptions);
|