@volr/react 0.1.128 → 0.1.130
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/index.cjs +222 -94
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +63 -2
- package/dist/index.d.ts +63 -2
- package/dist/index.js +220 -96
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as nc from 'crypto';
|
|
2
2
|
import { createContext, useRef, useEffect, useMemo, useState, useCallback, useContext } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { signSession, getAuthNonce, signAuthorization, createPasskeyProvider, createMpcProvider, deriveWrapKey, unsealMasterSeed, sealMasterSeed, createMasterKeyProvider, deriveEvmKey, ZERO_HASH, selectSigner, VolrError } from '@volr/sdk-core';
|
|
4
4
|
export { createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, sealMasterSeed, uploadBlob } from '@volr/sdk-core';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -9269,12 +9269,13 @@ var APIClient = class {
|
|
|
9269
9269
|
headers: {
|
|
9270
9270
|
"Content-Type": "application/json"
|
|
9271
9271
|
},
|
|
9272
|
+
// Transform BigInt to string before JSON serialization
|
|
9272
9273
|
transformRequest: [
|
|
9273
9274
|
(data) => {
|
|
9274
9275
|
if (data && typeof data === "object") {
|
|
9275
9276
|
return JSON.stringify(
|
|
9276
9277
|
data,
|
|
9277
|
-
(
|
|
9278
|
+
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
9278
9279
|
);
|
|
9279
9280
|
}
|
|
9280
9281
|
return data;
|
|
@@ -9298,6 +9299,9 @@ var APIClient = class {
|
|
|
9298
9299
|
this.api.interceptors.response.use(
|
|
9299
9300
|
(response) => response,
|
|
9300
9301
|
async (error) => {
|
|
9302
|
+
if (typeof process !== "undefined" && process.env.NODE_ENV === "test") {
|
|
9303
|
+
sanitizeAxiosErrorForTest(error);
|
|
9304
|
+
}
|
|
9301
9305
|
const originalRequest = error.config;
|
|
9302
9306
|
const requestUrl = originalRequest?.url || "";
|
|
9303
9307
|
const responseData = error.response?.data;
|
|
@@ -9334,7 +9338,14 @@ var APIClient = class {
|
|
|
9334
9338
|
}
|
|
9335
9339
|
return this.api(originalRequest);
|
|
9336
9340
|
} catch (refreshError) {
|
|
9337
|
-
|
|
9341
|
+
const anyErr = refreshError;
|
|
9342
|
+
const status = anyErr?.response?.status;
|
|
9343
|
+
const backendCode = anyErr?.response?.data?.error?.code;
|
|
9344
|
+
const backendMessage = anyErr?.response?.data?.error?.message;
|
|
9345
|
+
const message = backendMessage || anyErr?.message || "Unknown error";
|
|
9346
|
+
console.error(
|
|
9347
|
+
`[APIClient] Token refresh failed${typeof status === "number" ? ` (${status})` : ""}: ${backendCode ? `${backendCode}: ` : ""}${message}`
|
|
9348
|
+
);
|
|
9338
9349
|
return Promise.reject(refreshError);
|
|
9339
9350
|
}
|
|
9340
9351
|
}
|
|
@@ -9415,17 +9426,11 @@ var APIClient = class {
|
|
|
9415
9426
|
if (!this.refreshToken) {
|
|
9416
9427
|
throw new Error("No refresh token available. Please log in again.");
|
|
9417
9428
|
}
|
|
9418
|
-
const
|
|
9419
|
-
(_, reject) => setTimeout(
|
|
9420
|
-
() => reject(new Error("Session refresh timeout. Please check your network connection.")),
|
|
9421
|
-
timeoutMs
|
|
9422
|
-
)
|
|
9423
|
-
);
|
|
9424
|
-
const refreshPromise = this.api.post(
|
|
9429
|
+
const response = await this.api.post(
|
|
9425
9430
|
"/auth/refresh",
|
|
9426
|
-
{ refreshToken: this.refreshToken }
|
|
9431
|
+
{ refreshToken: this.refreshToken },
|
|
9432
|
+
{ timeout: timeoutMs }
|
|
9427
9433
|
);
|
|
9428
|
-
const response = await Promise.race([refreshPromise, timeoutPromise]);
|
|
9429
9434
|
const data = response.data;
|
|
9430
9435
|
if (isErrorResponse(data)) {
|
|
9431
9436
|
this.setAccessToken(null);
|
|
@@ -9453,23 +9458,27 @@ var APIClient = class {
|
|
|
9453
9458
|
}
|
|
9454
9459
|
this.refreshPromise = (async () => {
|
|
9455
9460
|
try {
|
|
9456
|
-
|
|
9457
|
-
"/auth/refresh",
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9461
|
+
try {
|
|
9462
|
+
const response = await this.api.post("/auth/refresh", { refreshToken: this.refreshToken });
|
|
9463
|
+
const data = response.data;
|
|
9464
|
+
if (isErrorResponse(data)) {
|
|
9465
|
+
this.setAccessToken(null);
|
|
9466
|
+
this.setRefreshToken(null);
|
|
9467
|
+
safeStorage.removeItem(STORAGE_KEYS.user);
|
|
9468
|
+
throw new Error(data.error.message);
|
|
9469
|
+
}
|
|
9470
|
+
this.setAccessToken(data.data.accessToken);
|
|
9471
|
+
if (data.data.refreshToken) {
|
|
9472
|
+
this.setRefreshToken(data.data.refreshToken);
|
|
9473
|
+
}
|
|
9474
|
+
if (data.data.user) {
|
|
9475
|
+
safeStorage.setItem(STORAGE_KEYS.user, JSON.stringify(data.data.user));
|
|
9476
|
+
}
|
|
9477
|
+
} catch (err) {
|
|
9462
9478
|
this.setAccessToken(null);
|
|
9463
9479
|
this.setRefreshToken(null);
|
|
9464
9480
|
safeStorage.removeItem(STORAGE_KEYS.user);
|
|
9465
|
-
throw
|
|
9466
|
-
}
|
|
9467
|
-
this.setAccessToken(data.data.accessToken);
|
|
9468
|
-
if (data.data.refreshToken) {
|
|
9469
|
-
this.setRefreshToken(data.data.refreshToken);
|
|
9470
|
-
}
|
|
9471
|
-
if (data.data.user) {
|
|
9472
|
-
safeStorage.setItem(STORAGE_KEYS.user, JSON.stringify(data.data.user));
|
|
9481
|
+
throw err;
|
|
9473
9482
|
}
|
|
9474
9483
|
} finally {
|
|
9475
9484
|
this.refreshPromise = null;
|
|
@@ -9517,7 +9526,14 @@ var APIClient = class {
|
|
|
9517
9526
|
const response = await this.api.request(config);
|
|
9518
9527
|
return unwrapResponse(response.data);
|
|
9519
9528
|
} catch (error) {
|
|
9520
|
-
|
|
9529
|
+
const anyErr = error;
|
|
9530
|
+
const status = anyErr?.response?.status;
|
|
9531
|
+
const backendCode = anyErr?.response?.data?.error?.code;
|
|
9532
|
+
const backendMessage = anyErr?.response?.data?.error?.message;
|
|
9533
|
+
const message = backendMessage || anyErr?.message || "Unknown error";
|
|
9534
|
+
console.error(
|
|
9535
|
+
`[APIClient] POST ${normalizedEndpoint} error${typeof status === "number" ? ` (${status})` : ""}: ${backendCode ? `${backendCode}: ` : ""}${message}`
|
|
9536
|
+
);
|
|
9521
9537
|
throw error;
|
|
9522
9538
|
}
|
|
9523
9539
|
}
|
|
@@ -9554,7 +9570,36 @@ var APIClient = class {
|
|
|
9554
9570
|
const response = await this.api.get(normalizedEndpoint);
|
|
9555
9571
|
return unwrapResponse(response.data);
|
|
9556
9572
|
}
|
|
9573
|
+
/**
|
|
9574
|
+
* Internal helper to sanitize Axios errors in test environment so that Vitest
|
|
9575
|
+
* can safely structured-clone them between workers.
|
|
9576
|
+
*
|
|
9577
|
+
* NOTE: This function is exported only for tests. It is a no-op in production
|
|
9578
|
+
* builds where NODE_ENV !== 'test'.
|
|
9579
|
+
*/
|
|
9580
|
+
static sanitizeAxiosErrorForTest(error) {
|
|
9581
|
+
sanitizeAxiosErrorForTest(error);
|
|
9582
|
+
}
|
|
9557
9583
|
};
|
|
9584
|
+
function sanitizeAxiosErrorForTest(error) {
|
|
9585
|
+
if (!error || typeof error !== "object") return;
|
|
9586
|
+
try {
|
|
9587
|
+
const anyErr = error;
|
|
9588
|
+
const cfg = anyErr.config;
|
|
9589
|
+
if (cfg && typeof cfg === "object") {
|
|
9590
|
+
if ("transformRequest" in cfg) cfg.transformRequest = void 0;
|
|
9591
|
+
if ("transformResponse" in cfg) cfg.transformResponse = void 0;
|
|
9592
|
+
if ("adapter" in cfg) cfg.adapter = void 0;
|
|
9593
|
+
}
|
|
9594
|
+
if (anyErr.request) {
|
|
9595
|
+
anyErr.request = void 0;
|
|
9596
|
+
}
|
|
9597
|
+
if (anyErr.response && anyErr.response.request) {
|
|
9598
|
+
anyErr.response.request = void 0;
|
|
9599
|
+
}
|
|
9600
|
+
} catch {
|
|
9601
|
+
}
|
|
9602
|
+
}
|
|
9558
9603
|
|
|
9559
9604
|
// src/config/backend.ts
|
|
9560
9605
|
var DEFAULT_API_BASE_URL = "https://api.volr.io";
|
|
@@ -9627,7 +9672,9 @@ var SessionSync = class {
|
|
|
9627
9672
|
try {
|
|
9628
9673
|
listener(event);
|
|
9629
9674
|
} catch (error) {
|
|
9630
|
-
console.error(
|
|
9675
|
+
console.error(
|
|
9676
|
+
`SessionSync listener error: ${error instanceof Error ? error.message : String(error)}`
|
|
9677
|
+
);
|
|
9631
9678
|
}
|
|
9632
9679
|
}
|
|
9633
9680
|
}
|
|
@@ -9747,6 +9794,17 @@ var PrfNotSupportedError = class _PrfNotSupportedError extends Error {
|
|
|
9747
9794
|
Object.setPrototypeOf(this, _PrfNotSupportedError.prototype);
|
|
9748
9795
|
}
|
|
9749
9796
|
};
|
|
9797
|
+
var WebAuthnBusyError = class _WebAuthnBusyError extends Error {
|
|
9798
|
+
constructor(message) {
|
|
9799
|
+
super(
|
|
9800
|
+
message || "Another passkey authentication is in progress. Please wait a moment and try again."
|
|
9801
|
+
);
|
|
9802
|
+
this.code = "WEBAUTHN_BUSY";
|
|
9803
|
+
this.isRetryable = true;
|
|
9804
|
+
this.name = "WebAuthnBusyError";
|
|
9805
|
+
Object.setPrototypeOf(this, _WebAuthnBusyError.prototype);
|
|
9806
|
+
}
|
|
9807
|
+
};
|
|
9750
9808
|
function isUserCancelledError(error) {
|
|
9751
9809
|
if (error instanceof UserCancelledError) {
|
|
9752
9810
|
return true;
|
|
@@ -9764,8 +9822,40 @@ function isUserCancelledError(error) {
|
|
|
9764
9822
|
}
|
|
9765
9823
|
return false;
|
|
9766
9824
|
}
|
|
9825
|
+
function isWebAuthnBusyError(error) {
|
|
9826
|
+
if (error instanceof WebAuthnBusyError) {
|
|
9827
|
+
return true;
|
|
9828
|
+
}
|
|
9829
|
+
if (error instanceof Error) {
|
|
9830
|
+
const msg = error.message.toLowerCase();
|
|
9831
|
+
if (msg.includes("already in progress") || msg.includes("already pending") || msg.includes("\uC774\uBBF8 \uC694\uCCAD\uC774 \uB300\uAE30 \uC911") || // Korean locale
|
|
9832
|
+
msg.includes("authentication is already in progress") || msg.includes("operation already in progress") || msg.includes("request is already in progress")) {
|
|
9833
|
+
return true;
|
|
9834
|
+
}
|
|
9835
|
+
}
|
|
9836
|
+
return false;
|
|
9837
|
+
}
|
|
9767
9838
|
|
|
9768
9839
|
// src/adapters/passkey.ts
|
|
9840
|
+
var pendingWebAuthnPromise = null;
|
|
9841
|
+
async function withWebAuthnLock(fn) {
|
|
9842
|
+
if (pendingWebAuthnPromise) {
|
|
9843
|
+
try {
|
|
9844
|
+
await pendingWebAuthnPromise;
|
|
9845
|
+
} catch {
|
|
9846
|
+
}
|
|
9847
|
+
}
|
|
9848
|
+
const promise = fn();
|
|
9849
|
+
pendingWebAuthnPromise = promise;
|
|
9850
|
+
try {
|
|
9851
|
+
const result = await promise;
|
|
9852
|
+
return result;
|
|
9853
|
+
} finally {
|
|
9854
|
+
if (pendingWebAuthnPromise === promise) {
|
|
9855
|
+
pendingWebAuthnPromise = null;
|
|
9856
|
+
}
|
|
9857
|
+
}
|
|
9858
|
+
}
|
|
9769
9859
|
function createPasskeyAdapter(options = {}) {
|
|
9770
9860
|
const rpId = options.rpId || (typeof window !== "undefined" ? window.location.hostname : "localhost");
|
|
9771
9861
|
return {
|
|
@@ -9868,72 +9958,83 @@ function createPasskeyAdapter(options = {}) {
|
|
|
9868
9958
|
type: "public-key"
|
|
9869
9959
|
}
|
|
9870
9960
|
];
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9961
|
+
return withWebAuthnLock(async () => {
|
|
9962
|
+
let credential = null;
|
|
9963
|
+
try {
|
|
9964
|
+
credential = await navigator.credentials.get({
|
|
9965
|
+
publicKey: {
|
|
9966
|
+
challenge: crypto.getRandomValues(new Uint8Array(32)),
|
|
9967
|
+
rpId,
|
|
9968
|
+
allowCredentials,
|
|
9969
|
+
userVerification: USER_VERIFICATION,
|
|
9970
|
+
// Shared constant
|
|
9971
|
+
extensions: {
|
|
9972
|
+
prf: {
|
|
9973
|
+
eval: {
|
|
9974
|
+
first: prfInput.salt.buffer
|
|
9975
|
+
}
|
|
9884
9976
|
}
|
|
9885
9977
|
}
|
|
9886
|
-
}
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
})
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9978
|
+
},
|
|
9979
|
+
mediation: CREDENTIAL_MEDIATION
|
|
9980
|
+
// Use shared constant
|
|
9981
|
+
});
|
|
9982
|
+
} catch (error) {
|
|
9983
|
+
console.error("[PasskeyAdapter] WebAuthn get() failed:", error);
|
|
9984
|
+
console.error("[PasskeyAdapter] Error name:", error?.name);
|
|
9985
|
+
console.error("[PasskeyAdapter] Error message:", error?.message);
|
|
9986
|
+
const msg = (error?.message || "").toLowerCase();
|
|
9987
|
+
if (msg.includes("already in progress") || msg.includes("already pending") || msg.includes("\uC774\uBBF8 \uC694\uCCAD\uC774 \uB300\uAE30 \uC911") || // Korean
|
|
9988
|
+
msg.includes("operation already in progress") || msg.includes("request is already in progress")) {
|
|
9989
|
+
throw new WebAuthnBusyError(
|
|
9990
|
+
"Another passkey authentication is in progress. Please wait a moment and try again."
|
|
9991
|
+
);
|
|
9992
|
+
}
|
|
9993
|
+
if (error?.name === "NotAllowedError") {
|
|
9994
|
+
throw new UserCancelledError(
|
|
9995
|
+
"User cancelled the passkey prompt or authentication was denied."
|
|
9996
|
+
);
|
|
9997
|
+
}
|
|
9998
|
+
if (error?.name === "NotFoundError" || error?.name === "InvalidStateError") {
|
|
9999
|
+
throw new PasskeyNotFoundError(
|
|
10000
|
+
"No passkey found matching the provided credentialId. This may happen if the passkey was deleted or the credentialId is incorrect."
|
|
10001
|
+
);
|
|
10002
|
+
}
|
|
10003
|
+
if (error?.name === "NotSupportedError") {
|
|
10004
|
+
throw new PrfNotSupportedError(
|
|
10005
|
+
"WebAuthn PRF extension is not supported by this browser or device. Please use a browser that supports WebAuthn PRF extension (Chrome 108+, Edge 108+, Safari 16.4+)."
|
|
10006
|
+
);
|
|
10007
|
+
}
|
|
10008
|
+
throw new Error(
|
|
10009
|
+
`[PasskeyAdapter] WebAuthn authentication failed: ${error?.message || "Unknown error"}`
|
|
9898
10010
|
);
|
|
9899
10011
|
}
|
|
9900
|
-
if (
|
|
9901
|
-
|
|
9902
|
-
"
|
|
10012
|
+
if (!credential || !credential.response) {
|
|
10013
|
+
console.error(
|
|
10014
|
+
"[PasskeyAdapter] credential is null or missing response"
|
|
10015
|
+
);
|
|
10016
|
+
throw new Error(
|
|
10017
|
+
"[PasskeyAdapter] Failed to get passkey credential for PRF. The passkey prompt may have been cancelled or no matching credential was found."
|
|
9903
10018
|
);
|
|
9904
10019
|
}
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
|
|
10020
|
+
const extensionResults = credential.getClientExtensionResults();
|
|
10021
|
+
if (!extensionResults.prf || !extensionResults.prf.results || !extensionResults.prf.results.first) {
|
|
10022
|
+
throw new Error(
|
|
10023
|
+
"[PasskeyAdapter] PRF extension not supported or PRF output missing"
|
|
9908
10024
|
);
|
|
9909
10025
|
}
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
);
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
}
|
|
9922
|
-
const extensionResults = credential.getClientExtensionResults();
|
|
9923
|
-
if (!extensionResults.prf || !extensionResults.prf.results || !extensionResults.prf.results.first) {
|
|
9924
|
-
throw new Error(
|
|
9925
|
-
"[PasskeyAdapter] PRF extension not supported or PRF output missing"
|
|
9926
|
-
);
|
|
9927
|
-
}
|
|
9928
|
-
const prfOutputBuffer = extensionResults.prf.results.first;
|
|
9929
|
-
const prfOutput = new Uint8Array(prfOutputBuffer);
|
|
9930
|
-
const credentialIdBytes = new Uint8Array(credential.rawId);
|
|
9931
|
-
const credentialIdBase64 = btoa(String.fromCharCode(...credentialIdBytes)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
9932
|
-
console.log("[PasskeyAdapter] WebAuthn prompt completed successfully");
|
|
9933
|
-
return {
|
|
9934
|
-
prfOutput,
|
|
9935
|
-
credentialId: credentialIdBase64
|
|
9936
|
-
};
|
|
10026
|
+
const prfOutputBuffer = extensionResults.prf.results.first;
|
|
10027
|
+
const prfOutput = new Uint8Array(prfOutputBuffer);
|
|
10028
|
+
const credentialIdBytes = new Uint8Array(credential.rawId);
|
|
10029
|
+
const credentialIdBase64 = btoa(
|
|
10030
|
+
String.fromCharCode(...credentialIdBytes)
|
|
10031
|
+
).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
10032
|
+
console.log("[PasskeyAdapter] WebAuthn prompt completed successfully");
|
|
10033
|
+
return {
|
|
10034
|
+
prfOutput,
|
|
10035
|
+
credentialId: credentialIdBase64
|
|
10036
|
+
};
|
|
10037
|
+
});
|
|
9937
10038
|
}
|
|
9938
10039
|
};
|
|
9939
10040
|
}
|
|
@@ -10299,7 +10400,9 @@ function VolrProvider({ config, children }) {
|
|
|
10299
10400
|
setUser((prev) => ({ ...prev, keyStorageType }));
|
|
10300
10401
|
}
|
|
10301
10402
|
} catch (error2) {
|
|
10302
|
-
console.warn(
|
|
10403
|
+
console.warn(
|
|
10404
|
+
`[Provider] setProvider: Failed to refresh user data: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
10405
|
+
);
|
|
10303
10406
|
setUser((prev) => ({ ...prev, keyStorageType }));
|
|
10304
10407
|
}
|
|
10305
10408
|
}
|
|
@@ -18650,7 +18753,9 @@ async function pollTransactionStatus(txId, client, maxAttempts = 60) {
|
|
|
18650
18753
|
const intervalMs = getPollingInterval(attempt);
|
|
18651
18754
|
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
18652
18755
|
} catch (error) {
|
|
18653
|
-
console.error(
|
|
18756
|
+
console.error(
|
|
18757
|
+
`[pollTransactionStatus] Error polling transaction ${txId}: ${error instanceof Error ? error.message : String(error)}`
|
|
18758
|
+
);
|
|
18654
18759
|
const intervalMs = getPollingInterval(attempt);
|
|
18655
18760
|
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
|
18656
18761
|
}
|
|
@@ -18671,6 +18776,11 @@ async function sendCalls(args) {
|
|
|
18671
18776
|
const normalizedFrom = from14;
|
|
18672
18777
|
const normalizedCalls = normalizeCalls(calls);
|
|
18673
18778
|
validateCalls2(normalizedCalls);
|
|
18779
|
+
if (!deps.provider && deps.user?.keyStorageType !== "passkey") {
|
|
18780
|
+
throw new Error(
|
|
18781
|
+
"No wallet provider configured. Please set up a Passkey provider to sign transactions. SIWE is authentication-only."
|
|
18782
|
+
);
|
|
18783
|
+
}
|
|
18674
18784
|
let currentUser = deps.user;
|
|
18675
18785
|
if (deps.user?.keyStorageType === "passkey" && !deps.provider) {
|
|
18676
18786
|
try {
|
|
@@ -18679,7 +18789,9 @@ async function sendCalls(args) {
|
|
|
18679
18789
|
currentUser = refreshedUser;
|
|
18680
18790
|
}
|
|
18681
18791
|
} catch (error) {
|
|
18682
|
-
console.error(
|
|
18792
|
+
console.error(
|
|
18793
|
+
`[sendCalls] Failed to refresh session: ${error instanceof Error ? error.message : String(error)}`
|
|
18794
|
+
);
|
|
18683
18795
|
throw new Error(
|
|
18684
18796
|
`Failed to refresh session before transaction. ${error instanceof Error ? error.message : "Unknown error"}. Please try logging in again.`
|
|
18685
18797
|
);
|
|
@@ -18699,7 +18811,9 @@ async function sendCalls(args) {
|
|
|
18699
18811
|
calls: normalizedCalls
|
|
18700
18812
|
});
|
|
18701
18813
|
} catch (err) {
|
|
18702
|
-
console.error(
|
|
18814
|
+
console.error(
|
|
18815
|
+
`[sendCalls] First precheck failed: ${err instanceof Error ? err.message : String(err)}`
|
|
18816
|
+
);
|
|
18703
18817
|
throw err instanceof Error ? err : new Error(String(err));
|
|
18704
18818
|
}
|
|
18705
18819
|
if (precheckQuote.simulationSuccess === false && precheckQuote.simulationErrors?.length) {
|
|
@@ -19289,7 +19403,9 @@ function useVolrAuthCallback(options = {}) {
|
|
|
19289
19403
|
setIsLoading(false);
|
|
19290
19404
|
options.onSuccess?.(volrUser);
|
|
19291
19405
|
} catch (err) {
|
|
19292
|
-
console.error(
|
|
19406
|
+
console.error(
|
|
19407
|
+
`[useVolrAuthCallback] Token exchange error: ${err instanceof Error ? err.message : String(err)}`
|
|
19408
|
+
);
|
|
19293
19409
|
let errorMsg = "Failed to complete authentication";
|
|
19294
19410
|
if (err instanceof Error) {
|
|
19295
19411
|
if (err.message.includes("AUTH_CODE_EXPIRED")) {
|
|
@@ -19393,7 +19509,9 @@ function useDepositListener(input) {
|
|
|
19393
19509
|
if (cancelled) return;
|
|
19394
19510
|
setStatus({ state: "listening", balance: initial });
|
|
19395
19511
|
} catch (e) {
|
|
19396
|
-
console.error(
|
|
19512
|
+
console.error(
|
|
19513
|
+
`[DepositListener] Error: ${e instanceof Error ? e.message : String(e)}`
|
|
19514
|
+
);
|
|
19397
19515
|
if (cancelled) return;
|
|
19398
19516
|
setStatus({ state: "error", message: e.message || String(e) });
|
|
19399
19517
|
return;
|
|
@@ -19429,7 +19547,9 @@ function useDepositListener(input) {
|
|
|
19429
19547
|
return prev;
|
|
19430
19548
|
});
|
|
19431
19549
|
} catch (err) {
|
|
19432
|
-
console.error(
|
|
19550
|
+
console.error(
|
|
19551
|
+
`[DepositListener] Polling error: ${err instanceof Error ? err.message : String(err)}`
|
|
19552
|
+
);
|
|
19433
19553
|
if (cancelled) return;
|
|
19434
19554
|
setStatus({ state: "error", message: err.message || String(err) });
|
|
19435
19555
|
}
|
|
@@ -20062,7 +20182,9 @@ function useUserBalances() {
|
|
|
20062
20182
|
});
|
|
20063
20183
|
setBalances(initialBalances);
|
|
20064
20184
|
}).catch((err) => {
|
|
20065
|
-
console.error(
|
|
20185
|
+
console.error(
|
|
20186
|
+
`[useUserBalances] Failed to fetch branding: ${err instanceof Error ? err.message : String(err)}`
|
|
20187
|
+
);
|
|
20066
20188
|
setError(err instanceof Error ? err : new Error("Failed to fetch branding"));
|
|
20067
20189
|
}).finally(() => {
|
|
20068
20190
|
setIsLoadingBranding(false);
|
|
@@ -20103,7 +20225,9 @@ function useUserBalances() {
|
|
|
20103
20225
|
error: void 0
|
|
20104
20226
|
};
|
|
20105
20227
|
} catch (err) {
|
|
20106
|
-
console.error(
|
|
20228
|
+
console.error(
|
|
20229
|
+
`[useUserBalances] Failed to fetch balance for ${id}: ${err instanceof Error ? err.message : String(err)}`
|
|
20230
|
+
);
|
|
20107
20231
|
return {
|
|
20108
20232
|
id,
|
|
20109
20233
|
balanceRaw: 0n,
|
|
@@ -21126,6 +21250,6 @@ function detectWalletConnector(provider, providerInfo) {
|
|
|
21126
21250
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
21127
21251
|
*/
|
|
21128
21252
|
|
|
21129
|
-
export { DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, PasskeyNotFoundError, PrfNotSupportedError, UserCancelledError, VolrProvider, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isUserCancelledError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useWithdraw };
|
|
21253
|
+
export { DEFAULT_EXPIRES_IN_SEC, DEFAULT_MODE, PasskeyNotFoundError, PrfNotSupportedError, UserCancelledError, VolrProvider, WebAuthnBusyError, analyzeContractForEIP7702, buildCall, buildCalls, checkPrfCompatibility, checkPrfExtensionAvailable, checkPrfSupport, compareERC20Balances, compareWalletStates, completeMigration, createGetNetworkInfo, createPasskeyAdapter, debugTransactionFailure, decryptEntropyForMigration, defaultIdempotencyKey, detectWalletConnector, diagnoseTransactionFailure, getBrowserVersion, getERC20Balance, getIOSVersion, getPasskeyAuthGuidance, getPlatformHint, getUserCredentials, getWalletState, isEIP7702Delegated, isInAppBrowser, isUserCancelledError, isWebAuthnBusyError, listenForSeedRequests, normalizeHex, normalizeHexArray, openMigrationPopup, requestMigration, requestSeedFromOpener, sendSeedToPopup, uploadBlobViaPresign, useDepositListener, useEIP6963, useInternalAuth, useMpcConnection, usePasskeyEnrollment, usePrecheck, useRelay, useUserBalances, useVolr, useVolrAuthCallback, useVolrContext, useVolrLogin, useVolrPaymentApi, useWithdraw };
|
|
21130
21254
|
//# sourceMappingURL=index.js.map
|
|
21131
21255
|
//# sourceMappingURL=index.js.map
|