@dynamic-labs-sdk/client 1.4.0 → 1.6.0
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/{InvalidParamError-CDmVW2DS.native.esm.js → InvalidParamError-BIptAjbC.native.esm.js} +839 -93
- package/dist/InvalidParamError-BIptAjbC.native.esm.js.map +1 -0
- package/dist/{InvalidParamError-BPMi0iWC.esm.js → InvalidParamError-BZ0LHaml.esm.js} +806 -93
- package/dist/InvalidParamError-BZ0LHaml.esm.js.map +1 -0
- package/dist/{InvalidParamError-DEmLKJKZ.cjs → InvalidParamError-DyXEKMWn.cjs} +1012 -116
- package/dist/InvalidParamError-DyXEKMWn.cjs.map +1 -0
- package/dist/{NotWaasWalletAccountError-Cntietge.esm.js → NotWaasWalletAccountError-BbOA5rPd.native.esm.js} +4 -4
- package/dist/NotWaasWalletAccountError-BbOA5rPd.native.esm.js.map +1 -0
- package/dist/{NotWaasWalletAccountError-BZsBHRQe.cjs → NotWaasWalletAccountError-CElqwdQO.cjs} +4 -4
- package/dist/NotWaasWalletAccountError-CElqwdQO.cjs.map +1 -0
- package/dist/{NotWaasWalletAccountError-Chpne8_Q.native.esm.js → NotWaasWalletAccountError-nT4jrLbp.esm.js} +4 -4
- package/dist/NotWaasWalletAccountError-nT4jrLbp.esm.js.map +1 -0
- package/dist/core.cjs +45 -23
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +27 -6
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +27 -6
- package/dist/core.native.esm.js.map +1 -1
- package/dist/errors/CorruptedKeyShareError.d.ts +19 -0
- package/dist/errors/CorruptedKeyShareError.d.ts.map +1 -0
- package/dist/errors/WebViewLoadFailedError.d.ts +32 -0
- package/dist/errors/WebViewLoadFailedError.d.ts.map +1 -0
- package/dist/errors/base/BaseError.d.ts.map +1 -1
- package/dist/exports/core.d.ts +4 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +12 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-JGrKwBj7.native.esm.js → getNetworkProviderFromNetworkId-B7DIqT2T.native.esm.js} +39 -328
- package/dist/getNetworkProviderFromNetworkId-B7DIqT2T.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-CEeFL-gV.esm.js → getNetworkProviderFromNetworkId-BkAPIdRC.esm.js} +38 -266
- package/dist/getNetworkProviderFromNetworkId-BkAPIdRC.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-szJOsbQN.cjs → getNetworkProviderFromNetworkId-DbI5MZhq.cjs} +44 -341
- package/dist/getNetworkProviderFromNetworkId-DbI5MZhq.cjs.map +1 -0
- package/dist/{getSignedSessionId-B5DikCap.native.esm.js → getSignedSessionId-1TV-x__C.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-B5DikCap.native.esm.js.map → getSignedSessionId-1TV-x__C.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-BxOK-Tdo.cjs → getSignedSessionId-BF6n8gve.cjs} +3 -3
- package/dist/{getSignedSessionId-BxOK-Tdo.cjs.map → getSignedSessionId-BF6n8gve.cjs.map} +1 -1
- package/dist/{getSignedSessionId-BOx1nFt_.esm.js → getSignedSessionId-y3YtxFHZ.esm.js} +3 -3
- package/dist/{getSignedSessionId-BOx1nFt_.esm.js.map → getSignedSessionId-y3YtxFHZ.esm.js.map} +1 -1
- package/dist/getVerifiedCredentialForWalletAccount-BfJ29erz.cjs +346 -0
- package/dist/getVerifiedCredentialForWalletAccount-BfJ29erz.cjs.map +1 -0
- package/dist/getVerifiedCredentialForWalletAccount-CLyC2nOl.native.esm.js +269 -0
- package/dist/getVerifiedCredentialForWalletAccount-CLyC2nOl.native.esm.js.map +1 -0
- package/dist/getVerifiedCredentialForWalletAccount-etV50QRH.esm.js +269 -0
- package/dist/getVerifiedCredentialForWalletAccount-etV50QRH.esm.js.map +1 -0
- package/dist/index.cjs +580 -253
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +511 -191
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +511 -191
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-DUvZEpjA.native.esm.js → isMfaRequiredForAction-B2vKX31S.native.esm.js} +32 -3
- package/dist/isMfaRequiredForAction-B2vKX31S.native.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-D9p_du8C.esm.js → isMfaRequiredForAction-Dy4-S3mr.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-D9p_du8C.esm.js.map → isMfaRequiredForAction-Dy4-S3mr.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-6N6JB7wa.cjs → isMfaRequiredForAction-K2Jh-3-j.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-6N6JB7wa.cjs.map → isMfaRequiredForAction-K2Jh-3-j.cjs.map} +1 -1
- package/dist/modules/apiClient/apiClient.types.d.ts +12 -0
- package/dist/modules/apiClient/apiClient.types.d.ts.map +1 -1
- package/dist/modules/apiClient/createApiClient.d.ts.map +1 -1
- package/dist/modules/apiClient/utils/sessionExpiryLogoutMiddleware/createSessionExpiryLogoutMiddleware.d.ts +27 -0
- package/dist/modules/apiClient/utils/sessionExpiryLogoutMiddleware/createSessionExpiryLogoutMiddleware.d.ts.map +1 -0
- package/dist/modules/auth/isSignedIn/isSignedIn.d.ts +11 -1
- package/dist/modules/auth/isSignedIn/isSignedIn.d.ts.map +1 -1
- package/dist/modules/auth/logoutReason.d.ts +1 -1
- package/dist/modules/auth/logoutReason.d.ts.map +1 -1
- package/dist/modules/auth/logoutWithReason/logoutWithReason.d.ts.map +1 -1
- package/dist/modules/balances/getBalances/getBalances.d.ts +9 -45
- package/dist/modules/balances/getBalances/getBalances.d.ts.map +1 -1
- package/dist/modules/balances/getMultichainBalances/getMultichainBalances.d.ts +13 -20
- package/dist/modules/balances/getMultichainBalances/getMultichainBalances.d.ts.map +1 -1
- package/dist/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.d.ts +26 -0
- package/dist/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.d.ts.map +1 -0
- package/dist/modules/balances/getMultichainTokenBalances/index.d.ts +2 -0
- package/dist/modules/balances/getMultichainTokenBalances/index.d.ts.map +1 -0
- package/dist/modules/balances/getTokenBalances/getTokenBalances.d.ts +56 -0
- package/dist/modules/balances/getTokenBalances/getTokenBalances.d.ts.map +1 -0
- package/dist/modules/balances/getTokenBalances/index.d.ts +3 -0
- package/dist/modules/balances/getTokenBalances/index.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getRegisteredDevices/getRegisteredDevices.d.ts.map +1 -1
- package/dist/modules/funding/moonpay/errors/MoonPayCurrenciesFetchError.d.ts +5 -0
- package/dist/modules/funding/moonpay/errors/MoonPayCurrenciesFetchError.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/errors/MoonPayInvalidUrlError.d.ts +5 -0
- package/dist/modules/funding/moonpay/errors/MoonPayInvalidUrlError.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/errors/MoonPayProviderNotAvailableError.d.ts +5 -0
- package/dist/modules/funding/moonpay/errors/MoonPayProviderNotAvailableError.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/getMoonPayCurrencies/getMoonPayCurrencies.d.ts +14 -0
- package/dist/modules/funding/moonpay/getMoonPayCurrencies/getMoonPayCurrencies.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/getMoonPayCurrencies/index.d.ts +2 -0
- package/dist/modules/funding/moonpay/getMoonPayCurrencies/index.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/getMoonPayUrl/getMoonPayUrl.d.ts +15 -0
- package/dist/modules/funding/moonpay/getMoonPayUrl/getMoonPayUrl.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/getMoonPayUrl/index.d.ts +2 -0
- package/dist/modules/funding/moonpay/getMoonPayUrl/index.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/moonpay.types.d.ts +26 -0
- package/dist/modules/funding/moonpay/moonpay.types.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainFromWalletSchema/getChainFromWalletSchema.d.ts +12 -0
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainFromWalletSchema/getChainFromWalletSchema.d.ts.map +1 -1
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.d.ts +26 -0
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/hasUsableDeeplink/hasUsableDeeplink.d.ts +18 -0
- package/dist/modules/legacyWalletBook/hasUsableDeeplink/hasUsableDeeplink.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/legacyWalletBook.types.d.ts +2 -2
- package/dist/modules/legacyWalletBook/legacyWalletBook.types.d.ts.map +1 -1
- package/dist/modules/swap/executeSwapTransaction/executeSwapTransaction.d.ts +13 -1
- package/dist/modules/swap/executeSwapTransaction/executeSwapTransaction.d.ts.map +1 -1
- package/dist/modules/user/refreshAuth/refreshAuth.d.ts.map +1 -1
- package/dist/modules/waas/createWaasClient/createWaasClient.d.ts +2 -7
- package/dist/modules/waas/createWaasClient/createWaasClient.d.ts.map +1 -1
- package/dist/modules/waas/createWaasClient/createWaasClient.types.d.ts +8 -0
- package/dist/modules/waas/createWaasClient/createWaasClient.types.d.ts.map +1 -0
- package/dist/modules/waas/createWaasClient/createWaasSDKContainer.d.ts +15 -0
- package/dist/modules/waas/createWaasClient/createWaasSDKContainer.d.ts.map +1 -0
- package/dist/modules/waas/createWaasClient/translateNativeOpenError.d.ts +18 -0
- package/dist/modules/waas/createWaasClient/translateNativeOpenError.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildMetaMaskSdkUriOptions/buildMetaMaskSdkUriOptions.d.ts +27 -0
- package/dist/modules/walletOptionsCatalogue/buildMetaMaskSdkUriOptions/buildMetaMaskSdkUriOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.d.ts +26 -0
- package/dist/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts +11 -4
- package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/buildWithWalletProviderOptions/buildWithWalletProviderOptions.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/getInstallationLinkForCurrentPlatform.d.ts +35 -0
- package/dist/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/getInstallationLinkForCurrentPlatform.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/index.d.ts +2 -0
- package/dist/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/index.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts +6 -1
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts +11 -0
- package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts.map +1 -1
- package/dist/modules/wallets/constants.d.ts +7 -0
- package/dist/modules/wallets/constants.d.ts.map +1 -1
- package/dist/modules/wallets/getAvailableWalletProvidersData/getAvailableWalletProvidersData.d.ts.map +1 -1
- package/dist/modules/wallets/hasWalletProviderConnectMethod/hasWalletProviderConnectMethod.d.ts +26 -0
- package/dist/modules/wallets/hasWalletProviderConnectMethod/hasWalletProviderConnectMethod.d.ts.map +1 -0
- package/dist/modules/wallets/hasWalletProviderConnectMethod/index.d.ts +2 -0
- package/dist/modules/wallets/hasWalletProviderConnectMethod/index.d.ts.map +1 -0
- package/dist/modules/wallets/isAnyWalletAccountConnected/index.d.ts +2 -0
- package/dist/modules/wallets/isAnyWalletAccountConnected/index.d.ts.map +1 -0
- package/dist/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.d.ts +14 -0
- package/dist/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.d.ts.map +1 -0
- package/dist/modules/wallets/networks/getBalance/getBalance.d.ts +6 -17
- package/dist/modules/wallets/networks/getBalance/getBalance.d.ts.map +1 -1
- package/dist/modules/wallets/networks/getNativeBalance/getNativeBalance.d.ts +24 -0
- package/dist/modules/wallets/networks/getNativeBalance/getNativeBalance.d.ts.map +1 -0
- package/dist/modules/wallets/networks/getNativeBalance/index.d.ts +2 -0
- package/dist/modules/wallets/networks/getNativeBalance/index.d.ts.map +1 -0
- package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts +10 -0
- package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/getChainFromWalletBookIdentifier/getChainFromWalletBookIdentifier.d.ts +22 -0
- package/dist/utils/getChainFromWalletBookIdentifier/getChainFromWalletBookIdentifier.d.ts.map +1 -0
- package/dist/utils/getChainFromWalletBookIdentifier/index.d.ts +2 -0
- package/dist/utils/getChainFromWalletBookIdentifier/index.d.ts.map +1 -0
- package/dist/utils/getNativeLinkScheme/getNativeLinkScheme.d.ts +18 -0
- package/dist/utils/getNativeLinkScheme/getNativeLinkScheme.d.ts.map +1 -0
- package/dist/utils/getNativeLinkScheme/index.d.ts +3 -0
- package/dist/utils/getNativeLinkScheme/index.d.ts.map +1 -0
- package/dist/utils/isMobile/isMobile.d.ts +8 -0
- package/dist/utils/isMobile/isMobile.d.ts.map +1 -1
- package/dist/waas.cjs +8 -9
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +3 -3
- package/dist/waas.native.esm.js +3 -3
- package/dist/waasCore.cjs +3 -4
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +3 -3
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +208 -7
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +5 -5
- package/dist/InvalidParamError-BPMi0iWC.esm.js.map +0 -1
- package/dist/InvalidParamError-CDmVW2DS.native.esm.js.map +0 -1
- package/dist/InvalidParamError-DEmLKJKZ.cjs.map +0 -1
- package/dist/NotWaasWalletAccountError-BZsBHRQe.cjs.map +0 -1
- package/dist/NotWaasWalletAccountError-Chpne8_Q.native.esm.js.map +0 -1
- package/dist/NotWaasWalletAccountError-Cntietge.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-CEeFL-gV.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-JGrKwBj7.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-szJOsbQN.cjs.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-B46O0B48.cjs +0 -887
- package/dist/getVerifiedCredentialForWalletAccount-B46O0B48.cjs.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-CyykSi-M.native.esm.js +0 -701
- package/dist/getVerifiedCredentialForWalletAccount-CyykSi-M.native.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-DzwIoeHm.esm.js +0 -701
- package/dist/getVerifiedCredentialForWalletAccount-DzwIoeHm.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-DUvZEpjA.native.esm.js.map +0 -1
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/buildUriDeeplinkOptions.d.ts +0 -28
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/buildUriDeeplinkOptions.d.ts.map +0 -1
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/index.d.ts +0 -2
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/index.d.ts.map +0 -1
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/resolveUriConnectionType/index.d.ts +0 -2
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/resolveUriConnectionType/index.d.ts.map +0 -1
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/resolveUriConnectionType/resolveUriConnectionType.d.ts +0 -17
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/resolveUriConnectionType/resolveUriConnectionType.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-
|
|
4
|
-
const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-
|
|
5
|
-
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-
|
|
1
|
+
const require_InvalidParamError = require('./InvalidParamError-DyXEKMWn.cjs');
|
|
2
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-DbI5MZhq.cjs');
|
|
3
|
+
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-BfJ29erz.cjs');
|
|
4
|
+
const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-CElqwdQO.cjs');
|
|
5
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-K2Jh-3-j.cjs');
|
|
6
6
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
7
7
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
8
8
|
let zod_mini = require("zod/mini");
|
|
9
|
-
zod_mini =
|
|
9
|
+
zod_mini = require_InvalidParamError.__toESM(zod_mini);
|
|
10
10
|
let eventemitter3 = require("eventemitter3");
|
|
11
|
-
eventemitter3 =
|
|
11
|
+
eventemitter3 = require_InvalidParamError.__toESM(eventemitter3);
|
|
12
12
|
let _simplewebauthn_browser = require("@simplewebauthn/browser");
|
|
13
13
|
|
|
14
14
|
//#region src/modules/state/raiseStateEvents/events.ts
|
|
@@ -57,14 +57,6 @@ const appendConnectionUriToDeeplink = ({ connectionUri, deeplinkUrl }) => {
|
|
|
57
57
|
return url.href;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/utils/getNonce/prefetchNoncesIfNeeded/prefetchNoncesIfNeeded.ts
|
|
62
|
-
/** @not-instrumented */
|
|
63
|
-
const prefetchNoncesIfNeeded = async (client) => {
|
|
64
|
-
if (require_InvalidParamError.getCore(client).state.get().prefetchedNonces.length >= require_InvalidParamError.NONCE_POOL_SIZE) return;
|
|
65
|
-
await require_InvalidParamError.fetchAndStoreNonces(client);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
60
|
//#endregion
|
|
69
61
|
//#region src/services/runtimeServices/createRuntimeServices/createRuntimeServices.ts
|
|
70
62
|
/**
|
|
@@ -82,6 +74,14 @@ const createRuntimeServices = () => {
|
|
|
82
74
|
};
|
|
83
75
|
};
|
|
84
76
|
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/utils/getNonce/prefetchNoncesIfNeeded/prefetchNoncesIfNeeded.ts
|
|
79
|
+
/** @not-instrumented */
|
|
80
|
+
const prefetchNoncesIfNeeded = async (client) => {
|
|
81
|
+
if (require_InvalidParamError.getCore(client).state.get().prefetchedNonces.length >= require_InvalidParamError.NONCE_POOL_SIZE) return;
|
|
82
|
+
await require_InvalidParamError.fetchAndStoreNonces(client);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
85
|
//#endregion
|
|
86
86
|
//#region src/modules/auth/initializeAuth/setLongTimeout/setLongTimeout.ts
|
|
87
87
|
/**
|
|
@@ -122,7 +122,7 @@ const initializeAuth = (client) => {
|
|
|
122
122
|
const now = /* @__PURE__ */ new Date();
|
|
123
123
|
const timeUntilExpiration = expiration.getTime() - now.getTime();
|
|
124
124
|
if (timeUntilExpiration <= 0) {
|
|
125
|
-
|
|
125
|
+
require_InvalidParamError.__logoutWithReason_wrapped({ reason: "token-expired" }, client);
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
128
|
clearExpirationTimeout = setLongTimeout({
|
|
@@ -160,7 +160,7 @@ const setupCrossTabEventSync = (client) => {
|
|
|
160
160
|
};
|
|
161
161
|
core.eventEmitter.on("deviceRegistrationCompleted", handleDeviceRegistrationCompleted);
|
|
162
162
|
const handleCrossTabDeviceRegistrationCompleted = () => {
|
|
163
|
-
|
|
163
|
+
require_InvalidParamError.emitEvent({ event: "deviceRegistrationCompletedInAnotherTab" }, client);
|
|
164
164
|
};
|
|
165
165
|
core.crossTabBroadcast.on("deviceRegistrationCompleted", handleCrossTabDeviceRegistrationCompleted);
|
|
166
166
|
};
|
|
@@ -187,7 +187,7 @@ const walletProviderKeyMapSchema = zod_mini.record(zod_mini.string(), zod_mini.s
|
|
|
187
187
|
|
|
188
188
|
//#endregion
|
|
189
189
|
//#region src/modules/storageSync/schema.ts
|
|
190
|
-
const stateStorageKeySchema =
|
|
190
|
+
const stateStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
191
191
|
key: "state",
|
|
192
192
|
schema: zod_mini.object({
|
|
193
193
|
apiVersion: zod_mini.string(),
|
|
@@ -199,7 +199,7 @@ const stateStorageKeySchema = require_getNetworkProviderFromNetworkId.createStor
|
|
|
199
199
|
walletProviderKeyMap: walletProviderKeyMapSchema
|
|
200
200
|
})
|
|
201
201
|
});
|
|
202
|
-
const sessionStorageKeySchema =
|
|
202
|
+
const sessionStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
203
203
|
config: { storageTier: "secure" },
|
|
204
204
|
key: "session",
|
|
205
205
|
schema: zod_mini.object({
|
|
@@ -293,7 +293,7 @@ const raiseStateEvents = (client) => {
|
|
|
293
293
|
require_InvalidParamError.getCore(client).state.subscribe((value, previous) => {
|
|
294
294
|
Object.entries(stateChangeEvents).forEach(([key, event]) => {
|
|
295
295
|
if (require_getNetworkProviderFromNetworkId.isEqualShallow(value[key], previous[key])) return;
|
|
296
|
-
|
|
296
|
+
require_InvalidParamError.emitEvent({
|
|
297
297
|
args: { [key]: value[key] },
|
|
298
298
|
event
|
|
299
299
|
}, client);
|
|
@@ -459,10 +459,10 @@ const initializeClient = async (client = require_InvalidParamError.getDefaultCli
|
|
|
459
459
|
logger: core.logger,
|
|
460
460
|
state: core.state,
|
|
461
461
|
storage: core.storage
|
|
462
|
-
}).catch(() =>
|
|
463
|
-
if (core.state.get().sessionKeys && !await core.keychain.hasKey("session")) await
|
|
462
|
+
}).catch(() => require_InvalidParamError.__logoutWithReason_wrapped({ reason: "keychain-migration-failed" }, client));
|
|
463
|
+
if (core.state.get().sessionKeys && !await core.keychain.hasKey("session")) await require_InvalidParamError.__logoutWithReason_wrapped({ reason: "keychain-key-missing" }, client);
|
|
464
464
|
}).then(async () => {
|
|
465
|
-
if (!core.state.get().projectSettings) await
|
|
465
|
+
if (!core.state.get().projectSettings) await require_InvalidParamError.fetchProjectSettings(client);
|
|
466
466
|
});
|
|
467
467
|
fetchProjectSettingsPromise.then(() => prefetchNoncesIfNeeded(client)).catch((error) => {
|
|
468
468
|
core.logger.error("Failed to prefetch nonces:", error);
|
|
@@ -471,7 +471,7 @@ const initializeClient = async (client = require_InvalidParamError.getDefaultCli
|
|
|
471
471
|
* Generate session keys if they don't exist
|
|
472
472
|
*/
|
|
473
473
|
const generateSessionKeysPromise = fetchProjectSettingsPromise.then(async () => {
|
|
474
|
-
if (!core.state.get().sessionKeys) await
|
|
474
|
+
if (!core.state.get().sessionKeys) await require_InvalidParamError.generateSessionKeys(client);
|
|
475
475
|
});
|
|
476
476
|
/**
|
|
477
477
|
* Refresh user state on initialization when cookie is enabled.
|
|
@@ -496,7 +496,7 @@ const initializeClient = async (client = require_InvalidParamError.getDefaultCli
|
|
|
496
496
|
if (require_InvalidParamError.isCookieEnabled(client)) await require_NotWaasWalletAccountError.__refreshAuth_wrapped(client).catch(async (error) => {
|
|
497
497
|
if (error.status === 401) {
|
|
498
498
|
core.logger.error("Session expired during initialization", error);
|
|
499
|
-
if (client.user) await
|
|
499
|
+
if (client.user) await require_InvalidParamError.__logoutWithReason_wrapped({ reason: "session-refresh-unauthorized" }, client);
|
|
500
500
|
} else throw error;
|
|
501
501
|
});
|
|
502
502
|
});
|
|
@@ -507,7 +507,7 @@ const initializeClient = async (client = require_InvalidParamError.getDefaultCli
|
|
|
507
507
|
*/
|
|
508
508
|
const refreshUserStateFromValidTokenPromise = refreshUserStateFromCookiePromise.then(async () => {
|
|
509
509
|
if (core.state.get().token && !core.state.get().user) await __refreshUser_wrapped(client).catch(async () => {
|
|
510
|
-
await
|
|
510
|
+
await require_InvalidParamError.__logoutWithReason_wrapped({ reason: "user-refresh-failed" }, client);
|
|
511
511
|
});
|
|
512
512
|
});
|
|
513
513
|
core.initTrack.track({
|
|
@@ -1664,7 +1664,7 @@ const logout = async (client = require_InvalidParamError.getDefaultClient()) =>
|
|
|
1664
1664
|
* `logoutWithReason` — this wrapper is intentionally not instrumented so that
|
|
1665
1665
|
* Datadog sees a single function name per logout regardless of entry point.
|
|
1666
1666
|
*/
|
|
1667
|
-
return
|
|
1667
|
+
return require_InvalidParamError.__logoutWithReason_wrapped({ reason: "user-intent" }, client);
|
|
1668
1668
|
};
|
|
1669
1669
|
|
|
1670
1670
|
//#endregion
|
|
@@ -1886,7 +1886,7 @@ const removeDynamicOauthParamsFromUrl = (url) => {
|
|
|
1886
1886
|
//#endregion
|
|
1887
1887
|
//#region src/modules/auth/social/oauth/redirectStateStorageSchema/redirectStateStorageSchema.ts
|
|
1888
1888
|
/** The schema to track the state of the OAuth flow. */
|
|
1889
|
-
const redirectStateStorageKeySchema =
|
|
1889
|
+
const redirectStateStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
1890
1890
|
key: "redirectState",
|
|
1891
1891
|
schema: zod_mini.object({
|
|
1892
1892
|
codeVerifier: zod_mini.optional(zod_mini.string()),
|
|
@@ -2274,7 +2274,7 @@ const detectOAuthRedirect = (params, client = require_InvalidParamError.getDefau
|
|
|
2274
2274
|
* @not-instrumented
|
|
2275
2275
|
*/
|
|
2276
2276
|
const getPrimaryWalletAccount = (client = require_InvalidParamError.getDefaultClient()) => {
|
|
2277
|
-
const sortedLastSelectedWalletAccounts =
|
|
2277
|
+
const sortedLastSelectedWalletAccounts = require_InvalidParamError.getWalletAccounts(client).filter((walletAccount) => Boolean(walletAccount.lastSelectedAt)).sort((a, b) => b.lastSelectedAt.getTime() - a.lastSelectedAt.getTime());
|
|
2278
2278
|
if (sortedLastSelectedWalletAccounts.length === 0) return null;
|
|
2279
2279
|
const [primaryWalletAccount] = sortedLastSelectedWalletAccounts;
|
|
2280
2280
|
return primaryWalletAccount;
|
|
@@ -2320,22 +2320,29 @@ const __unlinkSocialAccount_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
2320
2320
|
});
|
|
2321
2321
|
|
|
2322
2322
|
//#endregion
|
|
2323
|
-
//#region src/modules/balances/
|
|
2323
|
+
//#region src/modules/balances/getTokenBalances/getTokenBalances.ts
|
|
2324
2324
|
/**
|
|
2325
|
-
* Retrieves the token balances for a wallet account.
|
|
2325
|
+
* Retrieves the token balances for a wallet account on one chain. Fetched
|
|
2326
|
+
* from the Dynamic API.
|
|
2326
2327
|
*
|
|
2327
|
-
*
|
|
2328
|
+
* Use this for ERC-20-style token balances scoped to a single wallet
|
|
2329
|
+
* account. Supports optional spam filtering, price inclusion, native-token
|
|
2330
|
+
* inclusion, and one-or-many networks within the wallet's chain.
|
|
2331
|
+
*
|
|
2332
|
+
* For native-only balance, use {@link getNativeBalance}. For a
|
|
2333
|
+
* multi-chain portfolio across many addresses, use
|
|
2334
|
+
* {@link getMultichainTokenBalances}.
|
|
2328
2335
|
*
|
|
2329
2336
|
* @param params.walletAccount - The wallet account to get the balances for.
|
|
2330
2337
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2331
2338
|
* @returns A promise that resolves to an array of token balances.
|
|
2332
2339
|
* @not-instrumented
|
|
2333
2340
|
*/
|
|
2334
|
-
const
|
|
2341
|
+
const getTokenBalances = async ({ walletAccount, networkId, networkIds, includePrices, includeNative, filterSpamTokens, whitelistedContracts, forceRefresh }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2335
2342
|
const core = require_InvalidParamError.getCore(client);
|
|
2336
2343
|
const apiClient = require_InvalidParamError.createApiClient({}, client);
|
|
2337
2344
|
if (!networkId && !networkIds) {
|
|
2338
|
-
const activeNetworkId = await
|
|
2345
|
+
const activeNetworkId = await require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client).getActiveNetworkId();
|
|
2339
2346
|
networkId = Number(activeNetworkId.networkId);
|
|
2340
2347
|
}
|
|
2341
2348
|
return await apiClient.getAccountBalances({
|
|
@@ -2353,19 +2360,22 @@ const getBalances = async ({ walletAccount, networkId, networkIds, includePrices
|
|
|
2353
2360
|
};
|
|
2354
2361
|
|
|
2355
2362
|
//#endregion
|
|
2356
|
-
//#region src/modules/balances/
|
|
2363
|
+
//#region src/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.ts
|
|
2357
2364
|
/**
|
|
2358
|
-
* Retrieves token balances across multiple
|
|
2365
|
+
* Retrieves token balances across multiple chains, networks, and addresses
|
|
2366
|
+
* in a single batched API request.
|
|
2359
2367
|
*
|
|
2360
|
-
*
|
|
2361
|
-
*
|
|
2368
|
+
* Use this for portfolio-style views that need to render a user's holdings
|
|
2369
|
+
* across their entire multi-chain wallet set. For a single account on one
|
|
2370
|
+
* chain, use {@link getTokenBalances}; for native-only balance, use
|
|
2371
|
+
* {@link getNativeBalance}.
|
|
2362
2372
|
*
|
|
2363
2373
|
* @param params.balanceRequest - The balance request configuration specifying which chains, networks and addresses to query.
|
|
2364
2374
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2365
2375
|
* @returns A promise that resolves to the chain balances across multiple networks.
|
|
2366
2376
|
* @not-instrumented
|
|
2367
2377
|
*/
|
|
2368
|
-
const
|
|
2378
|
+
const getMultichainTokenBalances = async ({ balanceRequest }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2369
2379
|
const core = require_InvalidParamError.getCore(client);
|
|
2370
2380
|
return (await require_InvalidParamError.createApiClient({}, client).postMultichainAccountBalances({
|
|
2371
2381
|
environmentId: core.environmentId,
|
|
@@ -2377,7 +2387,7 @@ const getMultichainBalances = async ({ balanceRequest }, client = require_Invali
|
|
|
2377
2387
|
//#region src/modules/checkout/utils/createCheckoutSessionTokenStorageKey/createCheckoutSessionTokenStorageKey.ts
|
|
2378
2388
|
/** @not-instrumented */
|
|
2379
2389
|
const createCheckoutSessionTokenStorageKey = (transactionId) => {
|
|
2380
|
-
return
|
|
2390
|
+
return require_InvalidParamError.createStorageKeySchema({
|
|
2381
2391
|
key: `checkoutSessionToken:${transactionId}`,
|
|
2382
2392
|
schema: zod_mini.string()
|
|
2383
2393
|
});
|
|
@@ -2780,9 +2790,9 @@ const ensureCorrectActiveNetwork = async ({ requiredNetworkId, walletProvider },
|
|
|
2780
2790
|
* @returns The transaction hash.
|
|
2781
2791
|
* @instrumented
|
|
2782
2792
|
*/
|
|
2783
|
-
const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepChange }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2793
|
+
const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepChange, sponsorshipMode }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2784
2794
|
if (!SWAP_SUPPORTED_CHAINS.includes(walletAccount.chain)) throw new require_InvalidParamError.InvalidParamError(`Chain ${walletAccount.chain} is not supported for swap transactions`);
|
|
2785
|
-
const walletProvider =
|
|
2795
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
2786
2796
|
assertWalletProviderMethodDefined(walletProvider, "executeSwapTransaction");
|
|
2787
2797
|
await ensureCorrectActiveNetwork({
|
|
2788
2798
|
requiredNetworkId: signingPayload.chainId,
|
|
@@ -2791,6 +2801,7 @@ const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepCha
|
|
|
2791
2801
|
const { transactionHash } = await walletProvider.executeSwapTransaction({
|
|
2792
2802
|
onStepChange,
|
|
2793
2803
|
signingPayload,
|
|
2804
|
+
sponsorshipMode,
|
|
2794
2805
|
walletAccount
|
|
2795
2806
|
});
|
|
2796
2807
|
return { transactionHash };
|
|
@@ -2910,7 +2921,7 @@ const completeDeviceRegistration = async ({ deviceToken }, client = require_Inva
|
|
|
2910
2921
|
const core = require_InvalidParamError.getCore(client);
|
|
2911
2922
|
const response = await require_InvalidParamError.createApiClient({ headers: { [DEVICE_REGISTRATION_TOKEN_HEADER]: deviceToken } }, client).deviceRegistration({ environmentId: core.environmentId });
|
|
2912
2923
|
require_getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({ response }, client);
|
|
2913
|
-
|
|
2924
|
+
require_InvalidParamError.emitEvent({ event: "deviceRegistrationCompleted" }, client);
|
|
2914
2925
|
return response;
|
|
2915
2926
|
};
|
|
2916
2927
|
const __completeDeviceRegistration_impl = completeDeviceRegistration;
|
|
@@ -2975,7 +2986,7 @@ const detectDeviceRegistrationRedirect = ({ url }) => {
|
|
|
2975
2986
|
/** @not-instrumented */
|
|
2976
2987
|
const getRegisteredDevices = async (client = require_InvalidParamError.getDefaultClient()) => {
|
|
2977
2988
|
const core = require_InvalidParamError.getCore(client);
|
|
2978
|
-
const apiClient = require_InvalidParamError.createApiClient({}, client);
|
|
2989
|
+
const apiClient = require_InvalidParamError.createApiClient({ skipSessionExpiryLogout: true }, client);
|
|
2979
2990
|
try {
|
|
2980
2991
|
return (await apiClient.listDeviceRegistrations({ environmentId: core.environmentId })).deviceRegistrations;
|
|
2981
2992
|
} catch (error) {
|
|
@@ -3008,7 +3019,7 @@ const isDeviceRegistrationRequired = (user) => Boolean(user.scope?.includes("dev
|
|
|
3008
3019
|
const revokeAllRegisteredDevices = async (client = require_InvalidParamError.getDefaultClient()) => {
|
|
3009
3020
|
const core = require_InvalidParamError.getCore(client);
|
|
3010
3021
|
await require_InvalidParamError.createApiClient({}, client).deleteAllDeviceRegistrations({ environmentId: core.environmentId });
|
|
3011
|
-
await
|
|
3022
|
+
await require_InvalidParamError.__logoutWithReason_wrapped({ reason: "all-devices-revoked" }, client);
|
|
3012
3023
|
};
|
|
3013
3024
|
const __revokeAllRegisteredDevices_impl = revokeAllRegisteredDevices;
|
|
3014
3025
|
const __revokeAllRegisteredDevices_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -3032,7 +3043,7 @@ const revokeRegisteredDevice = async ({ deviceRegistrationId }, client = require
|
|
|
3032
3043
|
if ((await require_InvalidParamError.createApiClient({}, client).deleteDeviceRegistration({
|
|
3033
3044
|
deviceRegistrationId,
|
|
3034
3045
|
environmentId: core.environmentId
|
|
3035
|
-
})).currentDeviceRevoked) await
|
|
3046
|
+
})).currentDeviceRevoked) await require_InvalidParamError.__logoutWithReason_wrapped({ reason: "device-revoked" }, client);
|
|
3036
3047
|
};
|
|
3037
3048
|
const __revokeRegisteredDevice_impl = revokeRegisteredDevice;
|
|
3038
3049
|
const __revokeRegisteredDevice_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -3254,6 +3265,115 @@ const __createCryptoDotComPayment_wrapped = require_InvalidParamError.instrument
|
|
|
3254
3265
|
}
|
|
3255
3266
|
});
|
|
3256
3267
|
|
|
3268
|
+
//#endregion
|
|
3269
|
+
//#region src/modules/funding/moonpay/getMoonPayCurrencies/getMoonPayCurrencies.ts
|
|
3270
|
+
/**
|
|
3271
|
+
* Fetches the list of crypto currencies supported by MoonPay for the given chain
|
|
3272
|
+
* and network, filtered to active currencies only. Requires a MoonPay publishable
|
|
3273
|
+
* API key to be configured for the environment.
|
|
3274
|
+
*
|
|
3275
|
+
* @param params - The chain and optional network ID to filter currencies by.
|
|
3276
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3277
|
+
* @returns An array of supported MoonPay currencies.
|
|
3278
|
+
* @instrumented
|
|
3279
|
+
*/
|
|
3280
|
+
const getMoonPayCurrencies = async (params, client = require_InvalidParamError.getDefaultClient()) => {
|
|
3281
|
+
const core = require_InvalidParamError.getCore(client);
|
|
3282
|
+
return (await require_InvalidParamError.createApiClient({ includeMfaToken: true }, client).getMoonPayCurrencies({
|
|
3283
|
+
chain: params.chain,
|
|
3284
|
+
environmentId: core.environmentId,
|
|
3285
|
+
...params.networkId ? { networkId: params.networkId } : {}
|
|
3286
|
+
})).currencies ?? [];
|
|
3287
|
+
};
|
|
3288
|
+
const __getMoonPayCurrencies_impl = getMoonPayCurrencies;
|
|
3289
|
+
const __getMoonPayCurrencies_wrapped = require_InvalidParamError.instrumentFunction({
|
|
3290
|
+
fn: __getMoonPayCurrencies_impl,
|
|
3291
|
+
functionName: "getMoonPayCurrencies",
|
|
3292
|
+
getCore: () => {
|
|
3293
|
+
try {
|
|
3294
|
+
return require_InvalidParamError.getCore(require_InvalidParamError.getDefaultClient());
|
|
3295
|
+
} catch {
|
|
3296
|
+
return;
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
});
|
|
3300
|
+
|
|
3301
|
+
//#endregion
|
|
3302
|
+
//#region src/modules/funding/moonpay/errors/MoonPayInvalidUrlError.ts
|
|
3303
|
+
var MoonPayInvalidUrlError = class extends require_InvalidParamError.BaseError {
|
|
3304
|
+
constructor() {
|
|
3305
|
+
super({
|
|
3306
|
+
cause: null,
|
|
3307
|
+
code: "moonpay_invalid_url_error",
|
|
3308
|
+
docsUrl: null,
|
|
3309
|
+
name: "MoonPayInvalidUrlError",
|
|
3310
|
+
shortMessage: "MoonPay is configured but returned an invalid or untrusted URL. This may indicate a misconfiguration — please contact support if the issue persists."
|
|
3311
|
+
});
|
|
3312
|
+
}
|
|
3313
|
+
};
|
|
3314
|
+
|
|
3315
|
+
//#endregion
|
|
3316
|
+
//#region src/modules/funding/moonpay/errors/MoonPayProviderNotAvailableError.ts
|
|
3317
|
+
var MoonPayProviderNotAvailableError = class extends require_InvalidParamError.BaseError {
|
|
3318
|
+
constructor() {
|
|
3319
|
+
super({
|
|
3320
|
+
cause: null,
|
|
3321
|
+
code: "moonpay_provider_not_available_error",
|
|
3322
|
+
docsUrl: null,
|
|
3323
|
+
name: "MoonPayProviderNotAvailableError",
|
|
3324
|
+
shortMessage: "MoonPay provider not available. Ensure MoonPay is enabled and a publishable API key is configured in the Dynamic dashboard."
|
|
3325
|
+
});
|
|
3326
|
+
}
|
|
3327
|
+
};
|
|
3328
|
+
|
|
3329
|
+
//#endregion
|
|
3330
|
+
//#region src/modules/funding/moonpay/getMoonPayUrl/getMoonPayUrl.ts
|
|
3331
|
+
/**
|
|
3332
|
+
* Returns the signed MoonPay URL for the given wallet and token.
|
|
3333
|
+
*
|
|
3334
|
+
* Uses the Dynamic onramp API to retrieve the pre-signed URL that can be
|
|
3335
|
+
* opened in a browser tab to allow the user to purchase crypto via MoonPay.
|
|
3336
|
+
*
|
|
3337
|
+
* @param params - Parameters including chain, wallet address, and optional token/currency filters.
|
|
3338
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3339
|
+
* @returns The signed MoonPay URL.
|
|
3340
|
+
* @instrumented
|
|
3341
|
+
*/
|
|
3342
|
+
const getMoonPayUrl = async (params, client = require_InvalidParamError.getDefaultClient()) => {
|
|
3343
|
+
const core = require_InvalidParamError.getCore(client);
|
|
3344
|
+
const moonPayProvider = (await require_InvalidParamError.createApiClient({ includeMfaToken: true }, client).getSupportedOnramps({
|
|
3345
|
+
chain: params.chain,
|
|
3346
|
+
currency: params.currency,
|
|
3347
|
+
environmentId: core.environmentId,
|
|
3348
|
+
includeDisabled: true,
|
|
3349
|
+
merchantName: params.merchantName,
|
|
3350
|
+
networkId: params.networkId,
|
|
3351
|
+
token: params.token,
|
|
3352
|
+
tokenAmount: params.tokenAmount,
|
|
3353
|
+
walletAddress: params.walletAddress
|
|
3354
|
+
})).onramps?.find((provider) => provider.provider === _dynamic_labs_sdk_api_core.ProviderEnum.MoonPay);
|
|
3355
|
+
if (!moonPayProvider?.url) throw new MoonPayProviderNotAvailableError();
|
|
3356
|
+
const parsedUrl = new URL(moonPayProvider.url);
|
|
3357
|
+
const isValidHost = parsedUrl.hostname === "moonpay.com" || parsedUrl.hostname.endsWith(".moonpay.com");
|
|
3358
|
+
if (parsedUrl.protocol !== "https:" || !isValidHost) {
|
|
3359
|
+
core.logger.error("[getMoonPayUrl] Invalid URL returned by onramp API", { url: moonPayProvider.url });
|
|
3360
|
+
throw new MoonPayInvalidUrlError();
|
|
3361
|
+
}
|
|
3362
|
+
return moonPayProvider.url;
|
|
3363
|
+
};
|
|
3364
|
+
const __getMoonPayUrl_impl = getMoonPayUrl;
|
|
3365
|
+
const __getMoonPayUrl_wrapped = require_InvalidParamError.instrumentFunction({
|
|
3366
|
+
fn: __getMoonPayUrl_impl,
|
|
3367
|
+
functionName: "getMoonPayUrl",
|
|
3368
|
+
getCore: () => {
|
|
3369
|
+
try {
|
|
3370
|
+
return require_InvalidParamError.getCore(require_InvalidParamError.getDefaultClient());
|
|
3371
|
+
} catch {
|
|
3372
|
+
return;
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
});
|
|
3376
|
+
|
|
3257
3377
|
//#endregion
|
|
3258
3378
|
//#region src/modules/funding/kraken/createKrakenExchangeTransfer/createKrakenExchangeTransfer.ts
|
|
3259
3379
|
/**
|
|
@@ -3422,7 +3542,7 @@ const fetchWithTimeout = async (client) => {
|
|
|
3422
3542
|
/**
|
|
3423
3543
|
* The schema to store the cached wallet book data.
|
|
3424
3544
|
*/
|
|
3425
|
-
const walletBookCacheStorageKeySchema =
|
|
3545
|
+
const walletBookCacheStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
3426
3546
|
key: "legacyWalletBookCache",
|
|
3427
3547
|
schema: zod_mini.object({
|
|
3428
3548
|
groups: zod_mini.record(zod_mini.string(), zod_mini.any()),
|
|
@@ -3457,7 +3577,7 @@ const fetchLegacyWalletBook = async (client) => {
|
|
|
3457
3577
|
const core = require_InvalidParamError.getCore(client);
|
|
3458
3578
|
core.logger.debug("[fetchLegacyWalletBook] Fetching wallet book...");
|
|
3459
3579
|
try {
|
|
3460
|
-
const walletBook = await
|
|
3580
|
+
const walletBook = await require_InvalidParamError.retryOnFail({
|
|
3461
3581
|
delay: RETRY_DELAY_MS,
|
|
3462
3582
|
fn: async () => fetchWithTimeout(client),
|
|
3463
3583
|
maxRetries: MAX_RETRIES
|
|
@@ -3571,30 +3691,39 @@ const transformGroup = ({ group }) => {
|
|
|
3571
3691
|
};
|
|
3572
3692
|
|
|
3573
3693
|
//#endregion
|
|
3574
|
-
//#region src/
|
|
3694
|
+
//#region src/utils/getChainFromWalletBookIdentifier/getChainFromWalletBookIdentifier.ts
|
|
3575
3695
|
/**
|
|
3576
|
-
*
|
|
3696
|
+
* Resolves a wallet-book chain identifier (as found in
|
|
3697
|
+
* `injectedConfig[].chain` or as an alias embedded in a wallet key) to a
|
|
3698
|
+
* {@link Chain}. Looks up by `apiChainName` first, then by any
|
|
3699
|
+
* `legacyWalletBookAliases` declared on the corresponding `CHAINS_INFO_MAP`
|
|
3700
|
+
* entry.
|
|
3701
|
+
*
|
|
3702
|
+
* Returns `undefined` when the identifier doesn't match any known chain,
|
|
3703
|
+
* letting the caller pick its own fallback (e.g. defaulting to EVM, or
|
|
3704
|
+
* trying a different lookup strategy).
|
|
3705
|
+
*
|
|
3706
|
+
* Centralised here rather than in `legacyWalletBook` so all chain naming
|
|
3707
|
+
* knowledge stays alongside `CHAINS_INFO_MAP`.
|
|
3577
3708
|
* @not-instrumented
|
|
3578
3709
|
*/
|
|
3579
|
-
const
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
eclipse: "ECLIPSE",
|
|
3586
|
-
evm: "EVM",
|
|
3587
|
-
flow: "FLOW",
|
|
3588
|
-
sol: "SOL",
|
|
3589
|
-
spark: "SPARK",
|
|
3590
|
-
starknet: "STARK",
|
|
3591
|
-
sui: "SUI",
|
|
3592
|
-
ton: "TON",
|
|
3593
|
-
tron: "TRON"
|
|
3710
|
+
const getChainFromWalletBookIdentifier = ({ identifier }) => {
|
|
3711
|
+
const normalised = identifier.toLowerCase();
|
|
3712
|
+
return Object.keys(require_InvalidParamError.CHAINS_INFO_MAP).find((chain) => {
|
|
3713
|
+
const info = require_InvalidParamError.CHAINS_INFO_MAP[chain];
|
|
3714
|
+
return info.apiChainName === normalised || info.legacyWalletBookAliases?.includes(normalised) === true;
|
|
3715
|
+
});
|
|
3594
3716
|
};
|
|
3717
|
+
|
|
3718
|
+
//#endregion
|
|
3719
|
+
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainFromWalletSchema/getChainFromWalletSchema.ts
|
|
3595
3720
|
/**
|
|
3596
3721
|
* Extracts the chain prefix from a chain identifier string.
|
|
3597
3722
|
* For example, "eip155:1" -> "eip155", "solana:..." -> "solana"
|
|
3723
|
+
*
|
|
3724
|
+
* Exported so {@link getChainsFromWalletSchema} can apply the same
|
|
3725
|
+
* parsing to its multi-chain pass without duplicating the logic.
|
|
3726
|
+
* @not-instrumented
|
|
3598
3727
|
*/
|
|
3599
3728
|
const extractChainPrefix = ({ chainIdentifier }) => {
|
|
3600
3729
|
const colonIndex = chainIdentifier.indexOf(":");
|
|
@@ -3602,80 +3731,22 @@ const extractChainPrefix = ({ chainIdentifier }) => {
|
|
|
3602
3731
|
return chainIdentifier.substring(0, colonIndex);
|
|
3603
3732
|
};
|
|
3604
3733
|
/**
|
|
3605
|
-
*
|
|
3606
|
-
*
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
chain: "SOL",
|
|
3611
|
-
pattern: "sol"
|
|
3612
|
-
},
|
|
3613
|
-
{
|
|
3614
|
-
chain: "SOL",
|
|
3615
|
-
pattern: "solana"
|
|
3616
|
-
},
|
|
3617
|
-
{
|
|
3618
|
-
chain: "BTC",
|
|
3619
|
-
pattern: "btc"
|
|
3620
|
-
},
|
|
3621
|
-
{
|
|
3622
|
-
chain: "BTC",
|
|
3623
|
-
pattern: "bitcoin"
|
|
3624
|
-
},
|
|
3625
|
-
{
|
|
3626
|
-
chain: "STARK",
|
|
3627
|
-
pattern: "stark"
|
|
3628
|
-
},
|
|
3629
|
-
{
|
|
3630
|
-
chain: "STARK",
|
|
3631
|
-
pattern: "starknet"
|
|
3632
|
-
},
|
|
3633
|
-
{
|
|
3634
|
-
chain: "SUI",
|
|
3635
|
-
pattern: "sui"
|
|
3636
|
-
},
|
|
3637
|
-
{
|
|
3638
|
-
chain: "APTOS",
|
|
3639
|
-
pattern: "aptos"
|
|
3640
|
-
},
|
|
3641
|
-
{
|
|
3642
|
-
chain: "COSMOS",
|
|
3643
|
-
pattern: "cosmos"
|
|
3644
|
-
},
|
|
3645
|
-
{
|
|
3646
|
-
chain: "FLOW",
|
|
3647
|
-
pattern: "flow"
|
|
3648
|
-
},
|
|
3649
|
-
{
|
|
3650
|
-
chain: "ALGO",
|
|
3651
|
-
pattern: "algo"
|
|
3652
|
-
},
|
|
3653
|
-
{
|
|
3654
|
-
chain: "TRON",
|
|
3655
|
-
pattern: "tron"
|
|
3656
|
-
},
|
|
3657
|
-
{
|
|
3658
|
-
chain: "TON",
|
|
3659
|
-
pattern: "ton"
|
|
3660
|
-
},
|
|
3661
|
-
{
|
|
3662
|
-
chain: "SPARK",
|
|
3663
|
-
pattern: "spark"
|
|
3664
|
-
},
|
|
3665
|
-
{
|
|
3666
|
-
chain: "ECLIPSE",
|
|
3667
|
-
pattern: "eclipse"
|
|
3668
|
-
}
|
|
3669
|
-
];
|
|
3670
|
-
/**
|
|
3671
|
-
* Attempts to extract the chain from a wallet key by looking for embedded chain identifiers.
|
|
3734
|
+
* Attempts to extract the chain from a wallet key by looking for embedded
|
|
3735
|
+
* chain identifiers (apiChainName + legacyWalletBookAliases from CHAINS_INFO_MAP).
|
|
3736
|
+
*
|
|
3737
|
+
* Derives patterns dynamically so adding a chain in `CHAINS_INFO_MAP`
|
|
3738
|
+
* picks it up here — no parallel hardcoded list.
|
|
3672
3739
|
*
|
|
3673
3740
|
* @param params.walletKey - The wallet key identifier.
|
|
3674
3741
|
* @returns The chain type if found, undefined otherwise.
|
|
3675
3742
|
*/
|
|
3676
3743
|
const getChainFromWalletKey = ({ walletKey }) => {
|
|
3677
3744
|
const lowerKey = walletKey.toLowerCase();
|
|
3678
|
-
|
|
3745
|
+
const chains = Object.keys(require_InvalidParamError.CHAINS_INFO_MAP);
|
|
3746
|
+
for (const chain of chains) {
|
|
3747
|
+
const info = require_InvalidParamError.CHAINS_INFO_MAP[chain];
|
|
3748
|
+
if ([info.apiChainName, ...info.legacyWalletBookAliases ?? []].some((pattern) => lowerKey.includes(pattern))) return chain;
|
|
3749
|
+
}
|
|
3679
3750
|
};
|
|
3680
3751
|
/**
|
|
3681
3752
|
* Gets the chain from a wallet book entry.
|
|
@@ -3689,8 +3760,11 @@ const getChainFromWalletKey = ({ walletKey }) => {
|
|
|
3689
3760
|
*/
|
|
3690
3761
|
const getChainFromWalletSchema = ({ wallet, walletKey }) => {
|
|
3691
3762
|
if (wallet.injectedConfig && wallet.injectedConfig.length > 0) {
|
|
3692
|
-
const injectedChain = wallet.injectedConfig[0].chain
|
|
3693
|
-
if (injectedChain
|
|
3763
|
+
const injectedChain = wallet.injectedConfig[0].chain;
|
|
3764
|
+
if (injectedChain) {
|
|
3765
|
+
const chain = getChainFromWalletBookIdentifier({ identifier: injectedChain });
|
|
3766
|
+
if (chain) return chain;
|
|
3767
|
+
}
|
|
3694
3768
|
}
|
|
3695
3769
|
if (wallet.chains && wallet.chains.length > 0) {
|
|
3696
3770
|
const firstChain = wallet.chains[0];
|
|
@@ -3923,7 +3997,7 @@ const extractChainFromNormalizedName = ({ normalizedWalletNameWithChain }) => {
|
|
|
3923
3997
|
* @not-instrumented
|
|
3924
3998
|
*/
|
|
3925
3999
|
const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProviderKey }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
3926
|
-
const { normalizedWalletNameWithChain } =
|
|
4000
|
+
const { normalizedWalletNameWithChain } = require_InvalidParamError.splitWalletProviderKey(walletProviderKey);
|
|
3927
4001
|
const chain = extractChainFromNormalizedName({ normalizedWalletNameWithChain });
|
|
3928
4002
|
if (!chain) return;
|
|
3929
4003
|
let walletProviderName = normalizedWalletNameWithChain.toLowerCase();
|
|
@@ -3938,6 +4012,106 @@ const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProvider
|
|
|
3938
4012
|
}
|
|
3939
4013
|
};
|
|
3940
4014
|
|
|
4015
|
+
//#endregion
|
|
4016
|
+
//#region src/utils/isMobile/isMobile.ts
|
|
4017
|
+
/**
|
|
4018
|
+
* Sourced from http://detectmobilebrowsers.com/
|
|
4019
|
+
* @not-instrumented
|
|
4020
|
+
*/
|
|
4021
|
+
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|ios|ipad|playbook|silk/i;
|
|
4022
|
+
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;
|
|
4023
|
+
/** @not-instrumented */
|
|
4024
|
+
const isMobile = (maxTouchPointsOverride) => {
|
|
4025
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4026
|
+
return userAgentRegex1.test(navigator.userAgent) || userAgentRegex2.test(navigator.userAgent.substring(0, 4)) || isIPad(maxTouchPointsOverride) || isIPhone();
|
|
4027
|
+
};
|
|
4028
|
+
/** @not-instrumented */
|
|
4029
|
+
const isIPhone = () => typeof window === "undefined" || typeof navigator === "undefined" ? false : /iPhone|ios/.test(navigator.userAgent);
|
|
4030
|
+
/**
|
|
4031
|
+
* @param [optional] maxTouchPointsOverride - this is used for testing since
|
|
4032
|
+
* it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
|
|
4033
|
+
* to mock it
|
|
4034
|
+
* @not-instrumented
|
|
4035
|
+
*/
|
|
4036
|
+
const isIPad = (maxTouchPointsOverride) => {
|
|
4037
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4038
|
+
const maxTouchPoints = maxTouchPointsOverride || navigator.maxTouchPoints;
|
|
4039
|
+
return /iPad/.test(navigator.userAgent) || /Mac/.test(navigator.userAgent) && maxTouchPoints === 5;
|
|
4040
|
+
};
|
|
4041
|
+
/** @not-instrumented */
|
|
4042
|
+
const isIOS = (maxTouchPointsOverride) => {
|
|
4043
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4044
|
+
return isIPhone() || isIPad(maxTouchPointsOverride);
|
|
4045
|
+
};
|
|
4046
|
+
/** @not-instrumented */
|
|
4047
|
+
const isAndroid = () => isMobile() && !isIOS();
|
|
4048
|
+
/** @not-instrumented */
|
|
4049
|
+
const isSafariBrowser = () => {
|
|
4050
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4051
|
+
const { userAgent } = navigator;
|
|
4052
|
+
return userAgent.includes("Safari") && !userAgent.includes("Chrome") && !userAgent.includes("Chromium");
|
|
4053
|
+
};
|
|
4054
|
+
/** @not-instrumented */
|
|
4055
|
+
const isEdgeBrowser = () => {
|
|
4056
|
+
if (globalThis.window === void 0 || globalThis.navigator === void 0) return false;
|
|
4057
|
+
return /\bEdg\//.test(navigator.userAgent);
|
|
4058
|
+
};
|
|
4059
|
+
/** @not-instrumented */
|
|
4060
|
+
const isOperaBrowser = () => {
|
|
4061
|
+
if (globalThis.window === void 0 || globalThis.navigator === void 0) return false;
|
|
4062
|
+
return /\b(OPR|Opera)\//.test(navigator.userAgent);
|
|
4063
|
+
};
|
|
4064
|
+
/** @not-instrumented */
|
|
4065
|
+
const isFirefoxBrowser = () => {
|
|
4066
|
+
if (globalThis.window === void 0 || globalThis.navigator === void 0) return false;
|
|
4067
|
+
return /\bFirefox\//.test(navigator.userAgent);
|
|
4068
|
+
};
|
|
4069
|
+
/** @not-instrumented */
|
|
4070
|
+
const isChromeBrowser = () => {
|
|
4071
|
+
if (globalThis.window === void 0 || globalThis.navigator === void 0) return false;
|
|
4072
|
+
return /\bChrome\//.test(navigator.userAgent) && !isEdgeBrowser() && !isOperaBrowser();
|
|
4073
|
+
};
|
|
4074
|
+
|
|
4075
|
+
//#endregion
|
|
4076
|
+
//#region src/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/getInstallationLinkForCurrentPlatform.ts
|
|
4077
|
+
/**
|
|
4078
|
+
* Resolves the {@link InstallationUrls} field that matches the platform
|
|
4079
|
+
* the SDK is currently running on:
|
|
4080
|
+
*
|
|
4081
|
+
* - iOS → `ios`
|
|
4082
|
+
* - Android → `android`
|
|
4083
|
+
* - Edge → `edge`
|
|
4084
|
+
* - Opera → `opera`
|
|
4085
|
+
* - Firefox → `firefox`
|
|
4086
|
+
* - Safari → `safari`
|
|
4087
|
+
* - Chrome (or other Chromium-based browsers) → `chrome`
|
|
4088
|
+
*
|
|
4089
|
+
* Returns `undefined` when no entry exists for the detected platform —
|
|
4090
|
+
* callers typically render a "not available on this device" affordance
|
|
4091
|
+
* in that case rather than offering a download targeted at a different
|
|
4092
|
+
* browser/OS.
|
|
4093
|
+
*
|
|
4094
|
+
* Each branch returns exactly the field for the detected platform — no
|
|
4095
|
+
* fallback to a different browser's URL. If you'd rather surface every
|
|
4096
|
+
* link a wallet's manifest publishes so the user can pick where to
|
|
4097
|
+
* install, read `installationUrls` directly instead of going through
|
|
4098
|
+
* this helper.
|
|
4099
|
+
*
|
|
4100
|
+
* @param params.installationUrls - The wallet option's `installationUrls`
|
|
4101
|
+
* record (from `getWalletOptionsCatalogue`).
|
|
4102
|
+
* @returns The install URL for the detected platform, or `undefined`.
|
|
4103
|
+
* @not-instrumented
|
|
4104
|
+
*/
|
|
4105
|
+
const getInstallationLinkForCurrentPlatform = ({ installationUrls }) => {
|
|
4106
|
+
if (isIOS()) return installationUrls.ios;
|
|
4107
|
+
if (isAndroid()) return installationUrls.android;
|
|
4108
|
+
if (isEdgeBrowser()) return installationUrls.edge;
|
|
4109
|
+
if (isOperaBrowser()) return installationUrls.opera;
|
|
4110
|
+
if (isFirefoxBrowser()) return installationUrls.firefox;
|
|
4111
|
+
if (isSafariBrowser()) return installationUrls.safari;
|
|
4112
|
+
if (isChromeBrowser()) return installationUrls.chrome;
|
|
4113
|
+
};
|
|
4114
|
+
|
|
3941
4115
|
//#endregion
|
|
3942
4116
|
//#region src/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.ts
|
|
3943
4117
|
/**
|
|
@@ -4097,50 +4271,156 @@ const buildInstallationUrlsByWalletOptionKey = ({ walletBook }) => {
|
|
|
4097
4271
|
};
|
|
4098
4272
|
|
|
4099
4273
|
//#endregion
|
|
4100
|
-
//#region src/modules/
|
|
4274
|
+
//#region src/modules/legacyWalletBook/hasUsableDeeplink/hasUsableDeeplink.ts
|
|
4101
4275
|
/**
|
|
4102
|
-
*
|
|
4103
|
-
*
|
|
4104
|
-
*
|
|
4105
|
-
*
|
|
4106
|
-
*
|
|
4276
|
+
* Whether a wallet book entry exposes at least one mobile deeplink the
|
|
4277
|
+
* catalogue can drive — either a native scheme (`metamask://`) or a
|
|
4278
|
+
* universal link (`https://metamask.app.link`). Used by the URI-deeplink
|
|
4279
|
+
* builders (`buildWalletConnectOptions`, `buildMetaMaskSdkUriOptions`)
|
|
4280
|
+
* to skip wallets that have no app to launch.
|
|
4107
4281
|
*
|
|
4108
|
-
* @param params.
|
|
4109
|
-
* @returns
|
|
4282
|
+
* @param params.wallet - The wallet schema from the wallet book.
|
|
4283
|
+
* @returns True when the wallet has a native or universal mobile link.
|
|
4110
4284
|
* @not-instrumented
|
|
4111
4285
|
*/
|
|
4112
|
-
const
|
|
4286
|
+
const hasUsableDeeplink = ({ wallet }) => Boolean(wallet.mobile?.native || wallet.mobile?.universal);
|
|
4113
4287
|
|
|
4114
4288
|
//#endregion
|
|
4115
|
-
//#region src/modules/walletOptionsCatalogue/
|
|
4289
|
+
//#region src/modules/walletOptionsCatalogue/buildMetaMaskSdkUriOptions/buildMetaMaskSdkUriOptions.ts
|
|
4116
4290
|
/**
|
|
4117
|
-
*
|
|
4118
|
-
* least one mobile deeplink — that's the value-add the option provides
|
|
4119
|
-
* over the bare pairing URI. Wallets that exist in the wallet book but
|
|
4120
|
-
* don't expose a deeplink (rare, but present) are silently skipped.
|
|
4291
|
+
* Wallet option key the MetaMask SDK URI extension targets.
|
|
4121
4292
|
*/
|
|
4122
|
-
const
|
|
4293
|
+
const METAMASK_WALLET_OPTION_KEY = "metamask";
|
|
4123
4294
|
/**
|
|
4124
|
-
*
|
|
4125
|
-
*
|
|
4295
|
+
* Chains the MetaMask SDK URI pairing supports.
|
|
4296
|
+
*
|
|
4297
|
+
* Unlike WalletConnect — whose per-wallet chain support is read from the
|
|
4298
|
+
* wallet book — the MetaMask SDK URI is a single Dynamic integration whose
|
|
4299
|
+
* chain coverage is defined by which `connectWithMetaMaskUri<Chain>`
|
|
4300
|
+
* primitives the SDK ships (EVM + SOL). The MetaMask wallet-book entry only
|
|
4301
|
+
* advertises its EVM (`eip155`) chains, so deriving the chain from the book
|
|
4302
|
+
* would never surface the Solana pairing; the SDK's own capabilities are
|
|
4303
|
+
* listed explicitly instead.
|
|
4304
|
+
*/
|
|
4305
|
+
const METAMASK_SDK_URI_SUPPORTED_CHAINS = ["EVM", "SOL"];
|
|
4306
|
+
/**
|
|
4307
|
+
* Builds the `metamaskSdkUri`-discriminator catalogue options from a
|
|
4308
|
+
* fetched wallet book. The MetaMask SDK URI extension only targets the
|
|
4309
|
+
* MetaMask wallet, so the builder iterates the book looking for the
|
|
4310
|
+
* entry whose resolved wallet option key is `'metamask'`.
|
|
4311
|
+
*
|
|
4312
|
+
* Applies the generic `shouldFilterWallet` rules (drops embedded keys +
|
|
4313
|
+
* injected-only-without-links entries). Crucially does NOT require WC
|
|
4314
|
+
* `sign_v2` support — MetaMask SDK URI is a different protocol from
|
|
4315
|
+
* WalletConnect, so the WC-specific filter does not apply here.
|
|
4316
|
+
*
|
|
4317
|
+
* Emits one `metamaskSdkUri` option per chain the MetaMask SDK URI pairing
|
|
4318
|
+
* supports (see {@link METAMASK_SDK_URI_SUPPORTED_CHAINS}) so the picker can
|
|
4319
|
+
* offer both the EVM and Solana pairings for the single MetaMask entry.
|
|
4320
|
+
*
|
|
4321
|
+
* @param params.walletBook - The fetched wallet book.
|
|
4322
|
+
* @returns Tagged `metamaskSdkUri` options for MetaMask if eligible, otherwise an empty array.
|
|
4323
|
+
* @not-instrumented
|
|
4324
|
+
*/
|
|
4325
|
+
const buildMetaMaskSdkUriOptions = ({ walletBook }) => {
|
|
4326
|
+
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
4327
|
+
const walletOptionKey = resolveWalletBookWalletOptionKey({
|
|
4328
|
+
wallet,
|
|
4329
|
+
walletKey
|
|
4330
|
+
});
|
|
4331
|
+
if (walletOptionKey !== METAMASK_WALLET_OPTION_KEY) continue;
|
|
4332
|
+
if (shouldFilterWallet({
|
|
4333
|
+
wallet,
|
|
4334
|
+
walletKey
|
|
4335
|
+
})) continue;
|
|
4336
|
+
if (!hasUsableDeeplink({ wallet })) continue;
|
|
4337
|
+
const deeplinks = {
|
|
4338
|
+
native: wallet.mobile?.native,
|
|
4339
|
+
universal: wallet.mobile?.universal
|
|
4340
|
+
};
|
|
4341
|
+
return METAMASK_SDK_URI_SUPPORTED_CHAINS.map((chain) => ({
|
|
4342
|
+
option: {
|
|
4343
|
+
chain,
|
|
4344
|
+
deeplinks,
|
|
4345
|
+
type: "metamaskSdkUri"
|
|
4346
|
+
},
|
|
4347
|
+
walletOptionKey
|
|
4348
|
+
}));
|
|
4349
|
+
}
|
|
4350
|
+
return [];
|
|
4351
|
+
};
|
|
4352
|
+
|
|
4353
|
+
//#endregion
|
|
4354
|
+
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
4355
|
+
/**
|
|
4356
|
+
* Returns every chain a wallet book entry advertises support for —
|
|
4357
|
+
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
4358
|
+
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
4359
|
+
* supports EVM + SOL) gets one option per chain rather than one option
|
|
4360
|
+
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
4361
|
+
*
|
|
4362
|
+
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
4363
|
+
* (`['EVM']` default) when neither field is populated, so the helper
|
|
4364
|
+
* never returns an empty array — every eligible wallet emits at least
|
|
4365
|
+
* one option.
|
|
4366
|
+
*
|
|
4367
|
+
* @param params.wallet - The wallet schema from the wallet book.
|
|
4368
|
+
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
4369
|
+
* @returns Ordered, deduped array of Chains.
|
|
4370
|
+
* @not-instrumented
|
|
4371
|
+
*/
|
|
4372
|
+
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
4373
|
+
const chains = /* @__PURE__ */ new Set();
|
|
4374
|
+
for (const entry of wallet.injectedConfig ?? []) {
|
|
4375
|
+
if (!entry.chain) continue;
|
|
4376
|
+
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
4377
|
+
if (chain) chains.add(chain);
|
|
4378
|
+
}
|
|
4379
|
+
for (const identifier of wallet.chains ?? []) {
|
|
4380
|
+
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
4381
|
+
try {
|
|
4382
|
+
const chain = require_InvalidParamError.getChainFromVerifiedCredentialChain(prefix);
|
|
4383
|
+
chains.add(chain);
|
|
4384
|
+
} catch {}
|
|
4385
|
+
}
|
|
4386
|
+
if (chains.size === 0) {
|
|
4387
|
+
const chain = getChainFromWalletSchema({
|
|
4388
|
+
wallet,
|
|
4389
|
+
walletKey
|
|
4390
|
+
});
|
|
4391
|
+
chains.add(chain);
|
|
4392
|
+
}
|
|
4393
|
+
return Array.from(chains);
|
|
4394
|
+
};
|
|
4395
|
+
|
|
4396
|
+
//#endregion
|
|
4397
|
+
//#region src/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.ts
|
|
4398
|
+
/**
|
|
4399
|
+
* Chains Dynamic ships a WalletConnect extension for. Anything else a
|
|
4400
|
+
* wallet book entry advertises (Cosmos, BTC, …) gets filtered out — the
|
|
4401
|
+
* catalogue should not surface a chain the SDK has no `connectWithWalletConnect<Chain>`
|
|
4402
|
+
* primitive for.
|
|
4403
|
+
*/
|
|
4404
|
+
const WALLETCONNECT_SUPPORTED_CHAINS = new Set(["EVM", "SOL"]);
|
|
4405
|
+
/**
|
|
4406
|
+
* Builds the `walletConnect`-discriminator catalogue options from a fetched
|
|
4407
|
+
* wallet book. Applies the WalletConnect-specific eligibility filter
|
|
4126
4408
|
* (`shouldFilterWalletForWalletConnect`) so embedded wallets and entries
|
|
4127
4409
|
* without `sign_v2` support are excluded — same surface as
|
|
4128
4410
|
* `getWalletConnectCatalog`.
|
|
4129
4411
|
*
|
|
4130
|
-
*
|
|
4131
|
-
*
|
|
4132
|
-
*
|
|
4133
|
-
*
|
|
4134
|
-
*
|
|
4135
|
-
*
|
|
4136
|
-
* `connectWithMetaMaskUriSolana`. Emitted only for the MetaMask
|
|
4137
|
-
* wallet entry — see `resolveUriConnectionType`.
|
|
4412
|
+
* Skips the MetaMask wallet entry: MetaMask is steered to its own URI
|
|
4413
|
+
* connection extension via `buildMetaMaskSdkUriOptions`. Keeping the two
|
|
4414
|
+
* builders separate means each protocol owns its own eligibility rules
|
|
4415
|
+
* (WC needs `sign_v2`; MM SDK URI does not), so excluding one
|
|
4416
|
+
* discriminator via `excludedConnectionOptionTypes` doesn't accidentally
|
|
4417
|
+
* gate the other.
|
|
4138
4418
|
*
|
|
4139
4419
|
* @param params.walletBook - The fetched wallet book.
|
|
4140
|
-
* @returns Tagged options paired with their wallet option keys.
|
|
4420
|
+
* @returns Tagged `walletConnect` options paired with their wallet option keys.
|
|
4141
4421
|
* @not-instrumented
|
|
4142
4422
|
*/
|
|
4143
|
-
const
|
|
4423
|
+
const buildWalletConnectOptions = ({ walletBook }) => {
|
|
4144
4424
|
const result = [];
|
|
4145
4425
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
4146
4426
|
if (shouldFilterWalletForWalletConnect({
|
|
@@ -4152,18 +4432,19 @@ const buildUriDeeplinkOptions = ({ walletBook }) => {
|
|
|
4152
4432
|
wallet,
|
|
4153
4433
|
walletKey
|
|
4154
4434
|
});
|
|
4155
|
-
|
|
4435
|
+
if (walletOptionKey === "metamask") continue;
|
|
4436
|
+
const chains = getChainsFromWalletSchema({
|
|
4156
4437
|
wallet,
|
|
4157
4438
|
walletKey
|
|
4158
|
-
});
|
|
4159
|
-
result.push({
|
|
4439
|
+
}).filter((chain) => WALLETCONNECT_SUPPORTED_CHAINS.has(chain));
|
|
4440
|
+
for (const chain of chains) result.push({
|
|
4160
4441
|
option: {
|
|
4161
4442
|
chain,
|
|
4162
4443
|
deeplinks: {
|
|
4163
4444
|
native: wallet.mobile?.native,
|
|
4164
4445
|
universal: wallet.mobile?.universal
|
|
4165
4446
|
},
|
|
4166
|
-
type:
|
|
4447
|
+
type: "walletConnect"
|
|
4167
4448
|
},
|
|
4168
4449
|
walletOptionKey
|
|
4169
4450
|
});
|
|
@@ -4180,12 +4461,19 @@ const buildUriDeeplinkOptions = ({ walletBook }) => {
|
|
|
4180
4461
|
*
|
|
4181
4462
|
* Display merge rules (provider self-announced metadata wins where set):
|
|
4182
4463
|
*
|
|
4183
|
-
* - `name`: `displayOverride.name` ?? wallet book group name ??
|
|
4184
|
-
*
|
|
4185
|
-
* - `
|
|
4186
|
-
*
|
|
4464
|
+
* - `name`: `displayOverride.name` ?? wallet book group name ?? wallet
|
|
4465
|
+
* book wallet name ?? bare key.
|
|
4466
|
+
* - `iconUrl`: `displayOverride.iconUrl` ?? wallet book group sprite URL
|
|
4467
|
+
* ?? wallet book wallet sprite URL ?? `''`.
|
|
4468
|
+
* - `primaryColor`: wallet book group brand color ?? wallet book wallet
|
|
4469
|
+
* brand color (providers do not ship a primary color in their
|
|
4470
|
+
* announcement metadata).
|
|
4187
4471
|
* - `installationUrls`: copied through if present.
|
|
4188
4472
|
*
|
|
4473
|
+
* The per-wallet fallback handles wallets that exist as individual entries
|
|
4474
|
+
* in the book (e.g. Rainbow) rather than as members of a multi-wallet group
|
|
4475
|
+
* — those don't get a `walletBook.groups[…]` shell.
|
|
4476
|
+
*
|
|
4189
4477
|
* Why provider precedence: a registered wallet provider knows its own
|
|
4190
4478
|
* brand best (EIP-6963 / Wallet Standard / vendor SDK announcement is the
|
|
4191
4479
|
* wallet authoring its own identity). The wallet book fills in fields the
|
|
@@ -4203,16 +4491,42 @@ const buildWalletOption = ({ connectionOptions, displayOverride, installationUrl
|
|
|
4203
4491
|
const group = walletBook.groups[walletOptionKey];
|
|
4204
4492
|
const groupSpriteId = group?.brand?.spriteId;
|
|
4205
4493
|
const groupIconUrl = groupSpriteId ? getSpriteUrl({ spriteId: groupSpriteId }) : void 0;
|
|
4494
|
+
const walletEntry = walletBook.wallets[walletOptionKey];
|
|
4495
|
+
const walletSpriteId = walletEntry?.brand?.spriteId;
|
|
4496
|
+
const walletIconUrl = walletSpriteId ? getSpriteUrl({ spriteId: walletSpriteId }) : void 0;
|
|
4206
4497
|
return {
|
|
4207
4498
|
connectionOptions,
|
|
4208
|
-
iconUrl: displayOverride?.iconUrl ?? groupIconUrl ?? "",
|
|
4499
|
+
iconUrl: displayOverride?.iconUrl ?? groupIconUrl ?? walletIconUrl ?? "",
|
|
4209
4500
|
installationUrls,
|
|
4210
4501
|
key: walletOptionKey,
|
|
4211
|
-
name: displayOverride?.name ?? group?.name ?? walletOptionKey,
|
|
4212
|
-
primaryColor: group?.brand?.primaryColor
|
|
4502
|
+
name: displayOverride?.name ?? group?.name ?? walletEntry?.name ?? walletOptionKey,
|
|
4503
|
+
primaryColor: group?.brand?.primaryColor ?? walletEntry?.brand?.primaryColor
|
|
4213
4504
|
};
|
|
4214
4505
|
};
|
|
4215
4506
|
|
|
4507
|
+
//#endregion
|
|
4508
|
+
//#region src/modules/wallets/hasWalletProviderConnectMethod/hasWalletProviderConnectMethod.ts
|
|
4509
|
+
/**
|
|
4510
|
+
* Returns true when the given wallet provider exposes a `connect` method,
|
|
4511
|
+
* which is the signal we use to decide whether it belongs in the external
|
|
4512
|
+
* wallet picker as an `available provider`.
|
|
4513
|
+
*
|
|
4514
|
+
* Providers that don't expose `connect` (embedded wallets,
|
|
4515
|
+
* account-abstraction wrappers, MetaMask SDK / WalletConnect-backed
|
|
4516
|
+
* providers) are still sign-in capable, but via different SDK entry
|
|
4517
|
+
* points — they should not appear in the external picker as a
|
|
4518
|
+
* `withWalletProvider`-style option.
|
|
4519
|
+
*
|
|
4520
|
+
* Centralizing the predicate means future tweaks (e.g. a registry of
|
|
4521
|
+
* provider keys to exclude) land in one place and every consumer stays
|
|
4522
|
+
* in lockstep.
|
|
4523
|
+
*
|
|
4524
|
+
* @param params.walletProvider - The wallet provider to test.
|
|
4525
|
+
* @returns True when the provider exposes a `connect` method.
|
|
4526
|
+
* @not-instrumented
|
|
4527
|
+
*/
|
|
4528
|
+
const hasWalletProviderConnectMethod = ({ walletProvider }) => Boolean(walletProvider.connect);
|
|
4529
|
+
|
|
4216
4530
|
//#endregion
|
|
4217
4531
|
//#region src/modules/walletOptionsCatalogue/classifyWithWalletProviderSource/classifyWithWalletProviderSource.ts
|
|
4218
4532
|
/**
|
|
@@ -4240,9 +4554,9 @@ const buildWalletOption = ({ connectionOptions, displayOverride, installationUrl
|
|
|
4240
4554
|
*/
|
|
4241
4555
|
const classifyWithWalletProviderSource = ({ entry }) => {
|
|
4242
4556
|
const { priority } = entry;
|
|
4243
|
-
if (priority ===
|
|
4244
|
-
if (priority ===
|
|
4245
|
-
if (priority ===
|
|
4557
|
+
if (priority === require_InvalidParamError.WalletProviderPriority.WALLET_SDK) return "sdk";
|
|
4558
|
+
if (priority === require_InvalidParamError.WalletProviderPriority.WALLET_SELF_ANNOUNCEMENT_STANDARD) return "selfAnnounced";
|
|
4559
|
+
if (priority === require_InvalidParamError.WalletProviderPriority.WINDOW_INJECT) return "windowInjected";
|
|
4246
4560
|
};
|
|
4247
4561
|
|
|
4248
4562
|
//#endregion
|
|
@@ -4292,7 +4606,7 @@ const normalizeWalletDisplayName = (displayName) => displayName.toLowerCase().re
|
|
|
4292
4606
|
|
|
4293
4607
|
//#endregion
|
|
4294
4608
|
//#region src/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findByNameMatch/findByNameMatch.ts
|
|
4295
|
-
const normalize = (value) => value.toLowerCase().replace(/\s+/g, "");
|
|
4609
|
+
const normalize = (value) => value === void 0 ? void 0 : value.toLowerCase().replace(/\s+/g, "");
|
|
4296
4610
|
/**
|
|
4297
4611
|
* Looks for a wallet book entry whose `name` or `shortName` normalizes to
|
|
4298
4612
|
* the same string as `candidate`. Used as a fallback by
|
|
@@ -4362,7 +4676,7 @@ const resolveWalletOptionKey = ({ fallback, wallet }) => wallet.group ?? wallet.
|
|
|
4362
4676
|
* @not-instrumented
|
|
4363
4677
|
*/
|
|
4364
4678
|
const findWalletOptionKeyForProviderKey = ({ chain, walletBook, walletProvider }) => {
|
|
4365
|
-
const { normalizedWalletNameWithChain } =
|
|
4679
|
+
const { normalizedWalletNameWithChain } = require_InvalidParamError.splitWalletProviderKey(walletProvider.key);
|
|
4366
4680
|
const candidates = [normalizedWalletNameWithChain, stripChainSuffix({
|
|
4367
4681
|
chain,
|
|
4368
4682
|
normalizedName: normalizedWalletNameWithChain
|
|
@@ -4412,6 +4726,7 @@ const findWalletOptionKeyForProviderKey = ({ chain, walletBook, walletProvider }
|
|
|
4412
4726
|
const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
|
|
4413
4727
|
const result = [];
|
|
4414
4728
|
for (const entry of entries) {
|
|
4729
|
+
if (!hasWalletProviderConnectMethod({ walletProvider: entry.walletProvider })) continue;
|
|
4415
4730
|
const source = classifyWithWalletProviderSource({ entry });
|
|
4416
4731
|
if (!source) {
|
|
4417
4732
|
require_InvalidParamError.getCore(client).logger.error("buildWithWalletProviderOptions: registered wallet provider has an unrecognised priority — unable to identify how this wallet was registered", {
|
|
@@ -4706,7 +5021,12 @@ const EMPTY_WALLET_BOOK = {
|
|
|
4706
5021
|
* pass `includeMobileOptions: true` to additionally surface
|
|
4707
5022
|
* WalletConnect, in-app-browser, and install links.
|
|
4708
5023
|
*
|
|
4709
|
-
*
|
|
5024
|
+
* Pass `excludedConnectionOptionTypes` to drop specific connection types
|
|
5025
|
+
* from the catalogue (e.g. `['inAppBrowser']` on desktop). Wallets whose
|
|
5026
|
+
* only connection was an excluded type fall through to the install-only
|
|
5027
|
+
* tier of the relevance ordering.
|
|
5028
|
+
*
|
|
5029
|
+
* @param [params] - Inclusion flag + ordering preference + exclusions.
|
|
4710
5030
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4711
5031
|
* @returns A promise that resolves to the wallet options catalogue.
|
|
4712
5032
|
* @not-instrumented
|
|
@@ -4714,14 +5034,21 @@ const EMPTY_WALLET_BOOK = {
|
|
|
4714
5034
|
const getWalletOptionsCatalogue = async (params = {}, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4715
5035
|
const includeMobileOptions = params.includeMobileOptions ?? false;
|
|
4716
5036
|
const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
|
|
5037
|
+
const excludedConnectionOptionTypes = new Set(params.excludedConnectionOptionTypes ?? []);
|
|
4717
5038
|
const walletBook = includeMobileOptions ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
|
|
4718
5039
|
const allConnectionOptions = [];
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
5040
|
+
if (!excludedConnectionOptionTypes.has("withWalletProvider")) {
|
|
5041
|
+
const entries = require_InvalidParamError.getWalletProviderRegistry(client).listProviderEntries();
|
|
5042
|
+
allConnectionOptions.push(...buildWithWalletProviderOptions({
|
|
5043
|
+
entries,
|
|
5044
|
+
walletBook
|
|
5045
|
+
}, client));
|
|
5046
|
+
}
|
|
5047
|
+
if (includeMobileOptions) {
|
|
5048
|
+
if (!excludedConnectionOptionTypes.has("walletConnect")) allConnectionOptions.push(...buildWalletConnectOptions({ walletBook }));
|
|
5049
|
+
if (!excludedConnectionOptionTypes.has("metamaskSdkUri")) allConnectionOptions.push(...buildMetaMaskSdkUriOptions({ walletBook }));
|
|
5050
|
+
if (!excludedConnectionOptionTypes.has("inAppBrowser")) allConnectionOptions.push(...buildInAppBrowserOptions({ walletBook }));
|
|
5051
|
+
}
|
|
4725
5052
|
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({ walletBook }) : /* @__PURE__ */ new Map();
|
|
4726
5053
|
const grouped = groupOptionsByWalletOption({ options: allConnectionOptions });
|
|
4727
5054
|
const allWalletOptionKeys = new Set([...grouped.keys(), ...installationUrlsByKey.keys()]);
|
|
@@ -4847,13 +5174,13 @@ const authenticateMfaRecoveryCode = async ({ code, createMfaTokenOptions, reques
|
|
|
4847
5174
|
}
|
|
4848
5175
|
});
|
|
4849
5176
|
require_getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({ response }, client);
|
|
4850
|
-
|
|
5177
|
+
require_InvalidParamError.emitEvent({
|
|
4851
5178
|
args: { mfaToken: response.mfaToken },
|
|
4852
5179
|
event: "mfaCompletionSuccess"
|
|
4853
5180
|
}, client);
|
|
4854
5181
|
return response;
|
|
4855
5182
|
} catch (error) {
|
|
4856
|
-
|
|
5183
|
+
require_InvalidParamError.emitEvent({
|
|
4857
5184
|
args: { error },
|
|
4858
5185
|
event: "mfaCompletionFailure"
|
|
4859
5186
|
}, client);
|
|
@@ -4927,13 +5254,13 @@ const authenticatePasskeyMFA = async ({ createMfaToken, relatedOriginRpId, reque
|
|
|
4927
5254
|
requestedScopes
|
|
4928
5255
|
}, client);
|
|
4929
5256
|
require_getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({ response }, client);
|
|
4930
|
-
|
|
5257
|
+
require_InvalidParamError.emitEvent({
|
|
4931
5258
|
args: { mfaToken: response.mfaToken },
|
|
4932
5259
|
event: "mfaCompletionSuccess"
|
|
4933
5260
|
}, client);
|
|
4934
5261
|
return response;
|
|
4935
5262
|
} catch (error) {
|
|
4936
|
-
|
|
5263
|
+
require_InvalidParamError.emitEvent({
|
|
4937
5264
|
args: { error },
|
|
4938
5265
|
event: "mfaCompletionFailure"
|
|
4939
5266
|
}, client);
|
|
@@ -4971,7 +5298,7 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4971
5298
|
}
|
|
4972
5299
|
});
|
|
4973
5300
|
require_getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({ response }, client);
|
|
4974
|
-
|
|
5301
|
+
require_InvalidParamError.emitEvent({
|
|
4975
5302
|
args: {
|
|
4976
5303
|
deviceId,
|
|
4977
5304
|
mfaToken: response.mfaToken
|
|
@@ -4980,7 +5307,7 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4980
5307
|
}, client);
|
|
4981
5308
|
return response;
|
|
4982
5309
|
} catch (error) {
|
|
4983
|
-
|
|
5310
|
+
require_InvalidParamError.emitEvent({
|
|
4984
5311
|
args: {
|
|
4985
5312
|
deviceId,
|
|
4986
5313
|
error
|
|
@@ -6370,7 +6697,7 @@ const getSwapStatus = async (params, client = require_InvalidParamError.getDefau
|
|
|
6370
6697
|
const deleteUser = async (client = require_InvalidParamError.getDefaultClient()) => {
|
|
6371
6698
|
const core = require_InvalidParamError.getCore(client);
|
|
6372
6699
|
await require_InvalidParamError.createApiClient({ includeMfaToken: true }, client).hardDeleteUser({ environmentId: core.environmentId });
|
|
6373
|
-
await
|
|
6700
|
+
await require_InvalidParamError.__logoutWithReason_wrapped({ reason: "user-deleted" }, client);
|
|
6374
6701
|
};
|
|
6375
6702
|
const __deleteUser_impl = deleteUser;
|
|
6376
6703
|
const __deleteUser_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -6603,7 +6930,7 @@ const isInsufficientGoogleDriveScopesError = (err) => err instanceof Error && er
|
|
|
6603
6930
|
* @not-instrumented
|
|
6604
6931
|
*/
|
|
6605
6932
|
const assertWalletAccountSigningAvailability = async ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
6606
|
-
const { addresses } = await
|
|
6933
|
+
const { addresses } = await require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client).getConnectedAddresses();
|
|
6607
6934
|
if (addresses.length > 0 && !addresses.includes(walletAccount.address)) throw new WalletAccountNotSelectedError({
|
|
6608
6935
|
expectedAddress: walletAccount.address,
|
|
6609
6936
|
selectedAddress: addresses[0]
|
|
@@ -6627,7 +6954,7 @@ const assertWalletAccountSigningAvailability = async ({ walletAccount }, client
|
|
|
6627
6954
|
* @instrumented
|
|
6628
6955
|
*/
|
|
6629
6956
|
const confirmTransaction = async ({ walletAccount, transactionHash }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
6630
|
-
const walletProvider =
|
|
6957
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
6631
6958
|
assertWalletProviderMethodDefined(walletProvider, "confirmTransaction");
|
|
6632
6959
|
await walletProvider.confirmTransaction({
|
|
6633
6960
|
transactionHash,
|
|
@@ -6647,33 +6974,6 @@ const __confirmTransaction_wrapped = require_InvalidParamError.instrumentFunctio
|
|
|
6647
6974
|
}
|
|
6648
6975
|
});
|
|
6649
6976
|
|
|
6650
|
-
//#endregion
|
|
6651
|
-
//#region src/utils/isMobile/isMobile.ts
|
|
6652
|
-
/**
|
|
6653
|
-
* Sourced from http://detectmobilebrowsers.com/
|
|
6654
|
-
* @not-instrumented
|
|
6655
|
-
*/
|
|
6656
|
-
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|ios|ipad|playbook|silk/i;
|
|
6657
|
-
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;
|
|
6658
|
-
/** @not-instrumented */
|
|
6659
|
-
const isMobile = (maxTouchPointsOverride) => {
|
|
6660
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
6661
|
-
return userAgentRegex1.test(navigator.userAgent) || userAgentRegex2.test(navigator.userAgent.substring(0, 4)) || isIPad(maxTouchPointsOverride) || isIPhone();
|
|
6662
|
-
};
|
|
6663
|
-
/** @not-instrumented */
|
|
6664
|
-
const isIPhone = () => typeof window === "undefined" || typeof navigator === "undefined" ? false : /iPhone|ios/.test(navigator.userAgent);
|
|
6665
|
-
/**
|
|
6666
|
-
* @param [optional] maxTouchPointsOverride - this is used for testing since
|
|
6667
|
-
* it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
|
|
6668
|
-
* to mock it
|
|
6669
|
-
* @not-instrumented
|
|
6670
|
-
*/
|
|
6671
|
-
const isIPad = (maxTouchPointsOverride) => {
|
|
6672
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
6673
|
-
const maxTouchPoints = maxTouchPointsOverride || navigator.maxTouchPoints;
|
|
6674
|
-
return /iPad/.test(navigator.userAgent) || /Mac/.test(navigator.userAgent) && maxTouchPoints === 5;
|
|
6675
|
-
};
|
|
6676
|
-
|
|
6677
6977
|
//#endregion
|
|
6678
6978
|
//#region src/modules/wallets/utils/getAddressesWithTypesFromConnectionResult/getAddressesWithTypesFromConnectionResult.ts
|
|
6679
6979
|
/** @not-instrumented */
|
|
@@ -6717,7 +7017,7 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
6717
7017
|
addressesWithTypes: getAddressesWithTypesFromConnectionResult({ addresses }),
|
|
6718
7018
|
chain: walletProvider.chain,
|
|
6719
7019
|
hardwareWalletVendor,
|
|
6720
|
-
id:
|
|
7020
|
+
id: require_InvalidParamError.formatWalletAccountId({
|
|
6721
7021
|
address: mainAddress,
|
|
6722
7022
|
chain: walletProvider.chain,
|
|
6723
7023
|
walletProviderKey
|
|
@@ -6779,7 +7079,7 @@ const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client)
|
|
|
6779
7079
|
const url = new URL(appUniversalLink);
|
|
6780
7080
|
const domain = url.host;
|
|
6781
7081
|
const nonce = nonceOverride ?? await require_InvalidParamError.getNonce(client);
|
|
6782
|
-
const walletProvider =
|
|
7082
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
6783
7083
|
if (walletProvider.chain === "STARK")
|
|
6784
7084
|
/**
|
|
6785
7085
|
* Starknet requires the strings to be 31 chars long
|
|
@@ -6818,7 +7118,7 @@ const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client)
|
|
|
6818
7118
|
* @instrumented
|
|
6819
7119
|
*/
|
|
6820
7120
|
const proveWalletAccountOwnership = async ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
6821
|
-
const walletProvider =
|
|
7121
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
6822
7122
|
assertWalletProviderMethodDefined(walletProvider, "signMessage");
|
|
6823
7123
|
const messageToSign = await getSignInMessage({
|
|
6824
7124
|
nonce: walletProvider.getConnectProofNonce?.(),
|
|
@@ -6849,10 +7149,10 @@ const __proveWalletAccountOwnership_wrapped = require_InvalidParamError.instrume
|
|
|
6849
7149
|
//#endregion
|
|
6850
7150
|
//#region src/modules/wallets/utils/isSameAddress/isSameAddress.ts
|
|
6851
7151
|
/** @not-instrumented */
|
|
6852
|
-
const isSameAddress = ({ chain, left, right }) =>
|
|
7152
|
+
const isSameAddress = ({ chain, left, right }) => require_InvalidParamError.normalizeAddress({
|
|
6853
7153
|
address: left,
|
|
6854
7154
|
chain
|
|
6855
|
-
}) ===
|
|
7155
|
+
}) === require_InvalidParamError.normalizeAddress({
|
|
6856
7156
|
address: right,
|
|
6857
7157
|
chain
|
|
6858
7158
|
});
|
|
@@ -6862,7 +7162,7 @@ const isSameAddress = ({ chain, left, right }) => require_getVerifiedCredentialF
|
|
|
6862
7162
|
/** @not-instrumented */
|
|
6863
7163
|
const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfer, requestedScopes }, client) => {
|
|
6864
7164
|
if (walletAccount.verifiedCredentialId) throw new WalletAccountAlreadyVerifiedError(walletAccount.address);
|
|
6865
|
-
const walletProvider =
|
|
7165
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
6866
7166
|
const { messageToSign, signature } = await __proveWalletAccountOwnership_wrapped({ walletAccount }, client);
|
|
6867
7167
|
const formattedSignature = walletAccount.hardwareWalletVendor ? formatSignatureForHardwareWallet({
|
|
6868
7168
|
hardwareWalletVendor: walletAccount.hardwareWalletVendor,
|
|
@@ -6897,7 +7197,7 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
6897
7197
|
* Remove the now verified wallet account from the unverified wallet accounts
|
|
6898
7198
|
*/
|
|
6899
7199
|
require_getNetworkProviderFromNetworkId.removeUnverifiedWalletAccount({ unverifiedWalletAccount: walletAccount }, client);
|
|
6900
|
-
const verifiedWalletAccount =
|
|
7200
|
+
const verifiedWalletAccount = require_InvalidParamError.getWalletAccounts(client).find(({ address }) => isSameAddress({
|
|
6901
7201
|
chain: walletAccount.chain,
|
|
6902
7202
|
left: address,
|
|
6903
7203
|
right: walletAccount.address
|
|
@@ -7015,7 +7315,7 @@ const __connectAndVerifyWithWalletProvider_wrapped = require_InvalidParamError.i
|
|
|
7015
7315
|
* @not-instrumented
|
|
7016
7316
|
*/
|
|
7017
7317
|
const getAvailableWalletProvidersData = (client = require_InvalidParamError.getDefaultClient()) => {
|
|
7018
|
-
return require_getVerifiedCredentialForWalletAccount.getWalletProviders(client).filter((walletProvider) =>
|
|
7318
|
+
return require_getVerifiedCredentialForWalletAccount.getWalletProviders(client).filter((walletProvider) => hasWalletProviderConnectMethod({ walletProvider })).map((walletProvider) => ({
|
|
7019
7319
|
chain: walletProvider.chain,
|
|
7020
7320
|
groupKey: walletProvider.groupKey,
|
|
7021
7321
|
key: walletProvider.key,
|
|
@@ -7047,7 +7347,7 @@ const getConnectedAddresses = ({ walletProviderKey }, client = require_InvalidPa
|
|
|
7047
7347
|
const getOwnerWalletAccountForSmartWalletAccount = ({ smartWalletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7048
7348
|
const smartWalletVerifiedCredential = require_getVerifiedCredentialForWalletAccount.getVerifiedCredentialForWalletAccount({ walletAccount: smartWalletAccount }, client);
|
|
7049
7349
|
require_InvalidParamError.assertDefined(smartWalletVerifiedCredential?.signerRefId, "Invalid smart wallet account");
|
|
7050
|
-
return
|
|
7350
|
+
return require_InvalidParamError.getWalletAccounts(client).find((walletAccount) => walletAccount.verifiedCredentialId === smartWalletVerifiedCredential.signerRefId);
|
|
7051
7351
|
};
|
|
7052
7352
|
|
|
7053
7353
|
//#endregion
|
|
@@ -7078,6 +7378,22 @@ const getWalletProviderDataByKey = ({ walletProviderKey }, client = require_Inva
|
|
|
7078
7378
|
};
|
|
7079
7379
|
};
|
|
7080
7380
|
|
|
7381
|
+
//#endregion
|
|
7382
|
+
//#region src/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.ts
|
|
7383
|
+
/**
|
|
7384
|
+
* Checks whether the session has at least one connected wallet account.
|
|
7385
|
+
*
|
|
7386
|
+
* Both verified and unverified wallet accounts count as connected. This is a
|
|
7387
|
+
* single building block for a custom signed-in check — combine it with whatever
|
|
7388
|
+
* else your app considers "signed in" (e.g. `client.user`, completed onboarding,
|
|
7389
|
+
* a required embedded wallet, …).
|
|
7390
|
+
*
|
|
7391
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7392
|
+
* @returns True if the session has at least one wallet account, false otherwise.
|
|
7393
|
+
* @not-instrumented
|
|
7394
|
+
*/
|
|
7395
|
+
const isAnyWalletAccountConnected = (client = require_InvalidParamError.getDefaultClient()) => require_InvalidParamError.getWalletAccounts(client).length > 0;
|
|
7396
|
+
|
|
7081
7397
|
//#endregion
|
|
7082
7398
|
//#region src/modules/wallets/hardwareWallet/canConnectWithHardwareWallet/canConnectWithHardwareWallet.ts
|
|
7083
7399
|
/**
|
|
@@ -7169,7 +7485,7 @@ const __addNetwork_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
7169
7485
|
* @not-instrumented
|
|
7170
7486
|
*/
|
|
7171
7487
|
const getActiveNetworkData = async ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7172
|
-
const walletProvider =
|
|
7488
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7173
7489
|
const { networkId } = await walletProvider.getActiveNetworkId();
|
|
7174
7490
|
return { networkData: require_getNetworkProviderFromNetworkId.getNetworksData(client).find((data) => data.networkId === networkId && data.chain === walletProvider.chain) };
|
|
7175
7491
|
};
|
|
@@ -7185,24 +7501,28 @@ const getActiveNetworkData = async ({ walletAccount }, client = require_InvalidP
|
|
|
7185
7501
|
* @not-instrumented
|
|
7186
7502
|
*/
|
|
7187
7503
|
const getActiveNetworkId = ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7188
|
-
return
|
|
7504
|
+
return require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client).getActiveNetworkId();
|
|
7189
7505
|
};
|
|
7190
7506
|
|
|
7191
7507
|
//#endregion
|
|
7192
|
-
//#region src/modules/wallets/networks/
|
|
7508
|
+
//#region src/modules/wallets/networks/getNativeBalance/getNativeBalance.ts
|
|
7193
7509
|
/**
|
|
7194
|
-
* Retrieves the native token balance for a wallet account
|
|
7510
|
+
* Retrieves the native token balance for a wallet account on its active
|
|
7511
|
+
* network. Reads directly from the chain's network provider (RPC), not
|
|
7512
|
+
* the Dynamic API.
|
|
7195
7513
|
*
|
|
7196
|
-
*
|
|
7197
|
-
* (
|
|
7514
|
+
* Use this when you only need the user's gas / native-currency balance
|
|
7515
|
+
* (ETH, SOL, BTC, etc.). For token balances, use
|
|
7516
|
+
* {@link getTokenBalances}; for a multi-chain portfolio snapshot, use
|
|
7517
|
+
* {@link getMultichainTokenBalances}.
|
|
7198
7518
|
*
|
|
7199
7519
|
* @param params.walletAccount - The wallet account to get the balance for.
|
|
7200
7520
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7201
7521
|
* @returns A promise that resolves to an object containing the balance as a string or null.
|
|
7202
7522
|
* @not-instrumented
|
|
7203
7523
|
*/
|
|
7204
|
-
const
|
|
7205
|
-
const walletProvider =
|
|
7524
|
+
const getNativeBalance = async ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7525
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7206
7526
|
const { networkId } = await walletProvider.getActiveNetworkId();
|
|
7207
7527
|
return require_getNetworkProviderFromNetworkId.getNetworkProviderFromNetworkId({
|
|
7208
7528
|
chain: walletProvider.chain,
|
|
@@ -7361,9 +7681,9 @@ const __selectPrimaryWalletAccount_wrapped = require_InvalidParamError.instrumen
|
|
|
7361
7681
|
*/
|
|
7362
7682
|
const disconnectWalletAccount = async ({ walletAccount }, client) => {
|
|
7363
7683
|
try {
|
|
7364
|
-
await
|
|
7684
|
+
await require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client).disconnectWalletAccount?.({ walletAccount });
|
|
7365
7685
|
} catch (error) {
|
|
7366
|
-
if (error instanceof
|
|
7686
|
+
if (error instanceof require_InvalidParamError.NoWalletProviderFoundError) return;
|
|
7367
7687
|
throw error;
|
|
7368
7688
|
}
|
|
7369
7689
|
};
|
|
@@ -7423,7 +7743,7 @@ const __removeWalletAccount_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
7423
7743
|
* @instrumented
|
|
7424
7744
|
*/
|
|
7425
7745
|
const signMessage = async ({ walletAccount, message }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7426
|
-
const walletProvider =
|
|
7746
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7427
7747
|
assertWalletProviderMethodDefined(walletProvider, "signMessage");
|
|
7428
7748
|
const { signature } = await walletProvider.signMessage({
|
|
7429
7749
|
message,
|
|
@@ -7462,7 +7782,7 @@ const __signMessage_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
7462
7782
|
* @instrumented
|
|
7463
7783
|
*/
|
|
7464
7784
|
const transferAmount = async ({ walletAccount, amount, recipient, token }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7465
|
-
const walletProvider =
|
|
7785
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7466
7786
|
assertWalletProviderMethodDefined(walletProvider, "transferAmount");
|
|
7467
7787
|
const { transactionHash } = await walletProvider.transferAmount({
|
|
7468
7788
|
amount,
|
|
@@ -7535,7 +7855,7 @@ const __transferWalletAccount_wrapped = require_InvalidParamError.instrumentFunc
|
|
|
7535
7855
|
* @not-instrumented
|
|
7536
7856
|
*/
|
|
7537
7857
|
const getWalletAccountFromAddress = ({ address, chain }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7538
|
-
return
|
|
7858
|
+
return require_InvalidParamError.getWalletAccounts(client).find((walletAccount) => walletAccount.address === address && walletAccount.chain === chain);
|
|
7539
7859
|
};
|
|
7540
7860
|
|
|
7541
7861
|
//#endregion
|
|
@@ -7740,14 +8060,14 @@ exports.detectOAuthRedirect = detectOAuthRedirect;
|
|
|
7740
8060
|
exports.detectSocialRedirectUrl = detectSocialRedirectUrl;
|
|
7741
8061
|
exports.excludeInstalledFromCatalog = excludeInstalledFromCatalog;
|
|
7742
8062
|
exports.executeSwapTransaction = __executeSwapTransaction_wrapped;
|
|
7743
|
-
exports.fetchProjectSettings =
|
|
8063
|
+
exports.fetchProjectSettings = require_InvalidParamError.fetchProjectSettings;
|
|
7744
8064
|
exports.findMissingGoogleDriveBackupScopes = findMissingGoogleDriveBackupScopes;
|
|
7745
8065
|
exports.getActiveNetworkData = getActiveNetworkData;
|
|
7746
8066
|
exports.getActiveNetworkId = getActiveNetworkId;
|
|
7747
8067
|
exports.getAvailableWalletProvidersData = getAvailableWalletProvidersData;
|
|
7748
|
-
exports.getBalance =
|
|
8068
|
+
exports.getBalance = getNativeBalance;
|
|
7749
8069
|
exports.getBalanceForAddress = getBalanceForAddress;
|
|
7750
|
-
exports.getBalances =
|
|
8070
|
+
exports.getBalances = getTokenBalances;
|
|
7751
8071
|
exports.getCheckoutTransaction = getCheckoutTransaction;
|
|
7752
8072
|
exports.getCheckoutTransactionQuote = getCheckoutTransactionQuote;
|
|
7753
8073
|
exports.getCoinbaseBuyUrl = getCoinbaseBuyUrl;
|
|
@@ -7756,13 +8076,18 @@ exports.getDefaultClient = require_InvalidParamError.getDefaultClient;
|
|
|
7756
8076
|
exports.getDeviceRegistrationTokenFromUrl = getDeviceRegistrationTokenFromUrl;
|
|
7757
8077
|
exports.getElevatedAccessToken = require_InvalidParamError.__getElevatedAccessToken_wrapped;
|
|
7758
8078
|
exports.getGoogleDriveBackupReadiness = __getGoogleDriveBackupReadiness_wrapped;
|
|
8079
|
+
exports.getInstallationLinkForCurrentPlatform = getInstallationLinkForCurrentPlatform;
|
|
7759
8080
|
exports.getKrakenAccounts = getKrakenAccounts;
|
|
7760
8081
|
exports.getKrakenWhitelistedAddresses = getKrakenWhitelistedAddresses;
|
|
7761
8082
|
exports.getMfaDevices = getMfaDevices;
|
|
7762
8083
|
exports.getMfaMethods = require_isMfaRequiredForAction.getMfaMethods;
|
|
7763
8084
|
exports.getMfaRecoveryCodes = getMfaRecoveryCodes;
|
|
7764
8085
|
exports.getMissingVerificationForCoinbaseOnrampOrder = getMissingVerificationForCoinbaseOnrampOrder;
|
|
7765
|
-
exports.
|
|
8086
|
+
exports.getMoonPayCurrencies = __getMoonPayCurrencies_wrapped;
|
|
8087
|
+
exports.getMoonPayUrl = __getMoonPayUrl_wrapped;
|
|
8088
|
+
exports.getMultichainBalances = getMultichainTokenBalances;
|
|
8089
|
+
exports.getMultichainTokenBalances = getMultichainTokenBalances;
|
|
8090
|
+
exports.getNativeBalance = getNativeBalance;
|
|
7766
8091
|
exports.getNetworksData = require_getNetworkProviderFromNetworkId.getNetworksData;
|
|
7767
8092
|
exports.getOwnerWalletAccountForSmartWalletAccount = getOwnerWalletAccountForSmartWalletAccount;
|
|
7768
8093
|
exports.getPasskeys = getPasskeys;
|
|
@@ -7770,11 +8095,12 @@ exports.getPrimaryWalletAccount = getPrimaryWalletAccount;
|
|
|
7770
8095
|
exports.getRegisteredDevices = getRegisteredDevices;
|
|
7771
8096
|
exports.getSwapQuote = getSwapQuote;
|
|
7772
8097
|
exports.getSwapStatus = getSwapStatus;
|
|
8098
|
+
exports.getTokenBalances = getTokenBalances;
|
|
7773
8099
|
exports.getTransactionHistory = getTransactionHistory;
|
|
7774
8100
|
exports.getUserSocialAccounts = getUserSocialAccounts;
|
|
7775
8101
|
exports.getWalletAccountAddressByType = getWalletAccountAddressByType;
|
|
7776
8102
|
exports.getWalletAccountFromAddress = getWalletAccountFromAddress;
|
|
7777
|
-
exports.getWalletAccounts =
|
|
8103
|
+
exports.getWalletAccounts = require_InvalidParamError.getWalletAccounts;
|
|
7778
8104
|
exports.getWalletConnectCatalog = getWalletConnectCatalog;
|
|
7779
8105
|
exports.getWalletConnectCatalogWalletByWalletProviderKey = getWalletConnectCatalogWalletByWalletProviderKey;
|
|
7780
8106
|
exports.getWalletOptionsCatalogue = getWalletOptionsCatalogue;
|
|
@@ -7782,6 +8108,7 @@ exports.getWalletProviderDataByKey = getWalletProviderDataByKey;
|
|
|
7782
8108
|
exports.hasAllGoogleDriveBackupScopes = hasAllGoogleDriveBackupScopes;
|
|
7783
8109
|
exports.hasExtension = require_getNetworkProviderFromNetworkId.hasExtension;
|
|
7784
8110
|
exports.initializeClient = __initializeClient_wrapped;
|
|
8111
|
+
exports.isAnyWalletAccountConnected = isAnyWalletAccountConnected;
|
|
7785
8112
|
exports.isCaptchaRequired = require_getNetworkProviderFromNetworkId.isCaptchaRequired;
|
|
7786
8113
|
exports.isDeeplinkWalletProvider = isDeeplinkWalletProvider;
|
|
7787
8114
|
exports.isDeviceRegistrationRequired = isDeviceRegistrationRequired;
|
|
@@ -7791,17 +8118,17 @@ exports.isMfaRequiredForAction = require_isMfaRequiredForAction.isMfaRequiredFor
|
|
|
7791
8118
|
exports.isMobile = isMobile;
|
|
7792
8119
|
exports.isPendingRecoveryCodesAcknowledgment = isPendingRecoveryCodesAcknowledgment;
|
|
7793
8120
|
exports.isProgrammaticNetworkSwitchAvailable = isProgrammaticNetworkSwitchAvailable;
|
|
7794
|
-
exports.isSignedIn =
|
|
8121
|
+
exports.isSignedIn = require_InvalidParamError.isSignedIn;
|
|
7795
8122
|
exports.isUserMissingMfaAuth = require_getVerifiedCredentialForWalletAccount.isUserMissingMfaAuth;
|
|
7796
8123
|
exports.isUserOnboardingComplete = isUserOnboardingComplete;
|
|
7797
8124
|
exports.isWalletAccountVerified = isWalletAccountVerified;
|
|
7798
8125
|
exports.logout = logout;
|
|
7799
8126
|
exports.matchWalletProvidersToCatalogGroup = matchWalletProvidersToCatalogGroup;
|
|
7800
|
-
exports.offEvent =
|
|
8127
|
+
exports.offEvent = require_InvalidParamError.offEvent;
|
|
7801
8128
|
exports.offWalletProviderEvent = offWalletProviderEvent;
|
|
7802
|
-
exports.onEvent =
|
|
8129
|
+
exports.onEvent = require_InvalidParamError.onEvent;
|
|
7803
8130
|
exports.onWalletProviderEvent = onWalletProviderEvent;
|
|
7804
|
-
exports.onceEvent =
|
|
8131
|
+
exports.onceEvent = require_InvalidParamError.onceEvent;
|
|
7805
8132
|
exports.parseUserAgent = parseUserAgent;
|
|
7806
8133
|
exports.prepareCheckoutTransaction = __prepareCheckoutTransaction_wrapped;
|
|
7807
8134
|
exports.proveWalletAccountOwnership = __proveWalletAccountOwnership_wrapped;
|