@bit-buccaneers/wallet-abstraction 0.0.13 → 0.0.15
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/dev.js +44 -32
- package/dist/dev.jsx +43 -31
- package/dist/index.js +44 -32
- package/dist/index.jsx +43 -31
- package/dist/lib/connectors/index.d.ts +2 -2
- package/dist/lib/connectors/okx.d.ts +1 -0
- package/dist/lib/connectors/rabby.d.ts +2 -0
- package/dist/lib/wallets/config.d.ts +1 -1
- package/package.json +1 -1
- package/dist/lib/connectors/exodus.d.ts +0 -5
package/dist/dev.js
CHANGED
|
@@ -150,12 +150,6 @@ var WALLETS = [
|
|
|
150
150
|
icon: "https://iconic.dynamic-static-assets.com/icons/sprite.svg#rainbow",
|
|
151
151
|
chromeExtensionUrl: "https://chromewebstore.google.com/detail/rainbow/opfgelmcmbiajamepnmloijbpoleiama"
|
|
152
152
|
},
|
|
153
|
-
{
|
|
154
|
-
id: "exodus",
|
|
155
|
-
name: "Exodus",
|
|
156
|
-
icon: "https://iconic.dynamic-static-assets.com/icons/sprite.svg#exodus",
|
|
157
|
-
chromeExtensionUrl: "https://chromewebstore.google.com/detail/aholpfdialjgjfhomihkjbmgjidlcdno"
|
|
158
|
-
},
|
|
159
153
|
{
|
|
160
154
|
id: "walletconnect",
|
|
161
155
|
name: "WalletConnect",
|
|
@@ -174,14 +168,12 @@ var EVM_WALLET_ID_MAP = {
|
|
|
174
168
|
coinbaseWalletSDK: "coinbase",
|
|
175
169
|
"io.rabby": "rabby",
|
|
176
170
|
"me.rainbow": "rainbow",
|
|
177
|
-
"com.exodus.web3-wallet": "exodus",
|
|
178
171
|
walletConnect: "walletconnect"
|
|
179
172
|
};
|
|
180
173
|
var SOLANA_WALLET_ID_MAP = {
|
|
181
174
|
"binance-wallet": "binance",
|
|
182
175
|
"bitget-wallet": "bitget",
|
|
183
|
-
"okx-wallet": "okx"
|
|
184
|
-
"exodus-wallet": "exodus"
|
|
176
|
+
"okx-wallet": "okx"
|
|
185
177
|
};
|
|
186
178
|
var normalizeEvmWalletId = (id) => EVM_WALLET_ID_MAP[id] || id.toLowerCase().replace(/sdk$/i, "");
|
|
187
179
|
var normalizeSolanaWalletId = (id) => SOLANA_WALLET_ID_MAP[id] || id.replace(/-wallet$/, "");
|
|
@@ -763,8 +755,27 @@ var STORAGE_KEYS2 = {
|
|
|
763
755
|
SESSION: "phantom_mobile_session",
|
|
764
756
|
SIGN_PENDING: "phantom_mobile_sign_pending"
|
|
765
757
|
};
|
|
766
|
-
WALLETS.find((i) => i.id === "phantom");
|
|
758
|
+
var phantomWalletConfig = WALLETS.find((i) => i.id === "phantom");
|
|
767
759
|
var createPhantomEvmConnector = () => createDownloadOnlyEvmConnector({ walletId: "phantom" });
|
|
760
|
+
var createPhantomEvmConnectorDeeplink = () => ({
|
|
761
|
+
...phantomWalletConfig,
|
|
762
|
+
type: "evm",
|
|
763
|
+
wallet: {
|
|
764
|
+
_connector: null,
|
|
765
|
+
connect: async () => {
|
|
766
|
+
const currentUrl = encodeURIComponent(window.location.href);
|
|
767
|
+
window.location.href = `${PHANTOM_BROWSE_URL}/${currentUrl}?ref=${encodeURIComponent(
|
|
768
|
+
window.location.origin
|
|
769
|
+
)}`;
|
|
770
|
+
return pendingResult();
|
|
771
|
+
},
|
|
772
|
+
disconnect: async () => {
|
|
773
|
+
},
|
|
774
|
+
signMessage: async () => {
|
|
775
|
+
throw new Error("signMessage not supported via mobile deeplink");
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
});
|
|
768
779
|
var createPhantomSolanaConnector = () => createDownloadOnlySolanaConnector({ walletId: "phantom" });
|
|
769
780
|
var isPhantomMobilePending = () => storage.getString(STORAGE_KEYS2.PENDING) === "1";
|
|
770
781
|
var handlePhantomMobileCallback = () => handleMobileCallback(PHANTOM_CONFIG, STORAGE_KEYS2.PENDING, STORAGE_KEYS2.SESSION);
|
|
@@ -855,14 +866,8 @@ var RAINBOW_CONFIG = {
|
|
|
855
866
|
};
|
|
856
867
|
var createRainbowEvmMobileConnector = () => createWcEvmConnector(RAINBOW_CONFIG);
|
|
857
868
|
|
|
858
|
-
// src/lib/connectors/
|
|
859
|
-
var
|
|
860
|
-
walletId: "exodus",
|
|
861
|
-
wcDeeplink: "https://exodus.com/wc",
|
|
862
|
-
injectedKey: "isExodus"
|
|
863
|
-
};
|
|
864
|
-
var createExodusEvmMobileConnector = () => createWcEvmConnector(EXODUS_CONFIG);
|
|
865
|
-
var createExodusSolanaMobileConnector = () => createWcSolanaConnector(EXODUS_CONFIG);
|
|
869
|
+
// src/lib/connectors/rabby.ts
|
|
870
|
+
var createRabbyEvmConnector = () => createDownloadOnlyEvmConnector({ walletId: "rabby" });
|
|
866
871
|
|
|
867
872
|
// src/lib/connectors/binance.ts
|
|
868
873
|
var BINANCE_CONFIG = {
|
|
@@ -886,6 +891,7 @@ var createOkxSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector
|
|
|
886
891
|
injectedKey: "isOkxWallet",
|
|
887
892
|
buildUrl: buildOkxBrowseUrl
|
|
888
893
|
});
|
|
894
|
+
var createOkxSolanaConnector = () => createDownloadOnlySolanaConnector({ walletId: "okx" });
|
|
889
895
|
|
|
890
896
|
// src/lib/connectors/coinbase.ts
|
|
891
897
|
var buildCoinbaseBrowseUrl = () => `cbwallet://dapp?url=${encodeURIComponent(window.location.href)}`;
|
|
@@ -986,14 +992,29 @@ var createWalletConnectSolanaConnector = () => {
|
|
|
986
992
|
|
|
987
993
|
// src/lib/evm/connectors.ts
|
|
988
994
|
var EVM_FALLBACK_CONNECTORS = [
|
|
989
|
-
{
|
|
990
|
-
|
|
995
|
+
{
|
|
996
|
+
id: "phantom",
|
|
997
|
+
create: isMobile() ? createPhantomEvmConnectorDeeplink : createPhantomEvmConnector
|
|
998
|
+
},
|
|
999
|
+
...isMobile() ? [] : [{ id: "metamask", create: createMetaMaskEvmConnector }],
|
|
991
1000
|
{ id: "trust", create: createTrustEvmMobileConnector },
|
|
992
1001
|
{ id: "binance", create: createBinanceEvmConnector },
|
|
993
1002
|
{ id: "rainbow", create: createRainbowEvmMobileConnector },
|
|
994
|
-
{ id: "
|
|
1003
|
+
...isMobile() ? [] : [{ id: "rabby", create: createRabbyEvmConnector }]
|
|
995
1004
|
];
|
|
996
1005
|
var sleep = (ms) => new Promise((r) => window.setTimeout(r, ms));
|
|
1006
|
+
var checkEvmWalletInstalled = (connectorId) => {
|
|
1007
|
+
if (typeof window === "undefined" || !window.ethereum) return false;
|
|
1008
|
+
const providers = window.ethereum.providers ?? [window.ethereum];
|
|
1009
|
+
switch (connectorId) {
|
|
1010
|
+
case "metaMaskSDK":
|
|
1011
|
+
return providers.some((p) => p.isMetaMask && !p.isBraveWallet);
|
|
1012
|
+
case "coinbaseWalletSDK":
|
|
1013
|
+
return providers.some((p) => p.isCoinbaseWallet);
|
|
1014
|
+
default:
|
|
1015
|
+
return true;
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
997
1018
|
var cleanupWalletLocalStorage = () => {
|
|
998
1019
|
Object.keys(window.localStorage).filter((key) => key.startsWith("wagmi.")).forEach((key) => window.localStorage.removeItem(key));
|
|
999
1020
|
};
|
|
@@ -1004,7 +1025,7 @@ var getEvmConnectors = () => {
|
|
|
1004
1025
|
name: c.name,
|
|
1005
1026
|
icon: c.icon,
|
|
1006
1027
|
type: "evm",
|
|
1007
|
-
installed:
|
|
1028
|
+
installed: checkEvmWalletInstalled(c.id),
|
|
1008
1029
|
wallet: {
|
|
1009
1030
|
_connector: c,
|
|
1010
1031
|
connect: async () => {
|
|
@@ -1206,10 +1227,6 @@ var SOLANA_FALLBACK_CONNECTORS = isMobile() ? [
|
|
|
1206
1227
|
{
|
|
1207
1228
|
id: "binance",
|
|
1208
1229
|
create: () => createSolanaMobileConnector(createBinanceSolanaDappBrowserConnector())
|
|
1209
|
-
},
|
|
1210
|
-
{
|
|
1211
|
-
id: "exodus",
|
|
1212
|
-
create: () => createSolanaMobileConnector(createExodusSolanaMobileConnector())
|
|
1213
1230
|
}
|
|
1214
1231
|
] : [
|
|
1215
1232
|
{ id: "phantom", create: () => createSolanaMobileConnector(createPhantomSolanaConnector()) },
|
|
@@ -1223,10 +1240,7 @@ var SOLANA_FALLBACK_CONNECTORS = isMobile() ? [
|
|
|
1223
1240
|
},
|
|
1224
1241
|
{ id: "binance", create: () => createSolanaMobileConnector(createBinanceSolanaConnector()) },
|
|
1225
1242
|
{ id: "bitget", create: createBitgetSolanaConnector },
|
|
1226
|
-
{
|
|
1227
|
-
id: "exodus",
|
|
1228
|
-
create: () => createSolanaMobileConnector(createExodusSolanaMobileConnector())
|
|
1229
|
-
}
|
|
1243
|
+
{ id: "okx", create: createOkxSolanaConnector }
|
|
1230
1244
|
];
|
|
1231
1245
|
var getSolanaWallets = () => {
|
|
1232
1246
|
const { get } = getWallets();
|
|
@@ -1239,8 +1253,6 @@ var getSolanaWallets = () => {
|
|
|
1239
1253
|
seenNames.add(w.name);
|
|
1240
1254
|
return true;
|
|
1241
1255
|
}).map(createSolanaConnector);
|
|
1242
|
-
console.log("wallets", { wallets });
|
|
1243
|
-
console.log("connectors", { connectors });
|
|
1244
1256
|
addFallbackConnectors(connectors, SOLANA_FALLBACK_CONNECTORS);
|
|
1245
1257
|
return connectors;
|
|
1246
1258
|
};
|
package/dist/dev.jsx
CHANGED
|
@@ -145,12 +145,6 @@ var WALLETS = [
|
|
|
145
145
|
icon: "https://iconic.dynamic-static-assets.com/icons/sprite.svg#rainbow",
|
|
146
146
|
chromeExtensionUrl: "https://chromewebstore.google.com/detail/rainbow/opfgelmcmbiajamepnmloijbpoleiama"
|
|
147
147
|
},
|
|
148
|
-
{
|
|
149
|
-
id: "exodus",
|
|
150
|
-
name: "Exodus",
|
|
151
|
-
icon: "https://iconic.dynamic-static-assets.com/icons/sprite.svg#exodus",
|
|
152
|
-
chromeExtensionUrl: "https://chromewebstore.google.com/detail/aholpfdialjgjfhomihkjbmgjidlcdno"
|
|
153
|
-
},
|
|
154
148
|
{
|
|
155
149
|
id: "walletconnect",
|
|
156
150
|
name: "WalletConnect",
|
|
@@ -169,14 +163,12 @@ var EVM_WALLET_ID_MAP = {
|
|
|
169
163
|
coinbaseWalletSDK: "coinbase",
|
|
170
164
|
"io.rabby": "rabby",
|
|
171
165
|
"me.rainbow": "rainbow",
|
|
172
|
-
"com.exodus.web3-wallet": "exodus",
|
|
173
166
|
walletConnect: "walletconnect"
|
|
174
167
|
};
|
|
175
168
|
var SOLANA_WALLET_ID_MAP = {
|
|
176
169
|
"binance-wallet": "binance",
|
|
177
170
|
"bitget-wallet": "bitget",
|
|
178
|
-
"okx-wallet": "okx"
|
|
179
|
-
"exodus-wallet": "exodus"
|
|
171
|
+
"okx-wallet": "okx"
|
|
180
172
|
};
|
|
181
173
|
var normalizeEvmWalletId = (id) => EVM_WALLET_ID_MAP[id] || id.toLowerCase().replace(/sdk$/i, "");
|
|
182
174
|
var normalizeSolanaWalletId = (id) => SOLANA_WALLET_ID_MAP[id] || id.replace(/-wallet$/, "");
|
|
@@ -773,6 +765,25 @@ var STORAGE_KEYS2 = {
|
|
|
773
765
|
};
|
|
774
766
|
var phantomWalletConfig = WALLETS.find((i) => i.id === "phantom");
|
|
775
767
|
var createPhantomEvmConnector = () => createDownloadOnlyEvmConnector({ walletId: "phantom" });
|
|
768
|
+
var createPhantomEvmConnectorDeeplink = () => ({
|
|
769
|
+
...phantomWalletConfig,
|
|
770
|
+
type: "evm",
|
|
771
|
+
wallet: {
|
|
772
|
+
_connector: null,
|
|
773
|
+
connect: async () => {
|
|
774
|
+
const currentUrl = encodeURIComponent(window.location.href);
|
|
775
|
+
window.location.href = `${PHANTOM_BROWSE_URL}/${currentUrl}?ref=${encodeURIComponent(
|
|
776
|
+
window.location.origin
|
|
777
|
+
)}`;
|
|
778
|
+
return pendingResult();
|
|
779
|
+
},
|
|
780
|
+
disconnect: async () => {
|
|
781
|
+
},
|
|
782
|
+
signMessage: async () => {
|
|
783
|
+
throw new Error("signMessage not supported via mobile deeplink");
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
});
|
|
776
787
|
var createPhantomSolanaConnector = () => createDownloadOnlySolanaConnector({ walletId: "phantom" });
|
|
777
788
|
var isPhantomMobilePending = () => storage.getString(STORAGE_KEYS2.PENDING) === "1";
|
|
778
789
|
var handlePhantomMobileCallback = () => handleMobileCallback(PHANTOM_CONFIG, STORAGE_KEYS2.PENDING, STORAGE_KEYS2.SESSION);
|
|
@@ -863,14 +874,8 @@ var RAINBOW_CONFIG = {
|
|
|
863
874
|
};
|
|
864
875
|
var createRainbowEvmMobileConnector = () => createWcEvmConnector(RAINBOW_CONFIG);
|
|
865
876
|
|
|
866
|
-
// src/lib/connectors/
|
|
867
|
-
var
|
|
868
|
-
walletId: "exodus",
|
|
869
|
-
wcDeeplink: "https://exodus.com/wc",
|
|
870
|
-
injectedKey: "isExodus"
|
|
871
|
-
};
|
|
872
|
-
var createExodusEvmMobileConnector = () => createWcEvmConnector(EXODUS_CONFIG);
|
|
873
|
-
var createExodusSolanaMobileConnector = () => createWcSolanaConnector(EXODUS_CONFIG);
|
|
877
|
+
// src/lib/connectors/rabby.ts
|
|
878
|
+
var createRabbyEvmConnector = () => createDownloadOnlyEvmConnector({ walletId: "rabby" });
|
|
874
879
|
|
|
875
880
|
// src/lib/connectors/binance.ts
|
|
876
881
|
var BINANCE_CONFIG = {
|
|
@@ -894,6 +899,7 @@ var createOkxSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector
|
|
|
894
899
|
injectedKey: "isOkxWallet",
|
|
895
900
|
buildUrl: buildOkxBrowseUrl
|
|
896
901
|
});
|
|
902
|
+
var createOkxSolanaConnector = () => createDownloadOnlySolanaConnector({ walletId: "okx" });
|
|
897
903
|
|
|
898
904
|
// src/lib/connectors/coinbase.ts
|
|
899
905
|
var buildCoinbaseBrowseUrl = () => `cbwallet://dapp?url=${encodeURIComponent(window.location.href)}`;
|
|
@@ -997,14 +1003,29 @@ var createWalletConnectSolanaConnector = () => {
|
|
|
997
1003
|
|
|
998
1004
|
// src/lib/evm/connectors.ts
|
|
999
1005
|
var EVM_FALLBACK_CONNECTORS = [
|
|
1000
|
-
{
|
|
1001
|
-
|
|
1006
|
+
{
|
|
1007
|
+
id: "phantom",
|
|
1008
|
+
create: isMobile() ? createPhantomEvmConnectorDeeplink : createPhantomEvmConnector
|
|
1009
|
+
},
|
|
1010
|
+
...isMobile() ? [] : [{ id: "metamask", create: createMetaMaskEvmConnector }],
|
|
1002
1011
|
{ id: "trust", create: createTrustEvmMobileConnector },
|
|
1003
1012
|
{ id: "binance", create: createBinanceEvmConnector },
|
|
1004
1013
|
{ id: "rainbow", create: createRainbowEvmMobileConnector },
|
|
1005
|
-
{ id: "
|
|
1014
|
+
...isMobile() ? [] : [{ id: "rabby", create: createRabbyEvmConnector }]
|
|
1006
1015
|
];
|
|
1007
1016
|
var sleep = (ms) => new Promise((r) => window.setTimeout(r, ms));
|
|
1017
|
+
var checkEvmWalletInstalled = (connectorId) => {
|
|
1018
|
+
if (typeof window === "undefined" || !window.ethereum) return false;
|
|
1019
|
+
const providers = window.ethereum.providers ?? [window.ethereum];
|
|
1020
|
+
switch (connectorId) {
|
|
1021
|
+
case "metaMaskSDK":
|
|
1022
|
+
return providers.some((p) => p.isMetaMask && !p.isBraveWallet);
|
|
1023
|
+
case "coinbaseWalletSDK":
|
|
1024
|
+
return providers.some((p) => p.isCoinbaseWallet);
|
|
1025
|
+
default:
|
|
1026
|
+
return true;
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1008
1029
|
var cleanupWalletLocalStorage = () => {
|
|
1009
1030
|
Object.keys(window.localStorage).filter((key) => key.startsWith("wagmi.")).forEach((key) => window.localStorage.removeItem(key));
|
|
1010
1031
|
};
|
|
@@ -1015,7 +1036,7 @@ var getEvmConnectors = () => {
|
|
|
1015
1036
|
name: c.name,
|
|
1016
1037
|
icon: c.icon,
|
|
1017
1038
|
type: "evm",
|
|
1018
|
-
installed:
|
|
1039
|
+
installed: checkEvmWalletInstalled(c.id),
|
|
1019
1040
|
wallet: {
|
|
1020
1041
|
_connector: c,
|
|
1021
1042
|
connect: async () => {
|
|
@@ -1238,10 +1259,6 @@ var SOLANA_FALLBACK_CONNECTORS = isMobile() ? [
|
|
|
1238
1259
|
{
|
|
1239
1260
|
id: "binance",
|
|
1240
1261
|
create: () => createSolanaMobileConnector(createBinanceSolanaDappBrowserConnector())
|
|
1241
|
-
},
|
|
1242
|
-
{
|
|
1243
|
-
id: "exodus",
|
|
1244
|
-
create: () => createSolanaMobileConnector(createExodusSolanaMobileConnector())
|
|
1245
1262
|
}
|
|
1246
1263
|
] : [
|
|
1247
1264
|
{ id: "phantom", create: () => createSolanaMobileConnector(createPhantomSolanaConnector()) },
|
|
@@ -1255,10 +1272,7 @@ var SOLANA_FALLBACK_CONNECTORS = isMobile() ? [
|
|
|
1255
1272
|
},
|
|
1256
1273
|
{ id: "binance", create: () => createSolanaMobileConnector(createBinanceSolanaConnector()) },
|
|
1257
1274
|
{ id: "bitget", create: createBitgetSolanaConnector },
|
|
1258
|
-
{
|
|
1259
|
-
id: "exodus",
|
|
1260
|
-
create: () => createSolanaMobileConnector(createExodusSolanaMobileConnector())
|
|
1261
|
-
}
|
|
1275
|
+
{ id: "okx", create: createOkxSolanaConnector }
|
|
1262
1276
|
];
|
|
1263
1277
|
var getSolanaWallets = () => {
|
|
1264
1278
|
const { get } = getWallets();
|
|
@@ -1271,8 +1285,6 @@ var getSolanaWallets = () => {
|
|
|
1271
1285
|
seenNames.add(w.name);
|
|
1272
1286
|
return true;
|
|
1273
1287
|
}).map(createSolanaConnector);
|
|
1274
|
-
console.log("wallets", { wallets });
|
|
1275
|
-
console.log("connectors", { connectors });
|
|
1276
1288
|
addFallbackConnectors(connectors, SOLANA_FALLBACK_CONNECTORS);
|
|
1277
1289
|
return connectors;
|
|
1278
1290
|
};
|
package/dist/index.js
CHANGED
|
@@ -150,12 +150,6 @@ var WALLETS = [
|
|
|
150
150
|
icon: "https://iconic.dynamic-static-assets.com/icons/sprite.svg#rainbow",
|
|
151
151
|
chromeExtensionUrl: "https://chromewebstore.google.com/detail/rainbow/opfgelmcmbiajamepnmloijbpoleiama"
|
|
152
152
|
},
|
|
153
|
-
{
|
|
154
|
-
id: "exodus",
|
|
155
|
-
name: "Exodus",
|
|
156
|
-
icon: "https://iconic.dynamic-static-assets.com/icons/sprite.svg#exodus",
|
|
157
|
-
chromeExtensionUrl: "https://chromewebstore.google.com/detail/aholpfdialjgjfhomihkjbmgjidlcdno"
|
|
158
|
-
},
|
|
159
153
|
{
|
|
160
154
|
id: "walletconnect",
|
|
161
155
|
name: "WalletConnect",
|
|
@@ -174,14 +168,12 @@ var EVM_WALLET_ID_MAP = {
|
|
|
174
168
|
coinbaseWalletSDK: "coinbase",
|
|
175
169
|
"io.rabby": "rabby",
|
|
176
170
|
"me.rainbow": "rainbow",
|
|
177
|
-
"com.exodus.web3-wallet": "exodus",
|
|
178
171
|
walletConnect: "walletconnect"
|
|
179
172
|
};
|
|
180
173
|
var SOLANA_WALLET_ID_MAP = {
|
|
181
174
|
"binance-wallet": "binance",
|
|
182
175
|
"bitget-wallet": "bitget",
|
|
183
|
-
"okx-wallet": "okx"
|
|
184
|
-
"exodus-wallet": "exodus"
|
|
176
|
+
"okx-wallet": "okx"
|
|
185
177
|
};
|
|
186
178
|
var normalizeEvmWalletId = (id) => EVM_WALLET_ID_MAP[id] || id.toLowerCase().replace(/sdk$/i, "");
|
|
187
179
|
var normalizeSolanaWalletId = (id) => SOLANA_WALLET_ID_MAP[id] || id.replace(/-wallet$/, "");
|
|
@@ -763,8 +755,27 @@ var STORAGE_KEYS2 = {
|
|
|
763
755
|
SESSION: "phantom_mobile_session",
|
|
764
756
|
SIGN_PENDING: "phantom_mobile_sign_pending"
|
|
765
757
|
};
|
|
766
|
-
WALLETS.find((i) => i.id === "phantom");
|
|
758
|
+
var phantomWalletConfig = WALLETS.find((i) => i.id === "phantom");
|
|
767
759
|
var createPhantomEvmConnector = () => createDownloadOnlyEvmConnector({ walletId: "phantom" });
|
|
760
|
+
var createPhantomEvmConnectorDeeplink = () => ({
|
|
761
|
+
...phantomWalletConfig,
|
|
762
|
+
type: "evm",
|
|
763
|
+
wallet: {
|
|
764
|
+
_connector: null,
|
|
765
|
+
connect: async () => {
|
|
766
|
+
const currentUrl = encodeURIComponent(window.location.href);
|
|
767
|
+
window.location.href = `${PHANTOM_BROWSE_URL}/${currentUrl}?ref=${encodeURIComponent(
|
|
768
|
+
window.location.origin
|
|
769
|
+
)}`;
|
|
770
|
+
return pendingResult();
|
|
771
|
+
},
|
|
772
|
+
disconnect: async () => {
|
|
773
|
+
},
|
|
774
|
+
signMessage: async () => {
|
|
775
|
+
throw new Error("signMessage not supported via mobile deeplink");
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
});
|
|
768
779
|
var createPhantomSolanaConnector = () => createDownloadOnlySolanaConnector({ walletId: "phantom" });
|
|
769
780
|
var isPhantomMobilePending = () => storage.getString(STORAGE_KEYS2.PENDING) === "1";
|
|
770
781
|
var handlePhantomMobileCallback = () => handleMobileCallback(PHANTOM_CONFIG, STORAGE_KEYS2.PENDING, STORAGE_KEYS2.SESSION);
|
|
@@ -855,14 +866,8 @@ var RAINBOW_CONFIG = {
|
|
|
855
866
|
};
|
|
856
867
|
var createRainbowEvmMobileConnector = () => createWcEvmConnector(RAINBOW_CONFIG);
|
|
857
868
|
|
|
858
|
-
// src/lib/connectors/
|
|
859
|
-
var
|
|
860
|
-
walletId: "exodus",
|
|
861
|
-
wcDeeplink: "https://exodus.com/wc",
|
|
862
|
-
injectedKey: "isExodus"
|
|
863
|
-
};
|
|
864
|
-
var createExodusEvmMobileConnector = () => createWcEvmConnector(EXODUS_CONFIG);
|
|
865
|
-
var createExodusSolanaMobileConnector = () => createWcSolanaConnector(EXODUS_CONFIG);
|
|
869
|
+
// src/lib/connectors/rabby.ts
|
|
870
|
+
var createRabbyEvmConnector = () => createDownloadOnlyEvmConnector({ walletId: "rabby" });
|
|
866
871
|
|
|
867
872
|
// src/lib/connectors/binance.ts
|
|
868
873
|
var BINANCE_CONFIG = {
|
|
@@ -886,6 +891,7 @@ var createOkxSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector
|
|
|
886
891
|
injectedKey: "isOkxWallet",
|
|
887
892
|
buildUrl: buildOkxBrowseUrl
|
|
888
893
|
});
|
|
894
|
+
var createOkxSolanaConnector = () => createDownloadOnlySolanaConnector({ walletId: "okx" });
|
|
889
895
|
|
|
890
896
|
// src/lib/connectors/coinbase.ts
|
|
891
897
|
var buildCoinbaseBrowseUrl = () => `cbwallet://dapp?url=${encodeURIComponent(window.location.href)}`;
|
|
@@ -986,14 +992,29 @@ var createWalletConnectSolanaConnector = () => {
|
|
|
986
992
|
|
|
987
993
|
// src/lib/evm/connectors.ts
|
|
988
994
|
var EVM_FALLBACK_CONNECTORS = [
|
|
989
|
-
{
|
|
990
|
-
|
|
995
|
+
{
|
|
996
|
+
id: "phantom",
|
|
997
|
+
create: isMobile() ? createPhantomEvmConnectorDeeplink : createPhantomEvmConnector
|
|
998
|
+
},
|
|
999
|
+
...isMobile() ? [] : [{ id: "metamask", create: createMetaMaskEvmConnector }],
|
|
991
1000
|
{ id: "trust", create: createTrustEvmMobileConnector },
|
|
992
1001
|
{ id: "binance", create: createBinanceEvmConnector },
|
|
993
1002
|
{ id: "rainbow", create: createRainbowEvmMobileConnector },
|
|
994
|
-
{ id: "
|
|
1003
|
+
...isMobile() ? [] : [{ id: "rabby", create: createRabbyEvmConnector }]
|
|
995
1004
|
];
|
|
996
1005
|
var sleep = (ms) => new Promise((r) => window.setTimeout(r, ms));
|
|
1006
|
+
var checkEvmWalletInstalled = (connectorId) => {
|
|
1007
|
+
if (typeof window === "undefined" || !window.ethereum) return false;
|
|
1008
|
+
const providers = window.ethereum.providers ?? [window.ethereum];
|
|
1009
|
+
switch (connectorId) {
|
|
1010
|
+
case "metaMaskSDK":
|
|
1011
|
+
return providers.some((p) => p.isMetaMask && !p.isBraveWallet);
|
|
1012
|
+
case "coinbaseWalletSDK":
|
|
1013
|
+
return providers.some((p) => p.isCoinbaseWallet);
|
|
1014
|
+
default:
|
|
1015
|
+
return true;
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
997
1018
|
var cleanupWalletLocalStorage = () => {
|
|
998
1019
|
Object.keys(window.localStorage).filter((key) => key.startsWith("wagmi.")).forEach((key) => window.localStorage.removeItem(key));
|
|
999
1020
|
};
|
|
@@ -1004,7 +1025,7 @@ var getEvmConnectors = () => {
|
|
|
1004
1025
|
name: c.name,
|
|
1005
1026
|
icon: c.icon,
|
|
1006
1027
|
type: "evm",
|
|
1007
|
-
installed:
|
|
1028
|
+
installed: checkEvmWalletInstalled(c.id),
|
|
1008
1029
|
wallet: {
|
|
1009
1030
|
_connector: c,
|
|
1010
1031
|
connect: async () => {
|
|
@@ -1206,10 +1227,6 @@ var SOLANA_FALLBACK_CONNECTORS = isMobile() ? [
|
|
|
1206
1227
|
{
|
|
1207
1228
|
id: "binance",
|
|
1208
1229
|
create: () => createSolanaMobileConnector(createBinanceSolanaDappBrowserConnector())
|
|
1209
|
-
},
|
|
1210
|
-
{
|
|
1211
|
-
id: "exodus",
|
|
1212
|
-
create: () => createSolanaMobileConnector(createExodusSolanaMobileConnector())
|
|
1213
1230
|
}
|
|
1214
1231
|
] : [
|
|
1215
1232
|
{ id: "phantom", create: () => createSolanaMobileConnector(createPhantomSolanaConnector()) },
|
|
@@ -1223,10 +1240,7 @@ var SOLANA_FALLBACK_CONNECTORS = isMobile() ? [
|
|
|
1223
1240
|
},
|
|
1224
1241
|
{ id: "binance", create: () => createSolanaMobileConnector(createBinanceSolanaConnector()) },
|
|
1225
1242
|
{ id: "bitget", create: createBitgetSolanaConnector },
|
|
1226
|
-
{
|
|
1227
|
-
id: "exodus",
|
|
1228
|
-
create: () => createSolanaMobileConnector(createExodusSolanaMobileConnector())
|
|
1229
|
-
}
|
|
1243
|
+
{ id: "okx", create: createOkxSolanaConnector }
|
|
1230
1244
|
];
|
|
1231
1245
|
var getSolanaWallets = () => {
|
|
1232
1246
|
const { get } = getWallets();
|
|
@@ -1239,8 +1253,6 @@ var getSolanaWallets = () => {
|
|
|
1239
1253
|
seenNames.add(w.name);
|
|
1240
1254
|
return true;
|
|
1241
1255
|
}).map(createSolanaConnector);
|
|
1242
|
-
console.log("wallets", { wallets });
|
|
1243
|
-
console.log("connectors", { connectors });
|
|
1244
1256
|
addFallbackConnectors(connectors, SOLANA_FALLBACK_CONNECTORS);
|
|
1245
1257
|
return connectors;
|
|
1246
1258
|
};
|
package/dist/index.jsx
CHANGED
|
@@ -145,12 +145,6 @@ var WALLETS = [
|
|
|
145
145
|
icon: "https://iconic.dynamic-static-assets.com/icons/sprite.svg#rainbow",
|
|
146
146
|
chromeExtensionUrl: "https://chromewebstore.google.com/detail/rainbow/opfgelmcmbiajamepnmloijbpoleiama"
|
|
147
147
|
},
|
|
148
|
-
{
|
|
149
|
-
id: "exodus",
|
|
150
|
-
name: "Exodus",
|
|
151
|
-
icon: "https://iconic.dynamic-static-assets.com/icons/sprite.svg#exodus",
|
|
152
|
-
chromeExtensionUrl: "https://chromewebstore.google.com/detail/aholpfdialjgjfhomihkjbmgjidlcdno"
|
|
153
|
-
},
|
|
154
148
|
{
|
|
155
149
|
id: "walletconnect",
|
|
156
150
|
name: "WalletConnect",
|
|
@@ -169,14 +163,12 @@ var EVM_WALLET_ID_MAP = {
|
|
|
169
163
|
coinbaseWalletSDK: "coinbase",
|
|
170
164
|
"io.rabby": "rabby",
|
|
171
165
|
"me.rainbow": "rainbow",
|
|
172
|
-
"com.exodus.web3-wallet": "exodus",
|
|
173
166
|
walletConnect: "walletconnect"
|
|
174
167
|
};
|
|
175
168
|
var SOLANA_WALLET_ID_MAP = {
|
|
176
169
|
"binance-wallet": "binance",
|
|
177
170
|
"bitget-wallet": "bitget",
|
|
178
|
-
"okx-wallet": "okx"
|
|
179
|
-
"exodus-wallet": "exodus"
|
|
171
|
+
"okx-wallet": "okx"
|
|
180
172
|
};
|
|
181
173
|
var normalizeEvmWalletId = (id) => EVM_WALLET_ID_MAP[id] || id.toLowerCase().replace(/sdk$/i, "");
|
|
182
174
|
var normalizeSolanaWalletId = (id) => SOLANA_WALLET_ID_MAP[id] || id.replace(/-wallet$/, "");
|
|
@@ -773,6 +765,25 @@ var STORAGE_KEYS2 = {
|
|
|
773
765
|
};
|
|
774
766
|
var phantomWalletConfig = WALLETS.find((i) => i.id === "phantom");
|
|
775
767
|
var createPhantomEvmConnector = () => createDownloadOnlyEvmConnector({ walletId: "phantom" });
|
|
768
|
+
var createPhantomEvmConnectorDeeplink = () => ({
|
|
769
|
+
...phantomWalletConfig,
|
|
770
|
+
type: "evm",
|
|
771
|
+
wallet: {
|
|
772
|
+
_connector: null,
|
|
773
|
+
connect: async () => {
|
|
774
|
+
const currentUrl = encodeURIComponent(window.location.href);
|
|
775
|
+
window.location.href = `${PHANTOM_BROWSE_URL}/${currentUrl}?ref=${encodeURIComponent(
|
|
776
|
+
window.location.origin
|
|
777
|
+
)}`;
|
|
778
|
+
return pendingResult();
|
|
779
|
+
},
|
|
780
|
+
disconnect: async () => {
|
|
781
|
+
},
|
|
782
|
+
signMessage: async () => {
|
|
783
|
+
throw new Error("signMessage not supported via mobile deeplink");
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
});
|
|
776
787
|
var createPhantomSolanaConnector = () => createDownloadOnlySolanaConnector({ walletId: "phantom" });
|
|
777
788
|
var isPhantomMobilePending = () => storage.getString(STORAGE_KEYS2.PENDING) === "1";
|
|
778
789
|
var handlePhantomMobileCallback = () => handleMobileCallback(PHANTOM_CONFIG, STORAGE_KEYS2.PENDING, STORAGE_KEYS2.SESSION);
|
|
@@ -863,14 +874,8 @@ var RAINBOW_CONFIG = {
|
|
|
863
874
|
};
|
|
864
875
|
var createRainbowEvmMobileConnector = () => createWcEvmConnector(RAINBOW_CONFIG);
|
|
865
876
|
|
|
866
|
-
// src/lib/connectors/
|
|
867
|
-
var
|
|
868
|
-
walletId: "exodus",
|
|
869
|
-
wcDeeplink: "https://exodus.com/wc",
|
|
870
|
-
injectedKey: "isExodus"
|
|
871
|
-
};
|
|
872
|
-
var createExodusEvmMobileConnector = () => createWcEvmConnector(EXODUS_CONFIG);
|
|
873
|
-
var createExodusSolanaMobileConnector = () => createWcSolanaConnector(EXODUS_CONFIG);
|
|
877
|
+
// src/lib/connectors/rabby.ts
|
|
878
|
+
var createRabbyEvmConnector = () => createDownloadOnlyEvmConnector({ walletId: "rabby" });
|
|
874
879
|
|
|
875
880
|
// src/lib/connectors/binance.ts
|
|
876
881
|
var BINANCE_CONFIG = {
|
|
@@ -894,6 +899,7 @@ var createOkxSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector
|
|
|
894
899
|
injectedKey: "isOkxWallet",
|
|
895
900
|
buildUrl: buildOkxBrowseUrl
|
|
896
901
|
});
|
|
902
|
+
var createOkxSolanaConnector = () => createDownloadOnlySolanaConnector({ walletId: "okx" });
|
|
897
903
|
|
|
898
904
|
// src/lib/connectors/coinbase.ts
|
|
899
905
|
var buildCoinbaseBrowseUrl = () => `cbwallet://dapp?url=${encodeURIComponent(window.location.href)}`;
|
|
@@ -997,14 +1003,29 @@ var createWalletConnectSolanaConnector = () => {
|
|
|
997
1003
|
|
|
998
1004
|
// src/lib/evm/connectors.ts
|
|
999
1005
|
var EVM_FALLBACK_CONNECTORS = [
|
|
1000
|
-
{
|
|
1001
|
-
|
|
1006
|
+
{
|
|
1007
|
+
id: "phantom",
|
|
1008
|
+
create: isMobile() ? createPhantomEvmConnectorDeeplink : createPhantomEvmConnector
|
|
1009
|
+
},
|
|
1010
|
+
...isMobile() ? [] : [{ id: "metamask", create: createMetaMaskEvmConnector }],
|
|
1002
1011
|
{ id: "trust", create: createTrustEvmMobileConnector },
|
|
1003
1012
|
{ id: "binance", create: createBinanceEvmConnector },
|
|
1004
1013
|
{ id: "rainbow", create: createRainbowEvmMobileConnector },
|
|
1005
|
-
{ id: "
|
|
1014
|
+
...isMobile() ? [] : [{ id: "rabby", create: createRabbyEvmConnector }]
|
|
1006
1015
|
];
|
|
1007
1016
|
var sleep = (ms) => new Promise((r) => window.setTimeout(r, ms));
|
|
1017
|
+
var checkEvmWalletInstalled = (connectorId) => {
|
|
1018
|
+
if (typeof window === "undefined" || !window.ethereum) return false;
|
|
1019
|
+
const providers = window.ethereum.providers ?? [window.ethereum];
|
|
1020
|
+
switch (connectorId) {
|
|
1021
|
+
case "metaMaskSDK":
|
|
1022
|
+
return providers.some((p) => p.isMetaMask && !p.isBraveWallet);
|
|
1023
|
+
case "coinbaseWalletSDK":
|
|
1024
|
+
return providers.some((p) => p.isCoinbaseWallet);
|
|
1025
|
+
default:
|
|
1026
|
+
return true;
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
1008
1029
|
var cleanupWalletLocalStorage = () => {
|
|
1009
1030
|
Object.keys(window.localStorage).filter((key) => key.startsWith("wagmi.")).forEach((key) => window.localStorage.removeItem(key));
|
|
1010
1031
|
};
|
|
@@ -1015,7 +1036,7 @@ var getEvmConnectors = () => {
|
|
|
1015
1036
|
name: c.name,
|
|
1016
1037
|
icon: c.icon,
|
|
1017
1038
|
type: "evm",
|
|
1018
|
-
installed:
|
|
1039
|
+
installed: checkEvmWalletInstalled(c.id),
|
|
1019
1040
|
wallet: {
|
|
1020
1041
|
_connector: c,
|
|
1021
1042
|
connect: async () => {
|
|
@@ -1238,10 +1259,6 @@ var SOLANA_FALLBACK_CONNECTORS = isMobile() ? [
|
|
|
1238
1259
|
{
|
|
1239
1260
|
id: "binance",
|
|
1240
1261
|
create: () => createSolanaMobileConnector(createBinanceSolanaDappBrowserConnector())
|
|
1241
|
-
},
|
|
1242
|
-
{
|
|
1243
|
-
id: "exodus",
|
|
1244
|
-
create: () => createSolanaMobileConnector(createExodusSolanaMobileConnector())
|
|
1245
1262
|
}
|
|
1246
1263
|
] : [
|
|
1247
1264
|
{ id: "phantom", create: () => createSolanaMobileConnector(createPhantomSolanaConnector()) },
|
|
@@ -1255,10 +1272,7 @@ var SOLANA_FALLBACK_CONNECTORS = isMobile() ? [
|
|
|
1255
1272
|
},
|
|
1256
1273
|
{ id: "binance", create: () => createSolanaMobileConnector(createBinanceSolanaConnector()) },
|
|
1257
1274
|
{ id: "bitget", create: createBitgetSolanaConnector },
|
|
1258
|
-
{
|
|
1259
|
-
id: "exodus",
|
|
1260
|
-
create: () => createSolanaMobileConnector(createExodusSolanaMobileConnector())
|
|
1261
|
-
}
|
|
1275
|
+
{ id: "okx", create: createOkxSolanaConnector }
|
|
1262
1276
|
];
|
|
1263
1277
|
var getSolanaWallets = () => {
|
|
1264
1278
|
const { get } = getWallets();
|
|
@@ -1271,8 +1285,6 @@ var getSolanaWallets = () => {
|
|
|
1271
1285
|
seenNames.add(w.name);
|
|
1272
1286
|
return true;
|
|
1273
1287
|
}).map(createSolanaConnector);
|
|
1274
|
-
console.log("wallets", { wallets });
|
|
1275
|
-
console.log("connectors", { connectors });
|
|
1276
1288
|
addFallbackConnectors(connectors, SOLANA_FALLBACK_CONNECTORS);
|
|
1277
1289
|
return connectors;
|
|
1278
1290
|
};
|
|
@@ -3,9 +3,9 @@ export { createMetaMaskEvmConnector, createMetaMaskSolanaConnector, createMetaMa
|
|
|
3
3
|
export { createSolflareSolanaMobileConnector, createSolflareSolanaDappBrowserConnector, isSolflareMobilePending, handleSolflareMobileCallback, restoreSolflareMobileSession, isSolflareSignPending, handleSolflareSignCallback, } from './solflare';
|
|
4
4
|
export { createTrustEvmMobileConnector, createTrustSolanaMobileConnector, createTrustSolanaDappBrowserConnector, } from './trust';
|
|
5
5
|
export { createRainbowEvmMobileConnector } from './rainbow';
|
|
6
|
-
export {
|
|
6
|
+
export { createRabbyEvmConnector } from './rabby';
|
|
7
7
|
export { createBinanceEvmConnector, createBinanceSolanaConnector, createBinanceSolanaDappBrowserConnector, } from './binance';
|
|
8
|
-
export { createOkxSolanaDappBrowserConnector } from './okx';
|
|
8
|
+
export { createOkxSolanaDappBrowserConnector, createOkxSolanaConnector } from './okx';
|
|
9
9
|
export { createCoinbaseSolanaDappBrowserConnector } from './coinbase';
|
|
10
10
|
export { createBitgetSolanaDappBrowserConnector, createBitgetSolanaConnector } from './bitget';
|
|
11
11
|
export { createWalletConnectEvmConnector, createWalletConnectSolanaConnector, } from './walletconnect';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const WALLET_IDS: readonly ["walletconnect", "metamask", "phantom", "okx", "coinbase", "binance", "bitget", "solflare", "trust", "rabby", "rainbow"
|
|
1
|
+
export declare const WALLET_IDS: readonly ["walletconnect", "metamask", "phantom", "okx", "coinbase", "binance", "bitget", "solflare", "trust", "rabby", "rainbow"];
|
|
2
2
|
export type WalletId = (typeof WALLET_IDS)[number];
|
|
3
3
|
export interface WalletConfig {
|
|
4
4
|
id: WalletId;
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { EvmWalletConnector } from '../evm';
|
|
2
|
-
import type { SolanaWalletConnector } from '../solana';
|
|
3
|
-
export declare const createExodusEvmMobileConnector: () => EvmWalletConnector;
|
|
4
|
-
export declare const createExodusSolanaMobileConnector: () => SolanaWalletConnector;
|
|
5
|
-
export declare const createExodusSolanaDappBrowserConnector: () => SolanaWalletConnector;
|