@dubsdotapp/expo 0.2.46 → 0.2.47
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.js +35 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/managed-wallet.tsx +49 -5
package/dist/index.js
CHANGED
|
@@ -1382,6 +1382,32 @@ var styles = import_react_native3.StyleSheet.create({
|
|
|
1382
1382
|
// src/managed-wallet.tsx
|
|
1383
1383
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1384
1384
|
var TAG3 = "[Dubs:ManagedWallet]";
|
|
1385
|
+
function getDefaultRedirectUri() {
|
|
1386
|
+
if (import_react_native4.Platform.OS !== "ios") return void 0;
|
|
1387
|
+
try {
|
|
1388
|
+
const expoLinking = require("expo-linking");
|
|
1389
|
+
if (expoLinking.createURL) {
|
|
1390
|
+
const uri = expoLinking.createURL("phantom-callback");
|
|
1391
|
+
console.log(TAG3, "Auto-detected redirect URI via expo-linking:", uri);
|
|
1392
|
+
return uri;
|
|
1393
|
+
}
|
|
1394
|
+
} catch (e) {
|
|
1395
|
+
console.log(TAG3, "expo-linking createURL failed:", e instanceof Error ? e.message : e);
|
|
1396
|
+
}
|
|
1397
|
+
try {
|
|
1398
|
+
const Constants = require("expo-constants").default;
|
|
1399
|
+
const scheme = Constants.expoConfig?.scheme;
|
|
1400
|
+
if (scheme) {
|
|
1401
|
+
const uri = `${scheme}://phantom-callback`;
|
|
1402
|
+
console.log(TAG3, "Auto-detected redirect URI via expo-constants:", uri);
|
|
1403
|
+
return uri;
|
|
1404
|
+
}
|
|
1405
|
+
} catch (e) {
|
|
1406
|
+
console.log(TAG3, "expo-constants fallback failed:", e instanceof Error ? e.message : e);
|
|
1407
|
+
}
|
|
1408
|
+
console.log(TAG3, "Could not auto-detect redirect URI on iOS \u2014 pass redirectUri to DubsProvider");
|
|
1409
|
+
return void 0;
|
|
1410
|
+
}
|
|
1385
1411
|
var phantomSingleton = null;
|
|
1386
1412
|
function getOrCreatePhantomAdapter(config) {
|
|
1387
1413
|
if (!phantomSingleton) {
|
|
@@ -1428,14 +1454,20 @@ function ManagedWalletProvider({
|
|
|
1428
1454
|
const [connecting, setConnecting] = (0, import_react2.useState)(false);
|
|
1429
1455
|
const [isReady, setIsReady] = (0, import_react2.useState)(false);
|
|
1430
1456
|
const [error, setError] = (0, import_react2.useState)(null);
|
|
1431
|
-
const usePhantom = import_react_native4.Platform.OS === "ios"
|
|
1432
|
-
|
|
1457
|
+
const usePhantom = import_react_native4.Platform.OS === "ios";
|
|
1458
|
+
const resolvedRedirectUri = usePhantom ? redirectUri || getDefaultRedirectUri() : void 0;
|
|
1459
|
+
console.log(TAG3, `Platform: ${import_react_native4.Platform.OS}, redirectUri: ${resolvedRedirectUri ?? "none"} (explicit: ${!!redirectUri}), usePhantom: ${usePhantom}`);
|
|
1433
1460
|
const adapterRef = (0, import_react2.useRef)(null);
|
|
1434
1461
|
const transactRef = (0, import_react2.useRef)(null);
|
|
1435
1462
|
if (!adapterRef.current) {
|
|
1436
1463
|
if (usePhantom) {
|
|
1464
|
+
if (!resolvedRedirectUri) {
|
|
1465
|
+
throw new Error(
|
|
1466
|
+
'@dubsdotapp/expo: Could not auto-detect redirect URI on iOS. Either set a "scheme" in your app.json or pass redirectUri to <DubsProvider>.'
|
|
1467
|
+
);
|
|
1468
|
+
}
|
|
1437
1469
|
adapterRef.current = getOrCreatePhantomAdapter({
|
|
1438
|
-
redirectUri,
|
|
1470
|
+
redirectUri: resolvedRedirectUri,
|
|
1439
1471
|
appUrl,
|
|
1440
1472
|
cluster,
|
|
1441
1473
|
storage
|