@dubsdotapp/expo 0.2.23 → 0.2.25
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.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +73 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -54
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/managed-wallet.tsx +4 -6
- package/src/wallet/mwa-adapter.ts +7 -3
package/dist/index.d.mts
CHANGED
|
@@ -577,6 +577,8 @@ declare class MwaWalletAdapter implements WalletAdapter {
|
|
|
577
577
|
private _publicKey;
|
|
578
578
|
private _connected;
|
|
579
579
|
private _authToken;
|
|
580
|
+
/** The raw base64-encoded address from MWA authorize — needed for signMessages */
|
|
581
|
+
private _mwaAddress;
|
|
580
582
|
private readonly config;
|
|
581
583
|
private readonly transact;
|
|
582
584
|
constructor(config: MwaAdapterConfig);
|
package/dist/index.d.ts
CHANGED
|
@@ -577,6 +577,8 @@ declare class MwaWalletAdapter implements WalletAdapter {
|
|
|
577
577
|
private _publicKey;
|
|
578
578
|
private _connected;
|
|
579
579
|
private _authToken;
|
|
580
|
+
/** The raw base64-encoded address from MWA authorize — needed for signMessages */
|
|
581
|
+
private _mwaAddress;
|
|
580
582
|
private readonly config;
|
|
581
583
|
private readonly transact;
|
|
582
584
|
constructor(config: MwaAdapterConfig);
|
package/dist/index.js
CHANGED
|
@@ -561,7 +561,7 @@ var import_web34 = require("@solana/web3.js");
|
|
|
561
561
|
|
|
562
562
|
// src/managed-wallet.tsx
|
|
563
563
|
var import_react = require("react");
|
|
564
|
-
var
|
|
564
|
+
var import_react_native4 = require("react-native");
|
|
565
565
|
|
|
566
566
|
// src/wallet/mwa-adapter.ts
|
|
567
567
|
var import_web3 = require("@solana/web3.js");
|
|
@@ -577,6 +577,8 @@ var MwaWalletAdapter = class {
|
|
|
577
577
|
this._publicKey = null;
|
|
578
578
|
this._connected = false;
|
|
579
579
|
this._authToken = null;
|
|
580
|
+
/** The raw base64-encoded address from MWA authorize — needed for signMessages */
|
|
581
|
+
this._mwaAddress = null;
|
|
580
582
|
this.config = config;
|
|
581
583
|
this.transact = config.transact;
|
|
582
584
|
}
|
|
@@ -601,7 +603,8 @@ var MwaWalletAdapter = class {
|
|
|
601
603
|
identity: this.config.appIdentity,
|
|
602
604
|
cluster: this.config.cluster || "mainnet-beta"
|
|
603
605
|
});
|
|
604
|
-
this.
|
|
606
|
+
this._mwaAddress = authResult.accounts[0].address;
|
|
607
|
+
this._publicKey = toPublicKey(this._mwaAddress);
|
|
605
608
|
this._authToken = authResult.auth_token;
|
|
606
609
|
this._connected = true;
|
|
607
610
|
this.config.onAuthTokenChange?.(this._authToken);
|
|
@@ -614,6 +617,7 @@ var MwaWalletAdapter = class {
|
|
|
614
617
|
this._publicKey = null;
|
|
615
618
|
this._connected = false;
|
|
616
619
|
this._authToken = null;
|
|
620
|
+
this._mwaAddress = null;
|
|
617
621
|
this.config.onAuthTokenChange?.(null);
|
|
618
622
|
}
|
|
619
623
|
async signTransaction(transaction) {
|
|
@@ -630,13 +634,13 @@ var MwaWalletAdapter = class {
|
|
|
630
634
|
return signed;
|
|
631
635
|
}
|
|
632
636
|
async signMessage(message) {
|
|
633
|
-
if (!this._connected || !this._publicKey) throw new Error("Wallet not connected");
|
|
637
|
+
if (!this._connected || !this._publicKey || !this._mwaAddress) throw new Error("Wallet not connected");
|
|
634
638
|
const sig = await this.transact(async (wallet) => {
|
|
635
639
|
const reauth = await wallet.reauthorize({ auth_token: this._authToken });
|
|
636
640
|
this._authToken = reauth.auth_token;
|
|
637
641
|
this.config.onAuthTokenChange?.(this._authToken);
|
|
638
642
|
const result = await wallet.signMessages({
|
|
639
|
-
addresses: [this.
|
|
643
|
+
addresses: [this._mwaAddress],
|
|
640
644
|
payloads: [message]
|
|
641
645
|
});
|
|
642
646
|
return result[0];
|
|
@@ -1119,58 +1123,11 @@ var PhantomDeeplinkAdapter = class {
|
|
|
1119
1123
|
}
|
|
1120
1124
|
};
|
|
1121
1125
|
|
|
1122
|
-
// src/utils/device.ts
|
|
1123
|
-
var import_react_native2 = require("react-native");
|
|
1124
|
-
function isSolanaSeeker() {
|
|
1125
|
-
try {
|
|
1126
|
-
const Device = require("expo-device");
|
|
1127
|
-
return Device.brand?.toLowerCase() === "solanamobile";
|
|
1128
|
-
} catch {
|
|
1129
|
-
return false;
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
async function getDeviceInfo() {
|
|
1133
|
-
try {
|
|
1134
|
-
const Device = require("expo-device");
|
|
1135
|
-
return {
|
|
1136
|
-
platform: import_react_native2.Platform.OS,
|
|
1137
|
-
modelName: Device.modelName,
|
|
1138
|
-
brand: Device.brand,
|
|
1139
|
-
manufacturer: Device.manufacturer,
|
|
1140
|
-
osName: Device.osName,
|
|
1141
|
-
osVersion: Device.osVersion,
|
|
1142
|
-
deviceType: Device.deviceType,
|
|
1143
|
-
deviceName: Device.deviceName,
|
|
1144
|
-
totalMemory: Device.totalMemory,
|
|
1145
|
-
modelId: Device.modelId,
|
|
1146
|
-
designName: Device.designName,
|
|
1147
|
-
productName: Device.productName,
|
|
1148
|
-
isDevice: Device.isDevice
|
|
1149
|
-
};
|
|
1150
|
-
} catch {
|
|
1151
|
-
return {
|
|
1152
|
-
platform: import_react_native2.Platform.OS,
|
|
1153
|
-
modelName: null,
|
|
1154
|
-
brand: null,
|
|
1155
|
-
manufacturer: null,
|
|
1156
|
-
osName: null,
|
|
1157
|
-
osVersion: null,
|
|
1158
|
-
deviceType: null,
|
|
1159
|
-
deviceName: null,
|
|
1160
|
-
totalMemory: null,
|
|
1161
|
-
modelId: null,
|
|
1162
|
-
designName: null,
|
|
1163
|
-
productName: null,
|
|
1164
|
-
isDevice: null
|
|
1165
|
-
};
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
1126
|
// src/ui/ConnectWalletScreen.tsx
|
|
1170
|
-
var
|
|
1127
|
+
var import_react_native3 = require("react-native");
|
|
1171
1128
|
|
|
1172
1129
|
// src/ui/theme.ts
|
|
1173
|
-
var
|
|
1130
|
+
var import_react_native2 = require("react-native");
|
|
1174
1131
|
var dark = {
|
|
1175
1132
|
background: "#08080D",
|
|
1176
1133
|
surface: "#111118",
|
|
@@ -1204,7 +1161,7 @@ var light = {
|
|
|
1204
1161
|
errorBorder: "#FECACA"
|
|
1205
1162
|
};
|
|
1206
1163
|
function useDubsTheme() {
|
|
1207
|
-
const scheme = (0,
|
|
1164
|
+
const scheme = (0, import_react_native2.useColorScheme)();
|
|
1208
1165
|
return scheme === "light" ? light : dark;
|
|
1209
1166
|
}
|
|
1210
1167
|
function mergeTheme(base, overrides) {
|
|
@@ -1224,44 +1181,44 @@ function ConnectWalletScreen({
|
|
|
1224
1181
|
}) {
|
|
1225
1182
|
const t = useDubsTheme();
|
|
1226
1183
|
const accent = accentColor || t.accent;
|
|
1227
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1228
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { style: [styles.container, { backgroundColor: t.background }], children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native3.View, { style: styles.content, children: [
|
|
1185
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native3.View, { style: styles.brandingSection, children: [
|
|
1229
1186
|
appIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1230
|
-
|
|
1187
|
+
import_react_native3.Image,
|
|
1231
1188
|
{
|
|
1232
1189
|
source: { uri: appIcon },
|
|
1233
1190
|
style: styles.logoImage
|
|
1234
1191
|
}
|
|
1235
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1236
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1237
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1192
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.View, { style: [styles.logoCircle, { backgroundColor: accent }], children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.Text, { style: styles.logoText, children: appName.charAt(0).toUpperCase() }) }),
|
|
1193
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.Text, { style: [styles.appName, { color: t.text }], children: appName }),
|
|
1194
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.Text, { style: [styles.subtitle, { color: t.textMuted }], children: tagline || "Connect your Solana wallet to get started" })
|
|
1238
1195
|
] }),
|
|
1239
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1196
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_native3.View, { style: styles.actionSection, children: [
|
|
1240
1197
|
error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1241
|
-
|
|
1198
|
+
import_react_native3.View,
|
|
1242
1199
|
{
|
|
1243
1200
|
style: [
|
|
1244
1201
|
styles.errorBox,
|
|
1245
1202
|
{ backgroundColor: t.errorBg, borderColor: t.errorBorder }
|
|
1246
1203
|
],
|
|
1247
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1204
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.Text, { style: [styles.errorText, { color: t.errorText }], children: error })
|
|
1248
1205
|
}
|
|
1249
1206
|
) : null,
|
|
1250
1207
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1251
|
-
|
|
1208
|
+
import_react_native3.TouchableOpacity,
|
|
1252
1209
|
{
|
|
1253
1210
|
style: [styles.connectButton, { backgroundColor: accent }],
|
|
1254
1211
|
onPress: onConnect,
|
|
1255
1212
|
disabled: connecting,
|
|
1256
1213
|
activeOpacity: 0.8,
|
|
1257
|
-
children: connecting ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1214
|
+
children: connecting ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.ActivityIndicator, { color: "#FFFFFF", size: "small" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.Text, { style: styles.connectButtonText, children: "Connect Wallet" })
|
|
1258
1215
|
}
|
|
1259
1216
|
),
|
|
1260
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1217
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native3.Text, { style: [styles.hint, { color: t.textDim }], children: "Phantom, Solflare, or any Solana wallet" })
|
|
1261
1218
|
] })
|
|
1262
1219
|
] }) });
|
|
1263
1220
|
}
|
|
1264
|
-
var styles =
|
|
1221
|
+
var styles = import_react_native3.StyleSheet.create({
|
|
1265
1222
|
container: {
|
|
1266
1223
|
flex: 1,
|
|
1267
1224
|
justifyContent: "center"
|
|
@@ -1384,9 +1341,8 @@ function ManagedWalletProvider({
|
|
|
1384
1341
|
const [connecting, setConnecting] = (0, import_react.useState)(false);
|
|
1385
1342
|
const [isReady, setIsReady] = (0, import_react.useState)(false);
|
|
1386
1343
|
const [error, setError] = (0, import_react.useState)(null);
|
|
1387
|
-
const
|
|
1388
|
-
|
|
1389
|
-
console.log(TAG3, `Platform: ${import_react_native5.Platform.OS}, seeker: ${seeker}, redirectUri: ${redirectUri ? "provided" : "not set"}, usePhantom: ${usePhantom}`);
|
|
1344
|
+
const usePhantom = import_react_native4.Platform.OS === "ios" && !!redirectUri;
|
|
1345
|
+
console.log(TAG3, `Platform: ${import_react_native4.Platform.OS}, redirectUri: ${redirectUri ? "provided" : "not set"}, usePhantom: ${usePhantom}`);
|
|
1390
1346
|
const adapterRef = (0, import_react.useRef)(null);
|
|
1391
1347
|
const transactRef = (0, import_react.useRef)(null);
|
|
1392
1348
|
if (!adapterRef.current) {
|
|
@@ -1946,6 +1902,53 @@ var import_bs583 = __toESM(require("bs58"));
|
|
|
1946
1902
|
var import_react10 = require("react");
|
|
1947
1903
|
var AuthContext = (0, import_react10.createContext)(null);
|
|
1948
1904
|
|
|
1905
|
+
// src/utils/device.ts
|
|
1906
|
+
var import_react_native5 = require("react-native");
|
|
1907
|
+
function isSolanaSeeker() {
|
|
1908
|
+
try {
|
|
1909
|
+
const Device = require("expo-device");
|
|
1910
|
+
return Device.brand?.toLowerCase() === "solanamobile";
|
|
1911
|
+
} catch {
|
|
1912
|
+
return false;
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
async function getDeviceInfo() {
|
|
1916
|
+
try {
|
|
1917
|
+
const Device = require("expo-device");
|
|
1918
|
+
return {
|
|
1919
|
+
platform: import_react_native5.Platform.OS,
|
|
1920
|
+
modelName: Device.modelName,
|
|
1921
|
+
brand: Device.brand,
|
|
1922
|
+
manufacturer: Device.manufacturer,
|
|
1923
|
+
osName: Device.osName,
|
|
1924
|
+
osVersion: Device.osVersion,
|
|
1925
|
+
deviceType: Device.deviceType,
|
|
1926
|
+
deviceName: Device.deviceName,
|
|
1927
|
+
totalMemory: Device.totalMemory,
|
|
1928
|
+
modelId: Device.modelId,
|
|
1929
|
+
designName: Device.designName,
|
|
1930
|
+
productName: Device.productName,
|
|
1931
|
+
isDevice: Device.isDevice
|
|
1932
|
+
};
|
|
1933
|
+
} catch {
|
|
1934
|
+
return {
|
|
1935
|
+
platform: import_react_native5.Platform.OS,
|
|
1936
|
+
modelName: null,
|
|
1937
|
+
brand: null,
|
|
1938
|
+
manufacturer: null,
|
|
1939
|
+
osName: null,
|
|
1940
|
+
osVersion: null,
|
|
1941
|
+
deviceType: null,
|
|
1942
|
+
deviceName: null,
|
|
1943
|
+
totalMemory: null,
|
|
1944
|
+
modelId: null,
|
|
1945
|
+
designName: null,
|
|
1946
|
+
productName: null,
|
|
1947
|
+
isDevice: null
|
|
1948
|
+
};
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1949
1952
|
// src/hooks/useAuth.ts
|
|
1950
1953
|
function useAuth() {
|
|
1951
1954
|
const sharedAuth = (0, import_react11.useContext)(AuthContext);
|