@dynamic-labs-sdk/client 1.31.0 → 1.31.2
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/{apiClient-DpzKqY39.native.esm.js → apiClient-d2qJyIvx.native.esm.js} +2 -2
- package/dist/{apiClient-DpzKqY39.native.esm.js.map → apiClient-d2qJyIvx.native.esm.js.map} +1 -1
- package/dist/core.cjs +78 -5
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +78 -8
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +78 -8
- package/dist/core.native.esm.js.map +1 -1
- package/dist/errors/AmbiguousWalletChainError.d.ts +32 -0
- package/dist/errors/AmbiguousWalletChainError.d.ts.map +1 -0
- package/dist/errors/ConnectionUriHandlerMissingError.d.ts +37 -0
- package/dist/errors/ConnectionUriHandlerMissingError.d.ts.map +1 -0
- package/dist/errors/NoConnectionOptionAvailableError.d.ts +39 -0
- package/dist/errors/NoConnectionOptionAvailableError.d.ts.map +1 -0
- package/dist/errors/WalletOptionNotFoundError.d.ts +30 -0
- package/dist/errors/WalletOptionNotFoundError.d.ts.map +1 -0
- package/dist/exports/core.d.ts +8 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +8 -1
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BN2jUhHm.esm.js → getNetworkProviderFromNetworkId-D9nx6Od5.esm.js} +29 -25
- package/dist/getNetworkProviderFromNetworkId-D9nx6Od5.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-DUym3Qq0.native.esm.js → getNetworkProviderFromNetworkId-DF9kPibD.native.esm.js} +30 -26
- package/dist/getNetworkProviderFromNetworkId-DF9kPibD.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-BoNAPSjx.cjs → getNetworkProviderFromNetworkId-DueBnAl6.cjs} +23 -19
- package/dist/{getNetworkProviderFromNetworkId-BoNAPSjx.cjs.map → getNetworkProviderFromNetworkId-DueBnAl6.cjs.map} +1 -1
- package/dist/{getSignedSessionId-DxpqG4pv.esm.js → getSignedSessionId-5q4uyZsv.native.esm.js} +34 -4
- package/dist/getSignedSessionId-5q4uyZsv.native.esm.js.map +1 -0
- package/dist/{getSignedSessionId-9ADIJCl1.cjs → getSignedSessionId-B5oxmSTs.cjs} +39 -3
- package/dist/getSignedSessionId-B5oxmSTs.cjs.map +1 -0
- package/dist/{getSignedSessionId-Dr4Ic68X.native.esm.js → getSignedSessionId-BKfQycNo.esm.js} +34 -4
- package/dist/getSignedSessionId-BKfQycNo.esm.js.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-C2o5idph.cjs → getVerifiedCredentialForWalletAccount-Bx0HlvfW.cjs} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-C2o5idph.cjs.map → getVerifiedCredentialForWalletAccount-Bx0HlvfW.cjs.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-Cjwoeej7.esm.js → getVerifiedCredentialForWalletAccount-_3MExyld.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-Cjwoeej7.esm.js.map → getVerifiedCredentialForWalletAccount-_3MExyld.esm.js.map} +1 -1
- package/dist/index.cjs +536 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +534 -83
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +492 -83
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-BIBmJbV9.esm.js → isMfaRequiredForAction-BDmY2_Sj.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-BIBmJbV9.esm.js.map → isMfaRequiredForAction-BDmY2_Sj.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-DuSU67yq.native.esm.js → isMfaRequiredForAction-BrRCSvEX.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-DuSU67yq.native.esm.js.map → isMfaRequiredForAction-BrRCSvEX.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-yM84r7l7.cjs → isMfaRequiredForAction-DnKzPDZk.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-yM84r7l7.cjs.map → isMfaRequiredForAction-DnKzPDZk.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-BRTOnK8V.cjs → isUserOnboardingComplete-7GzNYU2g.cjs} +3 -3
- package/dist/{isUserOnboardingComplete-BRTOnK8V.cjs.map → isUserOnboardingComplete-7GzNYU2g.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-DCIlkCub.native.esm.js → isUserOnboardingComplete-BfMMBtkF.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-DCIlkCub.native.esm.js.map → isUserOnboardingComplete-BfMMBtkF.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-B2Ha2dkP.esm.js → isUserOnboardingComplete-D1-QluDm.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-B2Ha2dkP.esm.js.map → isUserOnboardingComplete-D1-QluDm.esm.js.map} +1 -1
- package/dist/{logoutWithReason-HqGlUccb.native.esm.js → logoutWithReason-3UICYir7.native.esm.js} +2 -2
- package/dist/{logoutWithReason-HqGlUccb.native.esm.js.map → logoutWithReason-3UICYir7.native.esm.js.map} +1 -1
- package/dist/{logoutWithReason-DV89zJmJ.esm.js → logoutWithReason-CHyuBHdx.esm.js} +2 -2
- package/dist/{logoutWithReason-DV89zJmJ.esm.js.map → logoutWithReason-CHyuBHdx.esm.js.map} +1 -1
- package/dist/{logoutWithReason-DlA15deT.cjs → logoutWithReason-C_T7KddM.cjs} +2 -2
- package/dist/{logoutWithReason-DlA15deT.cjs.map → logoutWithReason-C_T7KddM.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-CiOS4_Nq.esm.js → migrateFromFireblocks-BMO3u6rO.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-CiOS4_Nq.esm.js.map → migrateFromFireblocks-BMO3u6rO.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-CqIpxGRS.cjs → migrateFromFireblocks-C9Kuke5V.cjs} +2 -2
- package/dist/{migrateFromFireblocks-CqIpxGRS.cjs.map → migrateFromFireblocks-C9Kuke5V.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-DnQsGmIW.native.esm.js → migrateFromFireblocks-DJt9bktR.native.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-DnQsGmIW.native.esm.js.map → migrateFromFireblocks-DJt9bktR.native.esm.js.map} +1 -1
- package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.d.ts +7 -1
- package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.types.d.ts +4 -0
- package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.types.d.ts.map +1 -0
- package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.d.ts +9 -0
- package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts +9 -1
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.d.ts +7 -1
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/filterConnectionOptionsByEnabledChains.d.ts +30 -0
- package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/filterConnectionOptionsByEnabledChains.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/index.d.ts +2 -0
- package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/index.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts +4 -0
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts +2 -1
- package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts.map +1 -1
- package/dist/modules/wallets/connectWallet.types.d.ts +35 -0
- package/dist/modules/wallets/connectWallet.types.d.ts.map +1 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/connectWithUriConnectionOption.d.ts +52 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/connectWithUriConnectionOption.d.ts.map +1 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/getConnectionUriDeeplink/getConnectionUriDeeplink.d.ts +34 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/getConnectionUriDeeplink/getConnectionUriDeeplink.d.ts.map +1 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/getConnectionUriDeeplink/index.d.ts +2 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/getConnectionUriDeeplink/index.d.ts.map +1 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/index.d.ts +2 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/index.d.ts.map +1 -0
- package/dist/modules/wallets/networks/getEnabledChains/getEnabledChains.d.ts +25 -0
- package/dist/modules/wallets/networks/getEnabledChains/getEnabledChains.d.ts.map +1 -0
- package/dist/modules/wallets/networks/getEnabledChains/index.d.ts +2 -0
- package/dist/modules/wallets/networks/getEnabledChains/index.d.ts.map +1 -0
- package/dist/modules/wallets/networks/networkProviderBuilderRegistry/createNetworkProviderBuilderRegistry/createNetworkProviderBuilderRegistry.d.ts +2 -1
- package/dist/modules/wallets/networks/networkProviderBuilderRegistry/createNetworkProviderBuilderRegistry/createNetworkProviderBuilderRegistry.d.ts.map +1 -1
- package/dist/modules/wallets/networks/networkProviderBuilderRegistry/events.d.ts +16 -0
- package/dist/modules/wallets/networks/networkProviderBuilderRegistry/events.d.ts.map +1 -0
- package/dist/modules/wallets/redirectToInAppBrowser/index.d.ts +2 -0
- package/dist/modules/wallets/redirectToInAppBrowser/index.d.ts.map +1 -0
- package/dist/modules/wallets/redirectToInAppBrowser/redirectToInAppBrowser.d.ts +60 -0
- package/dist/modules/wallets/redirectToInAppBrowser/redirectToInAppBrowser.d.ts.map +1 -0
- package/dist/modules/wallets/resolveWalletConnectionOption/index.d.ts +3 -0
- package/dist/modules/wallets/resolveWalletConnectionOption/index.d.ts.map +1 -0
- package/dist/modules/wallets/resolveWalletConnectionOption/resolveWalletConnectionOption.d.ts +36 -0
- package/dist/modules/wallets/resolveWalletConnectionOption/resolveWalletConnectionOption.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/createUriConnectionStarterRegistry/createUriConnectionStarterRegistry.d.ts +22 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/createUriConnectionStarterRegistry/createUriConnectionStarterRegistry.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/createUriConnectionStarterRegistry/index.d.ts +2 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/createUriConnectionStarterRegistry/index.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/events.d.ts +18 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/events.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/getUriConnectionStarterRegistry/getUriConnectionStarterRegistry.d.ts +22 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/getUriConnectionStarterRegistry/getUriConnectionStarterRegistry.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/getUriConnectionStarterRegistry/index.d.ts +2 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/getUriConnectionStarterRegistry/index.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/index.d.ts +3 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/index.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/uriConnectionStarterRegistry.types.d.ts +32 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/uriConnectionStarterRegistry.types.d.ts.map +1 -0
- package/dist/modules/wallets/walletProviderUriConnection.types.d.ts +19 -0
- package/dist/modules/wallets/walletProviderUriConnection.types.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/buildInAppBrowserUrl/buildInAppBrowserUrl.d.ts +32 -0
- package/dist/utils/buildInAppBrowserUrl/buildInAppBrowserUrl.d.ts.map +1 -0
- package/dist/utils/buildInAppBrowserUrl/index.d.ts +2 -0
- package/dist/utils/buildInAppBrowserUrl/index.d.ts.map +1 -0
- package/dist/utils/getPreferredWalletDeepLink/getPreferredWalletDeepLink.d.ts +33 -0
- package/dist/utils/getPreferredWalletDeepLink/getPreferredWalletDeepLink.d.ts.map +1 -0
- package/dist/utils/getPreferredWalletDeepLink/index.d.ts +2 -0
- package/dist/utils/getPreferredWalletDeepLink/index.d.ts.map +1 -0
- package/dist/utils/isAndroid/index.d.ts +2 -0
- package/dist/utils/isAndroid/index.d.ts.map +1 -0
- package/dist/utils/isAndroid/isAndroid.d.ts +20 -0
- package/dist/utils/isAndroid/isAndroid.d.ts.map +1 -0
- package/dist/utils/isIOS/index.d.ts +2 -0
- package/dist/utils/isIOS/index.d.ts.map +1 -0
- package/dist/utils/isIOS/isIOS.d.ts +23 -0
- package/dist/utils/isIOS/isIOS.d.ts.map +1 -0
- package/dist/utils/isMobile/isMobile.d.ts +17 -36
- package/dist/utils/isMobile/isMobile.d.ts.map +1 -1
- package/dist/utils/userAgentChecks/userAgentChecks.d.ts +35 -0
- package/dist/utils/userAgentChecks/userAgentChecks.d.ts.map +1 -0
- package/dist/{waas-CkQYVo6U.native.esm.js → waas-9QajYGeK.native.esm.js} +4 -4
- package/dist/{waas-CkQYVo6U.native.esm.js.map → waas-9QajYGeK.native.esm.js.map} +1 -1
- package/dist/{waas-BOKafCeH.cjs → waas-Bxsd0-HG.cjs} +4 -4
- package/dist/{waas-BOKafCeH.cjs.map → waas-Bxsd0-HG.cjs.map} +1 -1
- package/dist/{waas-CUDgU2pl.esm.js → waas-T_dHXyI9.esm.js} +4 -4
- package/dist/{waas-CUDgU2pl.esm.js.map → waas-T_dHXyI9.esm.js.map} +1 -1
- package/dist/waas.cjs +4 -4
- package/dist/waas.esm.js +4 -4
- package/dist/waas.native.esm.js +4 -4
- package/dist/waasCore.cjs +10 -40
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +5 -35
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +5 -35
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +2 -2
- package/dist/getNetworkProviderFromNetworkId-BN2jUhHm.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-DUym3Qq0.native.esm.js.map +0 -1
- package/dist/getSignedSessionId-9ADIJCl1.cjs.map +0 -1
- package/dist/getSignedSessionId-Dr4Ic68X.native.esm.js.map +0 -1
- package/dist/getSignedSessionId-DxpqG4pv.esm.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const require_logoutWithReason = require('./logoutWithReason-
|
|
2
|
-
const require_migrateFromFireblocks = require('./migrateFromFireblocks-
|
|
3
|
-
const require_waas = require('./waas-
|
|
4
|
-
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-
|
|
5
|
-
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-
|
|
6
|
-
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-
|
|
7
|
-
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-
|
|
1
|
+
const require_logoutWithReason = require('./logoutWithReason-C_T7KddM.cjs');
|
|
2
|
+
const require_migrateFromFireblocks = require('./migrateFromFireblocks-C9Kuke5V.cjs');
|
|
3
|
+
const require_waas = require('./waas-Bxsd0-HG.cjs');
|
|
4
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-DueBnAl6.cjs');
|
|
5
|
+
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-Bx0HlvfW.cjs');
|
|
6
|
+
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-7GzNYU2g.cjs');
|
|
7
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-DnKzPDZk.cjs');
|
|
8
8
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
9
9
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
10
10
|
let zod_mini = require("zod/mini");
|
|
@@ -557,7 +557,7 @@ const initializeClient = async (client = require_logoutWithReason.getDefaultClie
|
|
|
557
557
|
*/
|
|
558
558
|
if (require_logoutWithReason.isCookieEnabled(client)) await require_logoutWithReason.__refreshAuth_wrapped(client).catch(async (error) => {
|
|
559
559
|
if (error.status === 401) {
|
|
560
|
-
core.logger.
|
|
560
|
+
core.logger.warn("Session expired during initialization", error);
|
|
561
561
|
if (client.user) await require_logoutWithReason.__logoutWithReason_wrapped({ reason: "session-refresh-unauthorized" }, client);
|
|
562
562
|
} else throw error;
|
|
563
563
|
});
|
|
@@ -1204,6 +1204,46 @@ const __createDynamicClient_wrapped = require_logoutWithReason.instrumentFunctio
|
|
|
1204
1204
|
}
|
|
1205
1205
|
});
|
|
1206
1206
|
|
|
1207
|
+
//#endregion
|
|
1208
|
+
//#region src/errors/AmbiguousWalletChainError.ts
|
|
1209
|
+
/**
|
|
1210
|
+
* Thrown when a wallet can be connected on more than one of the client's
|
|
1211
|
+
* enabled chains and no chain was passed to `connectWallet`.
|
|
1212
|
+
*
|
|
1213
|
+
* Multi-chain wallets such as MetaMask or Phantom connect to a different
|
|
1214
|
+
* account per chain, so the chain has to be an explicit choice rather than one
|
|
1215
|
+
* Dynamic makes on the customer's behalf.
|
|
1216
|
+
*
|
|
1217
|
+
* @example
|
|
1218
|
+
* ```ts
|
|
1219
|
+
* try {
|
|
1220
|
+
* await connectWallet({ walletKey: 'phantom' });
|
|
1221
|
+
* } catch (error) {
|
|
1222
|
+
* if (error instanceof AmbiguousWalletChainError) {
|
|
1223
|
+
* await connectWallet({ chain: 'SOL', walletKey: 'phantom' });
|
|
1224
|
+
* }
|
|
1225
|
+
* }
|
|
1226
|
+
* ```
|
|
1227
|
+
* @see connectWallet
|
|
1228
|
+
* @see getWalletOptionsCatalogue
|
|
1229
|
+
*/
|
|
1230
|
+
var AmbiguousWalletChainError = class extends require_logoutWithReason.BaseError {
|
|
1231
|
+
constructor({ chains, walletKey }) {
|
|
1232
|
+
super({
|
|
1233
|
+
cause: null,
|
|
1234
|
+
code: "ambiguous_wallet_chain",
|
|
1235
|
+
docsUrl: null,
|
|
1236
|
+
metaMessages: [
|
|
1237
|
+
`Wallet key: ${walletKey}`,
|
|
1238
|
+
`Available chains: ${chains.join(", ")}`,
|
|
1239
|
+
"Pass the chain param to pick which one to connect on."
|
|
1240
|
+
],
|
|
1241
|
+
name: "AmbiguousWalletChainError",
|
|
1242
|
+
shortMessage: `Wallet ${walletKey} can be connected on more than one chain, so the chain param is required.`
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
};
|
|
1246
|
+
|
|
1207
1247
|
//#endregion
|
|
1208
1248
|
//#region src/errors/CheckoutSessionTokenMissingError.ts
|
|
1209
1249
|
var CheckoutSessionTokenMissingError = class extends require_logoutWithReason.BaseError {
|
|
@@ -1603,6 +1643,54 @@ var NoAddressFoundError = class extends require_logoutWithReason.BaseError {
|
|
|
1603
1643
|
}
|
|
1604
1644
|
};
|
|
1605
1645
|
|
|
1646
|
+
//#endregion
|
|
1647
|
+
//#region src/errors/NoConnectionOptionAvailableError.ts
|
|
1648
|
+
/**
|
|
1649
|
+
* Thrown when a wallet exists in the catalogue but has no connection option
|
|
1650
|
+
* this client can drive.
|
|
1651
|
+
*
|
|
1652
|
+
* Happens when the wallet is not installed on the device and no URI pairing is
|
|
1653
|
+
* available for it — either the wallet does not support one, or the chain
|
|
1654
|
+
* extension providing that pairing was not added to the client.
|
|
1655
|
+
*
|
|
1656
|
+
* @example
|
|
1657
|
+
* ```ts
|
|
1658
|
+
* try {
|
|
1659
|
+
* await connectWallet({ walletKey: 'rainbow' });
|
|
1660
|
+
* } catch (error) {
|
|
1661
|
+
* if (error instanceof NoConnectionOptionAvailableError) {
|
|
1662
|
+
* promptWalletInstall(error.installationUrls);
|
|
1663
|
+
* }
|
|
1664
|
+
* }
|
|
1665
|
+
* ```
|
|
1666
|
+
* @see connectWallet
|
|
1667
|
+
* @see getWalletOptionsCatalogue
|
|
1668
|
+
*/
|
|
1669
|
+
var NoConnectionOptionAvailableError = class extends require_logoutWithReason.BaseError {
|
|
1670
|
+
/**
|
|
1671
|
+
* Install / download links for the wallet, when the wallet book carries any
|
|
1672
|
+
* for this device. Prompt the user to install the wallet with these.
|
|
1673
|
+
*/
|
|
1674
|
+
installationUrls;
|
|
1675
|
+
constructor({ chain, installationUrls, walletKey }) {
|
|
1676
|
+
super({
|
|
1677
|
+
cause: null,
|
|
1678
|
+
code: "no_connection_option_available",
|
|
1679
|
+
docsUrl: null,
|
|
1680
|
+
metaMessages: [
|
|
1681
|
+
`Wallet key: ${walletKey}`,
|
|
1682
|
+
...chain ? [`Chain: ${chain}`] : [],
|
|
1683
|
+
"The wallet is not installed and no URI pairing is available for it on this client.",
|
|
1684
|
+
"URI pairing requires the chain extension that provides it — addWalletConnect<Chain>Extension for WalletConnect, addMetaMask<Chain>Extension for MetaMask.",
|
|
1685
|
+
"Use this error's installationUrls to prompt the user to install the wallet."
|
|
1686
|
+
],
|
|
1687
|
+
name: "NoConnectionOptionAvailableError",
|
|
1688
|
+
shortMessage: `No connection option available for wallet: ${walletKey}`
|
|
1689
|
+
});
|
|
1690
|
+
this.installationUrls = installationUrls;
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1693
|
+
|
|
1606
1694
|
//#endregion
|
|
1607
1695
|
//#region src/errors/NoPasskeyCredentialsFoundError.ts
|
|
1608
1696
|
var NoPasskeyCredentialsFoundError = class extends require_logoutWithReason.BaseError {
|
|
@@ -1797,6 +1885,46 @@ var WalletAccountNotSelectedError = class extends require_logoutWithReason.BaseE
|
|
|
1797
1885
|
}
|
|
1798
1886
|
};
|
|
1799
1887
|
|
|
1888
|
+
//#endregion
|
|
1889
|
+
//#region src/errors/WalletOptionNotFoundError.ts
|
|
1890
|
+
/**
|
|
1891
|
+
* Thrown when `connectWallet` is given a wallet key that no wallet option in
|
|
1892
|
+
* the catalogue matches.
|
|
1893
|
+
*
|
|
1894
|
+
* A wallet is only surfaced for the chains this client has an extension for, so
|
|
1895
|
+
* this also covers keys that are valid in the wallet book but not reachable
|
|
1896
|
+
* with the client's current chain extensions.
|
|
1897
|
+
*
|
|
1898
|
+
* @example
|
|
1899
|
+
* ```ts
|
|
1900
|
+
* try {
|
|
1901
|
+
* await connectWallet({ walletKey: 'metmask' });
|
|
1902
|
+
* } catch (error) {
|
|
1903
|
+
* if (error instanceof WalletOptionNotFoundError) {
|
|
1904
|
+
* showUnknownWalletMessage();
|
|
1905
|
+
* }
|
|
1906
|
+
* }
|
|
1907
|
+
* ```
|
|
1908
|
+
* @see connectWallet
|
|
1909
|
+
* @see getWalletOptionsCatalogue
|
|
1910
|
+
*/
|
|
1911
|
+
var WalletOptionNotFoundError = class extends require_logoutWithReason.BaseError {
|
|
1912
|
+
constructor({ walletKey }) {
|
|
1913
|
+
super({
|
|
1914
|
+
cause: null,
|
|
1915
|
+
code: "wallet_option_not_found",
|
|
1916
|
+
docsUrl: null,
|
|
1917
|
+
metaMessages: [
|
|
1918
|
+
`Wallet key: ${walletKey}`,
|
|
1919
|
+
"The key must match a wallet option surfaced by getWalletOptionsCatalogue (e.g. \"metamask\", \"phantom\").",
|
|
1920
|
+
"A wallet is only surfaced on chains this client has an extension for, so make sure the relevant chain extension is added."
|
|
1921
|
+
],
|
|
1922
|
+
name: "WalletOptionNotFoundError",
|
|
1923
|
+
shortMessage: `No wallet option found for key: ${walletKey}`
|
|
1924
|
+
});
|
|
1925
|
+
}
|
|
1926
|
+
};
|
|
1927
|
+
|
|
1800
1928
|
//#endregion
|
|
1801
1929
|
//#region src/errors/WalletProviderMethodUnavailableError.ts
|
|
1802
1930
|
var WalletProviderMethodUnavailableError = class extends require_logoutWithReason.BaseError {
|
|
@@ -2522,6 +2650,10 @@ const __authenticateWithSocial_wrapped = require_logoutWithReason.instrumentFunc
|
|
|
2522
2650
|
* browser. Calling it during server-side rendering (no `window`) throws
|
|
2523
2651
|
* `UnavailableInServerSideError`.
|
|
2524
2652
|
*
|
|
2653
|
+
* @param [params.expectedState] - When given, the parameters are only removed
|
|
2654
|
+
* while the current URL still carries this `dynamicOauthState`. Use it to
|
|
2655
|
+
* clean up after a specific callback without touching a newer one that has
|
|
2656
|
+
* meanwhile landed in the address bar.
|
|
2525
2657
|
* @returns Nothing. The current URL is rewritten in place via
|
|
2526
2658
|
* `window.history.replaceState`.
|
|
2527
2659
|
*
|
|
@@ -2541,9 +2673,12 @@ const __authenticateWithSocial_wrapped = require_logoutWithReason.instrumentFunc
|
|
|
2541
2673
|
*
|
|
2542
2674
|
* @notInstrumented
|
|
2543
2675
|
*/
|
|
2544
|
-
const clearSocialRedirectParams = () => {
|
|
2676
|
+
const clearSocialRedirectParams = ({ expectedState } = {}) => {
|
|
2545
2677
|
if (require_getNetworkProviderFromNetworkId.isServerSideRendering()) throw new require_getNetworkProviderFromNetworkId.UnavailableInServerSideError("clearSocialRedirectParams");
|
|
2546
|
-
|
|
2678
|
+
const currentHref = window.location.href;
|
|
2679
|
+
const currentState = new URL(currentHref).searchParams.get("dynamicOauthState");
|
|
2680
|
+
if (expectedState !== void 0 && currentState !== expectedState) return;
|
|
2681
|
+
window.history.replaceState({}, "", removeDynamicOauthParamsFromUrl(currentHref));
|
|
2547
2682
|
};
|
|
2548
2683
|
|
|
2549
2684
|
//#endregion
|
|
@@ -2627,6 +2762,14 @@ const __processSocialCallback_wrapped = require_logoutWithReason.instrumentFunct
|
|
|
2627
2762
|
* authenticating (or linking) the user with the social provider. This is the
|
|
2628
2763
|
* final step after `signInWithSocialRedirect` + `detectSocialRedirectUrl`.
|
|
2629
2764
|
*
|
|
2765
|
+
* A callback URL whose stored redirect state is missing or does not match can
|
|
2766
|
+
* never complete, so its OAuth parameters are stripped from the browser URL
|
|
2767
|
+
* before the error is rethrown. Callers that decide whether to complete a
|
|
2768
|
+
* redirect by inspecting the URL therefore see the failure once instead of
|
|
2769
|
+
* retrying the same doomed callback on every render. The clean-up is scoped to
|
|
2770
|
+
* the state of the callback it failed on, so a newer callback sitting in the
|
|
2771
|
+
* address bar is left alone.
|
|
2772
|
+
*
|
|
2630
2773
|
* @example
|
|
2631
2774
|
* ```ts
|
|
2632
2775
|
* const redirectUrl = detectSocialRedirectUrl();
|
|
@@ -2640,16 +2783,30 @@ const __processSocialCallback_wrapped = require_logoutWithReason.instrumentFunct
|
|
|
2640
2783
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2641
2784
|
* @returns A promise that resolves to the authenticated user or null.
|
|
2642
2785
|
* @throws MissingSocialUrlParamError If required OAuth parameters are missing.
|
|
2786
|
+
* @throws MissingRedirectStorageStateError If no stored redirect state exists.
|
|
2643
2787
|
* @throws InvalidRedirectStorageStateError If the stored state doesn't match.
|
|
2644
2788
|
* @see signInWithSocialRedirect
|
|
2645
2789
|
* @see detectSocialRedirectUrl
|
|
2646
2790
|
* @see clearSocialRedirectParams
|
|
2647
2791
|
* @instrumented
|
|
2648
2792
|
*/
|
|
2649
|
-
const completeSocialRedirect = ({ url, requestedScopes }, client = require_logoutWithReason.getDefaultClient()) =>
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2793
|
+
const completeSocialRedirect = async ({ url, requestedScopes }, client = require_logoutWithReason.getDefaultClient()) => {
|
|
2794
|
+
try {
|
|
2795
|
+
return await __processSocialCallback_wrapped({
|
|
2796
|
+
requestedScopes,
|
|
2797
|
+
url
|
|
2798
|
+
}, client);
|
|
2799
|
+
} catch (error) {
|
|
2800
|
+
const hasUnusableRedirectState = error instanceof MissingRedirectStorageStateError || error instanceof InvalidRedirectStorageStateError;
|
|
2801
|
+
const failedState = url.searchParams.get("dynamicOauthState");
|
|
2802
|
+
if (hasUnusableRedirectState && failedState !== null) try {
|
|
2803
|
+
clearSocialRedirectParams({ expectedState: failedState });
|
|
2804
|
+
} catch (clearError) {
|
|
2805
|
+
require_logoutWithReason.getCore(client).logger.debug("[completeSocialRedirect] failed to clear the social redirect params", clearError);
|
|
2806
|
+
}
|
|
2807
|
+
throw error;
|
|
2808
|
+
}
|
|
2809
|
+
};
|
|
2653
2810
|
const __completeSocialRedirect_impl = completeSocialRedirect;
|
|
2654
2811
|
const __completeSocialRedirect_wrapped = require_logoutWithReason.instrumentFunction({
|
|
2655
2812
|
fn: __completeSocialRedirect_impl,
|
|
@@ -7242,20 +7399,46 @@ const hasAllGoogleDriveBackupScopes = (grantedScopes) => findMissingGoogleDriveB
|
|
|
7242
7399
|
const isInsufficientGoogleDriveScopesError = (err) => err instanceof Error && err.message.includes(ACCESS_DENIED_PHRASE);
|
|
7243
7400
|
|
|
7244
7401
|
//#endregion
|
|
7245
|
-
//#region src/utils/
|
|
7402
|
+
//#region src/utils/isAndroid/isAndroid.ts
|
|
7403
|
+
/**
|
|
7404
|
+
* Tells whether the SDK is running on Android.
|
|
7405
|
+
*
|
|
7406
|
+
* The operating system comes from {@link getOperatingSystem}, which reads
|
|
7407
|
+
* `Platform.OS` in React Native and the user agent on web.
|
|
7408
|
+
*
|
|
7409
|
+
* @example
|
|
7410
|
+
* ```ts
|
|
7411
|
+
* if (isAndroid()) {
|
|
7412
|
+
* return installationUrls.android;
|
|
7413
|
+
* }
|
|
7414
|
+
* ```
|
|
7415
|
+
*
|
|
7416
|
+
* @returns `true` when the current device runs Android.
|
|
7417
|
+
* @see getOperatingSystem
|
|
7418
|
+
* @see isIOS
|
|
7419
|
+
* @notInstrumented
|
|
7420
|
+
*/
|
|
7421
|
+
const isAndroid = () => require_logoutWithReason.getOperatingSystem() === "android";
|
|
7422
|
+
|
|
7423
|
+
//#endregion
|
|
7424
|
+
//#region src/utils/userAgentChecks/userAgentChecks.ts
|
|
7246
7425
|
/**
|
|
7247
7426
|
* Sourced from http://detectmobilebrowsers.com/
|
|
7427
|
+
*
|
|
7428
|
+
* iOS devices are matched by {@link isIOSUserAgent} instead of a bare `ios`
|
|
7429
|
+
* alternative, which would also match unrelated words such as `kiosk`.
|
|
7248
7430
|
* @notInstrumented
|
|
7249
7431
|
*/
|
|
7250
|
-
const userAgentRegex1 = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|
|
|
7432
|
+
const userAgentRegex1 = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i;
|
|
7251
7433
|
const userAgentRegex2 = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;
|
|
7252
|
-
/**
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7434
|
+
/**
|
|
7435
|
+
* Matches the device names Apple's handhelds report, plus the standalone `ios`
|
|
7436
|
+
* token that embedded web views and custom in-app browsers use in place of a
|
|
7437
|
+
* device name. The token must stand alone so that unrelated words containing
|
|
7438
|
+
* `ios` (`kiosk`, for instance) don't match.
|
|
7439
|
+
* @notInstrumented
|
|
7440
|
+
*/
|
|
7441
|
+
const isIOSUserAgent = () => typeof window === "undefined" || typeof navigator === "undefined" ? false : /iPhone|iPod|(?:^|[^a-z])ios(?:[^a-z]|$)/i.test(navigator.userAgent);
|
|
7259
7442
|
/**
|
|
7260
7443
|
* @param [optional] maxTouchPointsOverride - this is used for testing since
|
|
7261
7444
|
* it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
|
|
@@ -7268,13 +7451,11 @@ const isIPad = (maxTouchPointsOverride) => {
|
|
|
7268
7451
|
return /iPad/.test(navigator.userAgent) || /Mac/.test(navigator.userAgent) && maxTouchPoints === 5;
|
|
7269
7452
|
};
|
|
7270
7453
|
/** @notInstrumented */
|
|
7271
|
-
const
|
|
7454
|
+
const isMobileUserAgent = (maxTouchPointsOverride) => {
|
|
7272
7455
|
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
7273
|
-
return
|
|
7456
|
+
return userAgentRegex1.test(navigator.userAgent) || userAgentRegex2.test(navigator.userAgent.substring(0, 4)) || isIPad(maxTouchPointsOverride) || isIOSUserAgent();
|
|
7274
7457
|
};
|
|
7275
7458
|
/** @notInstrumented */
|
|
7276
|
-
const isAndroid = () => isMobile() && !isIOS();
|
|
7277
|
-
/** @notInstrumented */
|
|
7278
7459
|
const isSafariBrowser = () => {
|
|
7279
7460
|
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
7280
7461
|
const { userAgent } = navigator;
|
|
@@ -7301,6 +7482,31 @@ const isChromeBrowser = () => {
|
|
|
7301
7482
|
return /\bChrome\//.test(navigator.userAgent) && !isEdgeBrowser() && !isOperaBrowser();
|
|
7302
7483
|
};
|
|
7303
7484
|
|
|
7485
|
+
//#endregion
|
|
7486
|
+
//#region src/utils/isIOS/isIOS.ts
|
|
7487
|
+
/**
|
|
7488
|
+
* Tells whether the SDK is running on iOS or iPadOS.
|
|
7489
|
+
*
|
|
7490
|
+
* The operating system comes from {@link getOperatingSystem}, which reads
|
|
7491
|
+
* `Platform.OS` in React Native and the user agent on web. Two user agents
|
|
7492
|
+
* escape it: an iPad in desktop mode announces itself as macOS, and embedded
|
|
7493
|
+
* web views may carry a lowercase `ios` token instead of a device name.
|
|
7494
|
+
*
|
|
7495
|
+
* @example
|
|
7496
|
+
* ```ts
|
|
7497
|
+
* if (isIOS()) {
|
|
7498
|
+
* return installationUrls.ios;
|
|
7499
|
+
* }
|
|
7500
|
+
* ```
|
|
7501
|
+
*
|
|
7502
|
+
* @returns `true` when the current device runs iOS or iPadOS.
|
|
7503
|
+
* @see getOperatingSystem
|
|
7504
|
+
* @see isIPad
|
|
7505
|
+
* @see isIOSUserAgent
|
|
7506
|
+
* @notInstrumented
|
|
7507
|
+
*/
|
|
7508
|
+
const isIOS = () => require_logoutWithReason.getOperatingSystem() === "ios" || isIOSUserAgent() || isIPad();
|
|
7509
|
+
|
|
7304
7510
|
//#endregion
|
|
7305
7511
|
//#region src/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/getInstallationLinkForCurrentPlatform.ts
|
|
7306
7512
|
/**
|
|
@@ -7341,6 +7547,77 @@ const getInstallationLinkForCurrentPlatform = ({ installationUrls }) => {
|
|
|
7341
7547
|
if (isChromeBrowser()) return installationUrls.chrome;
|
|
7342
7548
|
};
|
|
7343
7549
|
|
|
7550
|
+
//#endregion
|
|
7551
|
+
//#region src/modules/wallets/networks/getEnabledChains/getEnabledChains.ts
|
|
7552
|
+
/**
|
|
7553
|
+
* Returns the chains this client can operate on — a chain is enabled once
|
|
7554
|
+
* one of its extensions has been added (`addEvmExtension`,
|
|
7555
|
+
* `addSolanaExtension`, …), since every chain extension registers a
|
|
7556
|
+
* network provider builder for its chain.
|
|
7557
|
+
*
|
|
7558
|
+
* Reading the builder registry keeps chain awareness out of the client
|
|
7559
|
+
* package: the set is whatever the extensions registered, so no
|
|
7560
|
+
* chain-specific branch is needed here.
|
|
7561
|
+
*
|
|
7562
|
+
* @param client - The Dynamic client instance.
|
|
7563
|
+
* @returns The set of chains the client has an extension for.
|
|
7564
|
+
* @example
|
|
7565
|
+
* ```typescript
|
|
7566
|
+
* // client created with addEvmExtension only
|
|
7567
|
+
* getEnabledChains(client); // Set { 'EVM' }
|
|
7568
|
+
* ```
|
|
7569
|
+
* @see {@link getNetworkProviderBuilderRegistry} for the registry the chains are read from.
|
|
7570
|
+
* @see {@link getNetworkProviders} for the other consumer of that registry.
|
|
7571
|
+
* @notInstrumented
|
|
7572
|
+
*/
|
|
7573
|
+
const getEnabledChains = (client) => {
|
|
7574
|
+
const networkProviderBuilderRegistry = require_getNetworkProviderFromNetworkId.getNetworkProviderBuilderRegistry(client);
|
|
7575
|
+
return new Set(networkProviderBuilderRegistry.get().keys());
|
|
7576
|
+
};
|
|
7577
|
+
|
|
7578
|
+
//#endregion
|
|
7579
|
+
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
7580
|
+
/**
|
|
7581
|
+
* Returns every chain a wallet book entry advertises support for —
|
|
7582
|
+
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
7583
|
+
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
7584
|
+
* supports EVM + SOL) gets one option per chain rather than one option
|
|
7585
|
+
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
7586
|
+
*
|
|
7587
|
+
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
7588
|
+
* (`['EVM']` default) when neither field is populated, so the helper
|
|
7589
|
+
* never returns an empty array — every eligible wallet emits at least
|
|
7590
|
+
* one option.
|
|
7591
|
+
*
|
|
7592
|
+
* @param params.wallet - The wallet schema from the wallet book.
|
|
7593
|
+
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
7594
|
+
* @returns Ordered, deduped array of Chains.
|
|
7595
|
+
* @notInstrumented
|
|
7596
|
+
*/
|
|
7597
|
+
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
7598
|
+
const chains = /* @__PURE__ */ new Set();
|
|
7599
|
+
for (const entry of wallet.injectedConfig ?? []) {
|
|
7600
|
+
if (!entry.chain) continue;
|
|
7601
|
+
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
7602
|
+
if (chain) chains.add(chain);
|
|
7603
|
+
}
|
|
7604
|
+
for (const identifier of wallet.chains ?? []) {
|
|
7605
|
+
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
7606
|
+
try {
|
|
7607
|
+
const chain = require_logoutWithReason.getChainFromVerifiedCredentialChain(prefix);
|
|
7608
|
+
chains.add(chain);
|
|
7609
|
+
} catch {}
|
|
7610
|
+
}
|
|
7611
|
+
if (chains.size === 0) {
|
|
7612
|
+
const chain = getChainFromWalletSchema({
|
|
7613
|
+
wallet,
|
|
7614
|
+
walletKey
|
|
7615
|
+
});
|
|
7616
|
+
chains.add(chain);
|
|
7617
|
+
}
|
|
7618
|
+
return Array.from(chains);
|
|
7619
|
+
};
|
|
7620
|
+
|
|
7344
7621
|
//#endregion
|
|
7345
7622
|
//#region src/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.ts
|
|
7346
7623
|
/**
|
|
@@ -7386,11 +7663,17 @@ const getInAppBrowserUrl = ({ wallet }) => wallet.mobile?.inAppBrowserV2 ?? wall
|
|
|
7386
7663
|
* and injected-only wallets are dropped — so the catalogue's notion of
|
|
7387
7664
|
* "external wallet" stays consistent across option types.
|
|
7388
7665
|
*
|
|
7666
|
+
* A wallet's in-app browser opens a single session, so it emits one option
|
|
7667
|
+
* tagged with the first chain it advertises that the client has an
|
|
7668
|
+
* extension for — a multi-chain wallet is still reachable when only one of
|
|
7669
|
+
* its chains is enabled.
|
|
7670
|
+
*
|
|
7671
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
7389
7672
|
* @param params.walletBook - The fetched wallet book.
|
|
7390
7673
|
* @returns Tagged `inAppBrowser` options paired with their wallet option keys.
|
|
7391
7674
|
* @notInstrumented
|
|
7392
7675
|
*/
|
|
7393
|
-
const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
7676
|
+
const buildInAppBrowserOptions = ({ enabledChains, walletBook }) => {
|
|
7394
7677
|
const result = [];
|
|
7395
7678
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
7396
7679
|
if (shouldFilterWallet({
|
|
@@ -7399,12 +7682,14 @@ const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
|
7399
7682
|
})) continue;
|
|
7400
7683
|
const url = getInAppBrowserUrl({ wallet });
|
|
7401
7684
|
if (!url) continue;
|
|
7685
|
+
const chain = getChainsFromWalletSchema({
|
|
7686
|
+
wallet,
|
|
7687
|
+
walletKey
|
|
7688
|
+
}).find((advertisedChain) => enabledChains.has(advertisedChain));
|
|
7689
|
+
if (!chain) continue;
|
|
7402
7690
|
result.push({
|
|
7403
7691
|
option: {
|
|
7404
|
-
chain
|
|
7405
|
-
wallet,
|
|
7406
|
-
walletKey
|
|
7407
|
-
}),
|
|
7692
|
+
chain,
|
|
7408
7693
|
type: "inAppBrowser",
|
|
7409
7694
|
url
|
|
7410
7695
|
},
|
|
@@ -7477,17 +7762,25 @@ const hasAnyInstallationUrl = ({ urls }) => Object.values(urls).some(Boolean);
|
|
|
7477
7762
|
* Reuses the generic `shouldFilterWallet` rules so embedded wallets do
|
|
7478
7763
|
* not appear here either — they're not user-installable products.
|
|
7479
7764
|
*
|
|
7765
|
+
* Wallets that advertise no chain this client has an extension for are
|
|
7766
|
+
* skipped: installing them would not make them connectable.
|
|
7767
|
+
*
|
|
7768
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
7480
7769
|
* @param params.walletBook - The fetched wallet book.
|
|
7481
7770
|
* @returns A map from wallet option key to its install URL bag.
|
|
7482
7771
|
* @notInstrumented
|
|
7483
7772
|
*/
|
|
7484
|
-
const buildInstallationUrlsByWalletOptionKey = ({ walletBook }) => {
|
|
7773
|
+
const buildInstallationUrlsByWalletOptionKey = ({ enabledChains, walletBook }) => {
|
|
7485
7774
|
const map = /* @__PURE__ */ new Map();
|
|
7486
7775
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
7487
7776
|
if (shouldFilterWallet({
|
|
7488
7777
|
wallet,
|
|
7489
7778
|
walletKey
|
|
7490
7779
|
})) continue;
|
|
7780
|
+
if (!getChainsFromWalletSchema({
|
|
7781
|
+
wallet,
|
|
7782
|
+
walletKey
|
|
7783
|
+
}).some((chain) => enabledChains.has(chain))) continue;
|
|
7491
7784
|
const urls = buildInstallationUrls({ wallet });
|
|
7492
7785
|
if (!hasAnyInstallationUrl({ urls })) continue;
|
|
7493
7786
|
const walletOptionKey = resolveWalletBookWalletOptionKey({
|
|
@@ -7579,49 +7872,6 @@ const buildMetaMaskSdkUriOptions = ({ walletBook }) => {
|
|
|
7579
7872
|
return [];
|
|
7580
7873
|
};
|
|
7581
7874
|
|
|
7582
|
-
//#endregion
|
|
7583
|
-
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
7584
|
-
/**
|
|
7585
|
-
* Returns every chain a wallet book entry advertises support for —
|
|
7586
|
-
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
7587
|
-
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
7588
|
-
* supports EVM + SOL) gets one option per chain rather than one option
|
|
7589
|
-
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
7590
|
-
*
|
|
7591
|
-
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
7592
|
-
* (`['EVM']` default) when neither field is populated, so the helper
|
|
7593
|
-
* never returns an empty array — every eligible wallet emits at least
|
|
7594
|
-
* one option.
|
|
7595
|
-
*
|
|
7596
|
-
* @param params.wallet - The wallet schema from the wallet book.
|
|
7597
|
-
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
7598
|
-
* @returns Ordered, deduped array of Chains.
|
|
7599
|
-
* @notInstrumented
|
|
7600
|
-
*/
|
|
7601
|
-
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
7602
|
-
const chains = /* @__PURE__ */ new Set();
|
|
7603
|
-
for (const entry of wallet.injectedConfig ?? []) {
|
|
7604
|
-
if (!entry.chain) continue;
|
|
7605
|
-
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
7606
|
-
if (chain) chains.add(chain);
|
|
7607
|
-
}
|
|
7608
|
-
for (const identifier of wallet.chains ?? []) {
|
|
7609
|
-
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
7610
|
-
try {
|
|
7611
|
-
const chain = require_logoutWithReason.getChainFromVerifiedCredentialChain(prefix);
|
|
7612
|
-
chains.add(chain);
|
|
7613
|
-
} catch {}
|
|
7614
|
-
}
|
|
7615
|
-
if (chains.size === 0) {
|
|
7616
|
-
const chain = getChainFromWalletSchema({
|
|
7617
|
-
wallet,
|
|
7618
|
-
walletKey
|
|
7619
|
-
});
|
|
7620
|
-
chains.add(chain);
|
|
7621
|
-
}
|
|
7622
|
-
return Array.from(chains);
|
|
7623
|
-
};
|
|
7624
|
-
|
|
7625
7875
|
//#endregion
|
|
7626
7876
|
//#region src/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.ts
|
|
7627
7877
|
/**
|
|
@@ -8006,6 +8256,31 @@ const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
|
|
|
8006
8256
|
*/
|
|
8007
8257
|
const EXCLUDED_WALLET_OPTION_KEYS = new Set(["coinbase", "coinbasewallet"]);
|
|
8008
8258
|
|
|
8259
|
+
//#endregion
|
|
8260
|
+
//#region src/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/filterConnectionOptionsByEnabledChains.ts
|
|
8261
|
+
/**
|
|
8262
|
+
* Drops options whose chain has no extension on this client. The wallet
|
|
8263
|
+
* book advertises every chain a wallet supports, so options derived from
|
|
8264
|
+
* it have to be narrowed to the chains the client can actually connect
|
|
8265
|
+
* on — otherwise the catalogue surfaces a connection the customer has no
|
|
8266
|
+
* primitive to drive.
|
|
8267
|
+
*
|
|
8268
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
8269
|
+
* @param params.options - The tagged options to narrow.
|
|
8270
|
+
* @returns The options on enabled chains, in input order.
|
|
8271
|
+
* @example
|
|
8272
|
+
* ```typescript
|
|
8273
|
+
* filterConnectionOptionsByEnabledChains({
|
|
8274
|
+
* enabledChains: new Set(['EVM']),
|
|
8275
|
+
* options: [evmOption, solOption],
|
|
8276
|
+
* }); // [evmOption]
|
|
8277
|
+
* ```
|
|
8278
|
+
* @see {@link getEnabledChains} for how the enabled chains are derived.
|
|
8279
|
+
* @see {@link getWalletOptionsCatalogue} for the catalogue that applies this filter.
|
|
8280
|
+
* @notInstrumented
|
|
8281
|
+
*/
|
|
8282
|
+
const filterConnectionOptionsByEnabledChains = ({ enabledChains, options }) => options.filter(({ option }) => enabledChains.has(option.chain));
|
|
8283
|
+
|
|
8009
8284
|
//#endregion
|
|
8010
8285
|
//#region src/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.ts
|
|
8011
8286
|
/**
|
|
@@ -8250,6 +8525,10 @@ const EMPTY_WALLET_BOOK = {
|
|
|
8250
8525
|
* pass `includeMobileOptions: true` to additionally surface
|
|
8251
8526
|
* WalletConnect, in-app-browser, and install links.
|
|
8252
8527
|
*
|
|
8528
|
+
* Options sourced from the wallet book are scoped to the chains this
|
|
8529
|
+
* client has an extension for — a wallet is only surfaced on chains the
|
|
8530
|
+
* customer can actually connect on.
|
|
8531
|
+
*
|
|
8253
8532
|
* Pass `excludedConnectionOptionTypes` to drop specific connection types
|
|
8254
8533
|
* from the catalogue (e.g. `['inAppBrowser']` on desktop). Wallets whose
|
|
8255
8534
|
* only connection was an excluded type fall through to the install-only
|
|
@@ -8265,6 +8544,7 @@ const getWalletOptionsCatalogue = async (params = {}, client = require_logoutWit
|
|
|
8265
8544
|
const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
|
|
8266
8545
|
const excludedConnectionOptionTypes = new Set(params.excludedConnectionOptionTypes ?? []);
|
|
8267
8546
|
const walletBook = includeMobileOptions ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
|
|
8547
|
+
const enabledChains = getEnabledChains(client);
|
|
8268
8548
|
const allConnectionOptions = [];
|
|
8269
8549
|
if (!excludedConnectionOptionTypes.has("withWalletProvider")) {
|
|
8270
8550
|
const entries = require_logoutWithReason.getWalletProviderRegistry(client).listProviderEntries();
|
|
@@ -8274,11 +8554,22 @@ const getWalletOptionsCatalogue = async (params = {}, client = require_logoutWit
|
|
|
8274
8554
|
}, client));
|
|
8275
8555
|
}
|
|
8276
8556
|
if (includeMobileOptions) {
|
|
8277
|
-
|
|
8278
|
-
if (!excludedConnectionOptionTypes.has("
|
|
8279
|
-
if (!excludedConnectionOptionTypes.has("
|
|
8557
|
+
const walletBookOptions = [];
|
|
8558
|
+
if (!excludedConnectionOptionTypes.has("walletConnect")) walletBookOptions.push(...buildWalletConnectOptions({ walletBook }));
|
|
8559
|
+
if (!excludedConnectionOptionTypes.has("metamaskSdkUri")) walletBookOptions.push(...buildMetaMaskSdkUriOptions({ walletBook }));
|
|
8560
|
+
if (!excludedConnectionOptionTypes.has("inAppBrowser")) walletBookOptions.push(...buildInAppBrowserOptions({
|
|
8561
|
+
enabledChains,
|
|
8562
|
+
walletBook
|
|
8563
|
+
}));
|
|
8564
|
+
allConnectionOptions.push(...filterConnectionOptionsByEnabledChains({
|
|
8565
|
+
enabledChains,
|
|
8566
|
+
options: walletBookOptions
|
|
8567
|
+
}));
|
|
8280
8568
|
}
|
|
8281
|
-
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({
|
|
8569
|
+
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({
|
|
8570
|
+
enabledChains,
|
|
8571
|
+
walletBook
|
|
8572
|
+
}) : /* @__PURE__ */ new Map();
|
|
8282
8573
|
const grouped = groupOptionsByWalletOption({ options: allConnectionOptions });
|
|
8283
8574
|
const allWalletOptionKeys = new Set([...grouped.keys(), ...installationUrlsByKey.keys()]);
|
|
8284
8575
|
const walletOptions = [];
|
|
@@ -8362,6 +8653,29 @@ const __confirmTransaction_wrapped = require_logoutWithReason.instrumentFunction
|
|
|
8362
8653
|
}
|
|
8363
8654
|
});
|
|
8364
8655
|
|
|
8656
|
+
//#endregion
|
|
8657
|
+
//#region src/utils/isMobile/isMobile.ts
|
|
8658
|
+
/**
|
|
8659
|
+
* Tells whether the SDK is running on a mobile device.
|
|
8660
|
+
*
|
|
8661
|
+
* This is the web implementation, which sniffs the browser's user agent. It
|
|
8662
|
+
* lives on its own so the React Native bundler can resolve
|
|
8663
|
+
* `isMobile.native.ts` instead, which always reports `true`.
|
|
8664
|
+
*
|
|
8665
|
+
* @example
|
|
8666
|
+
* ```ts
|
|
8667
|
+
* if (isMobile()) {
|
|
8668
|
+
* // hand the pairing to the wallet app instead of rendering a QR code
|
|
8669
|
+
* }
|
|
8670
|
+
* ```
|
|
8671
|
+
*
|
|
8672
|
+
* @returns `true` when the user agent belongs to a mobile device.
|
|
8673
|
+
* @see isMobileUserAgent
|
|
8674
|
+
* @see getPlatform
|
|
8675
|
+
* @notInstrumented
|
|
8676
|
+
*/
|
|
8677
|
+
const isMobile = () => isMobileUserAgent();
|
|
8678
|
+
|
|
8365
8679
|
//#endregion
|
|
8366
8680
|
//#region src/modules/wallets/utils/getAddressesWithTypesFromConnectionResult/getAddressesWithTypesFromConnectionResult.ts
|
|
8367
8681
|
/** @notInstrumented */
|
|
@@ -9358,6 +9672,109 @@ const __selectPrimaryWalletAccount_wrapped = require_logoutWithReason.instrument
|
|
|
9358
9672
|
}
|
|
9359
9673
|
});
|
|
9360
9674
|
|
|
9675
|
+
//#endregion
|
|
9676
|
+
//#region src/utils/buildInAppBrowserUrl/buildInAppBrowserUrl.ts
|
|
9677
|
+
/**
|
|
9678
|
+
* Placeholder the wallet book leaves in in-app-browser URLs for the app URL
|
|
9679
|
+
* the wallet should open.
|
|
9680
|
+
*/
|
|
9681
|
+
const DAPP_URL_PLACEHOLDER = "{{encodedDappURI}}";
|
|
9682
|
+
/**
|
|
9683
|
+
* Fills a wallet's in-app-browser URL template with the app URL to open.
|
|
9684
|
+
*
|
|
9685
|
+
* Wallet book entries carry the entry point as a template (e.g.
|
|
9686
|
+
* `https://go.base.app/dapp?cb_url={{encodedDappURI}}`), so the URL is only
|
|
9687
|
+
* usable once every occurrence of the placeholder is substituted in,
|
|
9688
|
+
* percent-encoded. Templates without the placeholder are returned untouched —
|
|
9689
|
+
* some wallets open a fixed landing page.
|
|
9690
|
+
*
|
|
9691
|
+
* @example
|
|
9692
|
+
* ```ts
|
|
9693
|
+
* buildInAppBrowserUrl({
|
|
9694
|
+
* appUrl: 'https://myapp.xyz/login',
|
|
9695
|
+
* inAppBrowserUrl: 'https://go.base.app/dapp?cb_url={{encodedDappURI}}',
|
|
9696
|
+
* });
|
|
9697
|
+
* // Returns: 'https://go.base.app/dapp?cb_url=https%3A%2F%2Fmyapp.xyz%2Flogin'
|
|
9698
|
+
* ```
|
|
9699
|
+
*
|
|
9700
|
+
* @param params.appUrl - The URL of your app for the wallet's browser to open.
|
|
9701
|
+
* @param params.inAppBrowserUrl - The wallet's in-app-browser URL template.
|
|
9702
|
+
* @returns The in-app-browser URL to open.
|
|
9703
|
+
* @see redirectToInAppBrowser
|
|
9704
|
+
* @see getWalletOptionsCatalogue
|
|
9705
|
+
* @notInstrumented
|
|
9706
|
+
*/
|
|
9707
|
+
const buildInAppBrowserUrl = ({ appUrl, inAppBrowserUrl }) => inAppBrowserUrl.replaceAll(DAPP_URL_PLACEHOLDER, encodeURIComponent(appUrl));
|
|
9708
|
+
|
|
9709
|
+
//#endregion
|
|
9710
|
+
//#region src/modules/wallets/redirectToInAppBrowser/redirectToInAppBrowser.ts
|
|
9711
|
+
/**
|
|
9712
|
+
* Leaves your app for a wallet's in-app browser, which reloads `appUrl`
|
|
9713
|
+
* inside it.
|
|
9714
|
+
*
|
|
9715
|
+
* Call this from `handleWalletBrowserRedirect` with the URL of the page the
|
|
9716
|
+
* wallet should reload. The wallet's in-app-browser entry point is read from
|
|
9717
|
+
* the wallet options catalogue, so you only need the wallet's key. The wallet
|
|
9718
|
+
* is only injected on that reload, so the connection is made on the next page
|
|
9719
|
+
* load rather than in the current one.
|
|
9720
|
+
*
|
|
9721
|
+
* @example
|
|
9722
|
+
* ```ts
|
|
9723
|
+
* await connectWallet({
|
|
9724
|
+
* handleWalletBrowserRedirect: ({ chain, walletKey }) =>
|
|
9725
|
+
* redirectToInAppBrowser({ appUrl: window.location.href, chain, walletKey }),
|
|
9726
|
+
* walletKey: 'coinbase',
|
|
9727
|
+
* });
|
|
9728
|
+
* ```
|
|
9729
|
+
*
|
|
9730
|
+
* @param params.appUrl - The URL of your app for the wallet's browser to open.
|
|
9731
|
+
* @param params.walletKey - The wallet to open, keyed as in the wallet options catalogue.
|
|
9732
|
+
* @param [params.chain] - The chain to open the wallet's browser for. Required only when the wallet exposes an in-app browser on more than one enabled chain.
|
|
9733
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
9734
|
+
* @returns A promise that resolves once the redirect is triggered.
|
|
9735
|
+
* @throws WalletOptionNotFoundError If no wallet option matches the key.
|
|
9736
|
+
* @throws NoConnectionOptionAvailableError If the wallet exposes no in-app browser on the requested chain.
|
|
9737
|
+
* @throws AmbiguousWalletChainError If the wallet exposes an in-app browser on more than one chain and no chain was passed.
|
|
9738
|
+
* @throws UnsafeDeeplinkUrlError If the wallet's in-app-browser URL has a scheme that can execute script.
|
|
9739
|
+
* @see connectWallet
|
|
9740
|
+
* @see WalletBrowserRedirectHandlerParams
|
|
9741
|
+
* @instrumented
|
|
9742
|
+
*/
|
|
9743
|
+
const redirectToInAppBrowser = async ({ appUrl, chain, walletKey }, client = require_logoutWithReason.getDefaultClient()) => {
|
|
9744
|
+
const walletOption = (await getWalletOptionsCatalogue({ includeMobileOptions: true }, client)).find(({ key }) => key === walletKey);
|
|
9745
|
+
if (!walletOption) throw new WalletOptionNotFoundError({ walletKey });
|
|
9746
|
+
const inAppBrowserOptions = walletOption.connectionOptions.filter((option) => option.type === "inAppBrowser" && (!chain || option.chain === chain));
|
|
9747
|
+
if (inAppBrowserOptions.length === 0) throw new NoConnectionOptionAvailableError({
|
|
9748
|
+
chain,
|
|
9749
|
+
installationUrls: walletOption.installationUrls,
|
|
9750
|
+
walletKey
|
|
9751
|
+
});
|
|
9752
|
+
const availableChains = [...new Set(inAppBrowserOptions.map((option) => option.chain))];
|
|
9753
|
+
if (!chain && availableChains.length > 1) throw new AmbiguousWalletChainError({
|
|
9754
|
+
chains: availableChains,
|
|
9755
|
+
walletKey
|
|
9756
|
+
});
|
|
9757
|
+
const [inAppBrowserOption] = inAppBrowserOptions;
|
|
9758
|
+
const urlToOpen = buildInAppBrowserUrl({
|
|
9759
|
+
appUrl,
|
|
9760
|
+
inAppBrowserUrl: inAppBrowserOption.url
|
|
9761
|
+
});
|
|
9762
|
+
require_getNetworkProviderFromNetworkId.assertSafeDeeplinkUrl(urlToOpen);
|
|
9763
|
+
await require_logoutWithReason.getCore(client).openDeeplink(urlToOpen);
|
|
9764
|
+
};
|
|
9765
|
+
const __redirectToInAppBrowser_impl = redirectToInAppBrowser;
|
|
9766
|
+
const __redirectToInAppBrowser_wrapped = require_logoutWithReason.instrumentFunction({
|
|
9767
|
+
fn: __redirectToInAppBrowser_impl,
|
|
9768
|
+
functionName: "redirectToInAppBrowser",
|
|
9769
|
+
getCore: () => {
|
|
9770
|
+
try {
|
|
9771
|
+
return require_logoutWithReason.getCore(require_logoutWithReason.getDefaultClient());
|
|
9772
|
+
} catch {
|
|
9773
|
+
return;
|
|
9774
|
+
}
|
|
9775
|
+
}
|
|
9776
|
+
});
|
|
9777
|
+
|
|
9361
9778
|
//#endregion
|
|
9362
9779
|
//#region src/modules/wallets/disconnectWalletAccount/disconnectWalletAccount.ts
|
|
9363
9780
|
/**
|
|
@@ -9989,6 +10406,40 @@ const appendConnectionUriToDeeplink = ({ connectionUri, deeplinkUrl }) => {
|
|
|
9989
10406
|
return url.href;
|
|
9990
10407
|
};
|
|
9991
10408
|
|
|
10409
|
+
//#endregion
|
|
10410
|
+
//#region src/utils/getPreferredWalletDeepLink/getPreferredWalletDeepLink.ts
|
|
10411
|
+
/**
|
|
10412
|
+
* Picks the most appropriate deep link variant for the current platform.
|
|
10413
|
+
*
|
|
10414
|
+
* Mobile (Android, iOS, tablets) prefers `native` because the OS treats
|
|
10415
|
+
* custom URL schemes as first-class app links and gives the wallet a faster
|
|
10416
|
+
* round-trip back to the dApp. Desktop prefers `universal` because browsers
|
|
10417
|
+
* cannot resolve mobile-only custom schemes and need an `https://` link
|
|
10418
|
+
* that opens the wallet's web flow.
|
|
10419
|
+
*
|
|
10420
|
+
* In either case, the alternative is used as a fallback when the preferred
|
|
10421
|
+
* variant is missing. Returns `undefined` only when both variants are
|
|
10422
|
+
* absent.
|
|
10423
|
+
*
|
|
10424
|
+
* @example
|
|
10425
|
+
* ```ts
|
|
10426
|
+
* const deepLink = getPreferredWalletDeepLink({
|
|
10427
|
+
* deeplinks: wallet.deeplinks,
|
|
10428
|
+
* });
|
|
10429
|
+
* ```
|
|
10430
|
+
*
|
|
10431
|
+
* @param params.deeplinks - The deep link variants for a wallet (typically `WalletConnectCatalogWallet.deeplinks`).
|
|
10432
|
+
* @returns The preferred deep link URL, or `undefined` if neither variant is available.
|
|
10433
|
+
* @see appendConnectionUriToDeeplink
|
|
10434
|
+
* @see getConnectionUriDeeplink
|
|
10435
|
+
* @notInstrumented
|
|
10436
|
+
*/
|
|
10437
|
+
const getPreferredWalletDeepLink = ({ deeplinks }) => {
|
|
10438
|
+
const { native, universal } = deeplinks;
|
|
10439
|
+
if (isMobile()) return native ?? universal;
|
|
10440
|
+
return universal ?? native;
|
|
10441
|
+
};
|
|
10442
|
+
|
|
9992
10443
|
//#endregion
|
|
9993
10444
|
//#region src/utils/parseUserAgent/parseUserAgent.ts
|
|
9994
10445
|
const browserMatchers = [
|
|
@@ -10070,6 +10521,7 @@ const parseUserAgent = ({ userAgent }) => {
|
|
|
10070
10521
|
(0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(require_logoutWithReason.name, require_logoutWithReason.version);
|
|
10071
10522
|
|
|
10072
10523
|
//#endregion
|
|
10524
|
+
exports.AmbiguousWalletChainError = AmbiguousWalletChainError;
|
|
10073
10525
|
exports.BaseError = require_logoutWithReason.BaseError;
|
|
10074
10526
|
exports.COINBASE_TRAVEL_RULE_FIELD_DESCRIPTIONS = COINBASE_TRAVEL_RULE_FIELD_DESCRIPTIONS;
|
|
10075
10527
|
exports.CaptchaProviderEnum = CaptchaProviderEnum;
|
|
@@ -10104,6 +10556,7 @@ exports.NetworkAddingUnavailableError = NetworkAddingUnavailableError;
|
|
|
10104
10556
|
exports.NetworkNotAddedError = NetworkNotAddedError;
|
|
10105
10557
|
exports.NetworkSwitchingUnavailableError = NetworkSwitchingUnavailableError;
|
|
10106
10558
|
exports.NoAddressFoundError = NoAddressFoundError;
|
|
10559
|
+
exports.NoConnectionOptionAvailableError = NoConnectionOptionAvailableError;
|
|
10107
10560
|
exports.NoNetworkProvidersError = require_getNetworkProviderFromNetworkId.NoNetworkProvidersError;
|
|
10108
10561
|
exports.NoPasskeyCredentialsFoundError = NoPasskeyCredentialsFoundError;
|
|
10109
10562
|
exports.NoSmartWalletAccountSignerFoundError = NoSmartWalletAccountSignerFoundError;
|
|
@@ -10129,6 +10582,7 @@ exports.WaasRbacStaleRetryUnsafeError = require_isUserOnboardingComplete.WaasRba
|
|
|
10129
10582
|
exports.WalletAccountAlreadyVerifiedError = WalletAccountAlreadyVerifiedError;
|
|
10130
10583
|
exports.WalletAccountNotSelectedError = WalletAccountNotSelectedError;
|
|
10131
10584
|
exports.WalletAlreadyLinkedToAnotherUserError = require_getNetworkProviderFromNetworkId.WalletAlreadyLinkedToAnotherUserError;
|
|
10585
|
+
exports.WalletOptionNotFoundError = WalletOptionNotFoundError;
|
|
10132
10586
|
exports.WalletProviderMethodUnavailableError = WalletProviderMethodUnavailableError;
|
|
10133
10587
|
exports.WalletScreeningBlockedError = require_getNetworkProviderFromNetworkId.WalletScreeningBlockedError;
|
|
10134
10588
|
exports.acknowledgeRecoveryCodes = __acknowledgeRecoveryCodes_wrapped;
|
|
@@ -10211,6 +10665,7 @@ exports.getNativeBalance = getNativeBalance;
|
|
|
10211
10665
|
exports.getNetworksData = require_getNetworkProviderFromNetworkId.getNetworksData;
|
|
10212
10666
|
exports.getOwnerWalletAccountForSmartWalletAccount = getOwnerWalletAccountForSmartWalletAccount;
|
|
10213
10667
|
exports.getPasskeys = getPasskeys;
|
|
10668
|
+
exports.getPreferredWalletDeepLink = getPreferredWalletDeepLink;
|
|
10214
10669
|
exports.getPrimaryWalletAccount = getPrimaryWalletAccount;
|
|
10215
10670
|
exports.getRegisteredDevices = getRegisteredDevices;
|
|
10216
10671
|
exports.getSelectedWalletAccount = getSelectedWalletAccount;
|
|
@@ -10260,6 +10715,7 @@ exports.parseUserAgent = parseUserAgent;
|
|
|
10260
10715
|
exports.prepareCheckoutTransaction = __prepareCheckoutTransaction_wrapped;
|
|
10261
10716
|
exports.prepareFlowSigning = __prepareFlowSigning_wrapped;
|
|
10262
10717
|
exports.proveWalletAccountOwnership = __proveWalletAccountOwnership_wrapped;
|
|
10718
|
+
exports.redirectToInAppBrowser = __redirectToInAppBrowser_wrapped;
|
|
10263
10719
|
exports.refreshAuth = require_logoutWithReason.__refreshAuth_wrapped;
|
|
10264
10720
|
exports.refreshUser = __refreshUser_wrapped;
|
|
10265
10721
|
exports.registerPasskey = __registerPasskey_wrapped;
|