@dynamic-labs-sdk/client 1.31.1 → 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-BZfdx9fH.native.esm.js → apiClient-d2qJyIvx.native.esm.js} +2 -2
- package/dist/{apiClient-BZfdx9fH.native.esm.js.map → apiClient-d2qJyIvx.native.esm.js.map} +1 -1
- package/dist/core.cjs +77 -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 +76 -6
- 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 +4 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +7 -1
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-CbMpiSub.esm.js → getNetworkProviderFromNetworkId-D9nx6Od5.esm.js} +7 -7
- package/dist/getNetworkProviderFromNetworkId-D9nx6Od5.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-DRA4M5Ab.native.esm.js → getNetworkProviderFromNetworkId-DF9kPibD.native.esm.js} +3 -3
- package/dist/{getNetworkProviderFromNetworkId-DRA4M5Ab.native.esm.js.map → getNetworkProviderFromNetworkId-DF9kPibD.native.esm.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-DNIuJp20.cjs → getNetworkProviderFromNetworkId-DueBnAl6.cjs} +2 -2
- package/dist/{getNetworkProviderFromNetworkId-DNIuJp20.cjs.map → getNetworkProviderFromNetworkId-DueBnAl6.cjs.map} +1 -1
- package/dist/{getSignedSessionId-DKKSCpj9.native.esm.js → getSignedSessionId-5q4uyZsv.native.esm.js} +34 -4
- package/dist/getSignedSessionId-5q4uyZsv.native.esm.js.map +1 -0
- package/dist/{getSignedSessionId--wpV_VKs.cjs → getSignedSessionId-B5oxmSTs.cjs} +39 -3
- package/dist/getSignedSessionId-B5oxmSTs.cjs.map +1 -0
- package/dist/{getSignedSessionId-DHn6yhGX.esm.js → getSignedSessionId-BKfQycNo.esm.js} +34 -4
- package/dist/getSignedSessionId-BKfQycNo.esm.js.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-B5LUGiDP.cjs → getVerifiedCredentialForWalletAccount-Bx0HlvfW.cjs} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-B5LUGiDP.cjs.map → getVerifiedCredentialForWalletAccount-Bx0HlvfW.cjs.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-C_GcjgC8.esm.js → getVerifiedCredentialForWalletAccount-_3MExyld.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-C_GcjgC8.esm.js.map → getVerifiedCredentialForWalletAccount-_3MExyld.esm.js.map} +1 -1
- package/dist/index.cjs +398 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +396 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +352 -28
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-D1a1Nudo.esm.js → isMfaRequiredForAction-BDmY2_Sj.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-D1a1Nudo.esm.js.map → isMfaRequiredForAction-BDmY2_Sj.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-CC7bjhqy.native.esm.js → isMfaRequiredForAction-BrRCSvEX.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-CC7bjhqy.native.esm.js.map → isMfaRequiredForAction-BrRCSvEX.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-YjJLLFFs.cjs → isMfaRequiredForAction-DnKzPDZk.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-YjJLLFFs.cjs.map → isMfaRequiredForAction-DnKzPDZk.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-C2ZuLDT9.cjs → isUserOnboardingComplete-7GzNYU2g.cjs} +3 -3
- package/dist/{isUserOnboardingComplete-C2ZuLDT9.cjs.map → isUserOnboardingComplete-7GzNYU2g.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-BIjk67vX.native.esm.js → isUserOnboardingComplete-BfMMBtkF.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-BIjk67vX.native.esm.js.map → isUserOnboardingComplete-BfMMBtkF.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-C4bE5xqM.esm.js → isUserOnboardingComplete-D1-QluDm.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-C4bE5xqM.esm.js.map → isUserOnboardingComplete-D1-QluDm.esm.js.map} +1 -1
- package/dist/{logoutWithReason-BcWQGREO.native.esm.js → logoutWithReason-3UICYir7.native.esm.js} +2 -2
- package/dist/{logoutWithReason-BcWQGREO.native.esm.js.map → logoutWithReason-3UICYir7.native.esm.js.map} +1 -1
- package/dist/{logoutWithReason-BqsgA8gI.esm.js → logoutWithReason-CHyuBHdx.esm.js} +2 -2
- package/dist/{logoutWithReason-BqsgA8gI.esm.js.map → logoutWithReason-CHyuBHdx.esm.js.map} +1 -1
- package/dist/{logoutWithReason-D6ruPOvJ.cjs → logoutWithReason-C_T7KddM.cjs} +2 -2
- package/dist/{logoutWithReason-D6ruPOvJ.cjs.map → logoutWithReason-C_T7KddM.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-zazAx6WV.esm.js → migrateFromFireblocks-BMO3u6rO.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-zazAx6WV.esm.js.map → migrateFromFireblocks-BMO3u6rO.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-CCNTDCmW.cjs → migrateFromFireblocks-C9Kuke5V.cjs} +2 -2
- package/dist/{migrateFromFireblocks-CCNTDCmW.cjs.map → migrateFromFireblocks-C9Kuke5V.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-BxPgqhbu.native.esm.js → migrateFromFireblocks-DJt9bktR.native.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-BxPgqhbu.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/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/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-DidjjQjB.native.esm.js → waas-9QajYGeK.native.esm.js} +4 -4
- package/dist/{waas-DidjjQjB.native.esm.js.map → waas-9QajYGeK.native.esm.js.map} +1 -1
- package/dist/{waas-ZWlJHeXc.cjs → waas-Bxsd0-HG.cjs} +4 -4
- package/dist/{waas-ZWlJHeXc.cjs.map → waas-Bxsd0-HG.cjs.map} +1 -1
- package/dist/{waas-C2PbR02F.esm.js → waas-T_dHXyI9.esm.js} +4 -4
- package/dist/{waas-C2PbR02F.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-CbMpiSub.esm.js.map +0 -1
- package/dist/getSignedSessionId--wpV_VKs.cjs.map +0 -1
- package/dist/getSignedSessionId-DHn6yhGX.esm.js.map +0 -1
- package/dist/getSignedSessionId-DKKSCpj9.native.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
|
/**
|
|
@@ -8447,6 +8653,29 @@ const __confirmTransaction_wrapped = require_logoutWithReason.instrumentFunction
|
|
|
8447
8653
|
}
|
|
8448
8654
|
});
|
|
8449
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
|
+
|
|
8450
8679
|
//#endregion
|
|
8451
8680
|
//#region src/modules/wallets/utils/getAddressesWithTypesFromConnectionResult/getAddressesWithTypesFromConnectionResult.ts
|
|
8452
8681
|
/** @notInstrumented */
|
|
@@ -9443,6 +9672,109 @@ const __selectPrimaryWalletAccount_wrapped = require_logoutWithReason.instrument
|
|
|
9443
9672
|
}
|
|
9444
9673
|
});
|
|
9445
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
|
+
|
|
9446
9778
|
//#endregion
|
|
9447
9779
|
//#region src/modules/wallets/disconnectWalletAccount/disconnectWalletAccount.ts
|
|
9448
9780
|
/**
|
|
@@ -10074,6 +10406,40 @@ const appendConnectionUriToDeeplink = ({ connectionUri, deeplinkUrl }) => {
|
|
|
10074
10406
|
return url.href;
|
|
10075
10407
|
};
|
|
10076
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
|
+
|
|
10077
10443
|
//#endregion
|
|
10078
10444
|
//#region src/utils/parseUserAgent/parseUserAgent.ts
|
|
10079
10445
|
const browserMatchers = [
|
|
@@ -10155,6 +10521,7 @@ const parseUserAgent = ({ userAgent }) => {
|
|
|
10155
10521
|
(0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(require_logoutWithReason.name, require_logoutWithReason.version);
|
|
10156
10522
|
|
|
10157
10523
|
//#endregion
|
|
10524
|
+
exports.AmbiguousWalletChainError = AmbiguousWalletChainError;
|
|
10158
10525
|
exports.BaseError = require_logoutWithReason.BaseError;
|
|
10159
10526
|
exports.COINBASE_TRAVEL_RULE_FIELD_DESCRIPTIONS = COINBASE_TRAVEL_RULE_FIELD_DESCRIPTIONS;
|
|
10160
10527
|
exports.CaptchaProviderEnum = CaptchaProviderEnum;
|
|
@@ -10189,6 +10556,7 @@ exports.NetworkAddingUnavailableError = NetworkAddingUnavailableError;
|
|
|
10189
10556
|
exports.NetworkNotAddedError = NetworkNotAddedError;
|
|
10190
10557
|
exports.NetworkSwitchingUnavailableError = NetworkSwitchingUnavailableError;
|
|
10191
10558
|
exports.NoAddressFoundError = NoAddressFoundError;
|
|
10559
|
+
exports.NoConnectionOptionAvailableError = NoConnectionOptionAvailableError;
|
|
10192
10560
|
exports.NoNetworkProvidersError = require_getNetworkProviderFromNetworkId.NoNetworkProvidersError;
|
|
10193
10561
|
exports.NoPasskeyCredentialsFoundError = NoPasskeyCredentialsFoundError;
|
|
10194
10562
|
exports.NoSmartWalletAccountSignerFoundError = NoSmartWalletAccountSignerFoundError;
|
|
@@ -10214,6 +10582,7 @@ exports.WaasRbacStaleRetryUnsafeError = require_isUserOnboardingComplete.WaasRba
|
|
|
10214
10582
|
exports.WalletAccountAlreadyVerifiedError = WalletAccountAlreadyVerifiedError;
|
|
10215
10583
|
exports.WalletAccountNotSelectedError = WalletAccountNotSelectedError;
|
|
10216
10584
|
exports.WalletAlreadyLinkedToAnotherUserError = require_getNetworkProviderFromNetworkId.WalletAlreadyLinkedToAnotherUserError;
|
|
10585
|
+
exports.WalletOptionNotFoundError = WalletOptionNotFoundError;
|
|
10217
10586
|
exports.WalletProviderMethodUnavailableError = WalletProviderMethodUnavailableError;
|
|
10218
10587
|
exports.WalletScreeningBlockedError = require_getNetworkProviderFromNetworkId.WalletScreeningBlockedError;
|
|
10219
10588
|
exports.acknowledgeRecoveryCodes = __acknowledgeRecoveryCodes_wrapped;
|
|
@@ -10296,6 +10665,7 @@ exports.getNativeBalance = getNativeBalance;
|
|
|
10296
10665
|
exports.getNetworksData = require_getNetworkProviderFromNetworkId.getNetworksData;
|
|
10297
10666
|
exports.getOwnerWalletAccountForSmartWalletAccount = getOwnerWalletAccountForSmartWalletAccount;
|
|
10298
10667
|
exports.getPasskeys = getPasskeys;
|
|
10668
|
+
exports.getPreferredWalletDeepLink = getPreferredWalletDeepLink;
|
|
10299
10669
|
exports.getPrimaryWalletAccount = getPrimaryWalletAccount;
|
|
10300
10670
|
exports.getRegisteredDevices = getRegisteredDevices;
|
|
10301
10671
|
exports.getSelectedWalletAccount = getSelectedWalletAccount;
|
|
@@ -10345,6 +10715,7 @@ exports.parseUserAgent = parseUserAgent;
|
|
|
10345
10715
|
exports.prepareCheckoutTransaction = __prepareCheckoutTransaction_wrapped;
|
|
10346
10716
|
exports.prepareFlowSigning = __prepareFlowSigning_wrapped;
|
|
10347
10717
|
exports.proveWalletAccountOwnership = __proveWalletAccountOwnership_wrapped;
|
|
10718
|
+
exports.redirectToInAppBrowser = __redirectToInAppBrowser_wrapped;
|
|
10348
10719
|
exports.refreshAuth = require_logoutWithReason.__refreshAuth_wrapped;
|
|
10349
10720
|
exports.refreshUser = __refreshUser_wrapped;
|
|
10350
10721
|
exports.registerPasskey = __registerPasskey_wrapped;
|