@medialane/sdk 0.126.0 → 0.128.0
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/{services-CkUqZ75g.d.cts → errors-CO99guAf.d.cts} +59 -2
- package/dist/{services-4Z16tkFa.d.ts → errors-De9avg1S.d.ts} +59 -2
- package/dist/index.cjs +30 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +29 -7
- package/dist/index.js.map +1 -1
- package/dist/starknet/index.cjs +20 -5
- package/dist/starknet/index.cjs.map +1 -1
- package/dist/starknet/index.d.cts +3 -53
- package/dist/starknet/index.d.ts +3 -53
- package/dist/starknet/index.js +20 -6
- package/dist/starknet/index.js.map +1 -1
- package/package.json +1 -1
package/dist/starknet/index.cjs
CHANGED
|
@@ -248,11 +248,12 @@ function deriveErrorCode(status) {
|
|
|
248
248
|
return "UNKNOWN";
|
|
249
249
|
}
|
|
250
250
|
var MedialaneApiError = class extends Error {
|
|
251
|
-
constructor(status, message, retryAfterMs, details) {
|
|
251
|
+
constructor(status, message, retryAfterMs, details, isAuthored = false) {
|
|
252
252
|
super(message);
|
|
253
253
|
this.status = status;
|
|
254
254
|
this.retryAfterMs = retryAfterMs;
|
|
255
255
|
this.details = details;
|
|
256
|
+
this.isAuthored = isAuthored;
|
|
256
257
|
this.name = "MedialaneApiError";
|
|
257
258
|
this.code = deriveErrorCode(status);
|
|
258
259
|
}
|
|
@@ -291,9 +292,13 @@ var ApiClient = class {
|
|
|
291
292
|
const text = await response.text().catch(() => response.statusText);
|
|
292
293
|
let message = text;
|
|
293
294
|
let details;
|
|
295
|
+
let isAuthored = false;
|
|
294
296
|
try {
|
|
295
297
|
const body = JSON.parse(text);
|
|
296
|
-
if (body.error
|
|
298
|
+
if (typeof body.error === "string" && body.error.trim() !== "") {
|
|
299
|
+
message = body.error;
|
|
300
|
+
isAuthored = true;
|
|
301
|
+
}
|
|
297
302
|
details = body;
|
|
298
303
|
} catch {
|
|
299
304
|
}
|
|
@@ -301,7 +306,8 @@ var ApiClient = class {
|
|
|
301
306
|
response.status,
|
|
302
307
|
message,
|
|
303
308
|
parseRetryAfter(response.headers.get("retry-after")),
|
|
304
|
-
details
|
|
309
|
+
details,
|
|
310
|
+
isAuthored
|
|
305
311
|
);
|
|
306
312
|
}
|
|
307
313
|
return response;
|
|
@@ -11616,6 +11622,14 @@ async function requestSiwsToken({
|
|
|
11616
11622
|
return token;
|
|
11617
11623
|
}
|
|
11618
11624
|
|
|
11625
|
+
// src/errors.ts
|
|
11626
|
+
var UserFacingError = class extends Error {
|
|
11627
|
+
constructor(message) {
|
|
11628
|
+
super(message);
|
|
11629
|
+
this.name = "UserFacingError";
|
|
11630
|
+
}
|
|
11631
|
+
};
|
|
11632
|
+
|
|
11619
11633
|
// src/starknet/services/executeIntent.ts
|
|
11620
11634
|
async function confirmIntentBestEffort(client, intentId, txHash) {
|
|
11621
11635
|
await client.api.confirmIntent(intentId, txHash).catch(() => {
|
|
@@ -11645,14 +11659,14 @@ async function assertTransactionSucceeded(provider, txHash, retryDelaysMs = RECE
|
|
|
11645
11659
|
const receipt = await provider.getTransactionReceipt(txHash);
|
|
11646
11660
|
const status = receipt.execution_status ?? receipt.status;
|
|
11647
11661
|
if (status === "REVERTED" || status === "REJECTED") {
|
|
11648
|
-
throw new
|
|
11662
|
+
throw new UserFacingError("Transaction was submitted but reverted onchain. Please check your balance and try again.");
|
|
11649
11663
|
}
|
|
11650
11664
|
if (status) return receipt;
|
|
11651
11665
|
} catch (err) {
|
|
11652
11666
|
if (err instanceof Error && err.message.includes("reverted onchain")) throw err;
|
|
11653
11667
|
}
|
|
11654
11668
|
}
|
|
11655
|
-
throw new
|
|
11669
|
+
throw new UserFacingError("Verification timed out. Check your account for the transaction status.");
|
|
11656
11670
|
}
|
|
11657
11671
|
async function executeIntent(provider, signer, client, intent, opts = {}) {
|
|
11658
11672
|
let calls;
|
|
@@ -12923,6 +12937,7 @@ exports.SponsoredCallRejectedError = SponsoredCallRejectedError;
|
|
|
12923
12937
|
exports.SponsorshipService = SponsorshipService;
|
|
12924
12938
|
exports.StarknetVenue = StarknetVenue;
|
|
12925
12939
|
exports.TicketService = TicketService;
|
|
12940
|
+
exports.UserFacingError = UserFacingError;
|
|
12926
12941
|
exports.VALIDATED_EKUBO_PARAMS = VALIDATED_EKUBO_PARAMS;
|
|
12927
12942
|
exports.accountFor = accountFor;
|
|
12928
12943
|
exports.adminRequestDigest = adminRequestDigest;
|