@dynamic-labs-sdk/client 1.31.0 → 1.31.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{apiClient-DpzKqY39.native.esm.js → apiClient-d2qJyIvx.native.esm.js} +2 -2
- package/dist/{apiClient-DpzKqY39.native.esm.js.map → apiClient-d2qJyIvx.native.esm.js.map} +1 -1
- package/dist/core.cjs +78 -5
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +78 -8
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +78 -8
- package/dist/core.native.esm.js.map +1 -1
- package/dist/errors/AmbiguousWalletChainError.d.ts +32 -0
- package/dist/errors/AmbiguousWalletChainError.d.ts.map +1 -0
- package/dist/errors/ConnectionUriHandlerMissingError.d.ts +37 -0
- package/dist/errors/ConnectionUriHandlerMissingError.d.ts.map +1 -0
- package/dist/errors/NoConnectionOptionAvailableError.d.ts +39 -0
- package/dist/errors/NoConnectionOptionAvailableError.d.ts.map +1 -0
- package/dist/errors/WalletOptionNotFoundError.d.ts +30 -0
- package/dist/errors/WalletOptionNotFoundError.d.ts.map +1 -0
- package/dist/exports/core.d.ts +8 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +8 -1
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BN2jUhHm.esm.js → getNetworkProviderFromNetworkId-D9nx6Od5.esm.js} +29 -25
- package/dist/getNetworkProviderFromNetworkId-D9nx6Od5.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-DUym3Qq0.native.esm.js → getNetworkProviderFromNetworkId-DF9kPibD.native.esm.js} +30 -26
- package/dist/getNetworkProviderFromNetworkId-DF9kPibD.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-BoNAPSjx.cjs → getNetworkProviderFromNetworkId-DueBnAl6.cjs} +23 -19
- package/dist/{getNetworkProviderFromNetworkId-BoNAPSjx.cjs.map → getNetworkProviderFromNetworkId-DueBnAl6.cjs.map} +1 -1
- package/dist/{getSignedSessionId-DxpqG4pv.esm.js → getSignedSessionId-5q4uyZsv.native.esm.js} +34 -4
- package/dist/getSignedSessionId-5q4uyZsv.native.esm.js.map +1 -0
- package/dist/{getSignedSessionId-9ADIJCl1.cjs → getSignedSessionId-B5oxmSTs.cjs} +39 -3
- package/dist/getSignedSessionId-B5oxmSTs.cjs.map +1 -0
- package/dist/{getSignedSessionId-Dr4Ic68X.native.esm.js → getSignedSessionId-BKfQycNo.esm.js} +34 -4
- package/dist/getSignedSessionId-BKfQycNo.esm.js.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-C2o5idph.cjs → getVerifiedCredentialForWalletAccount-Bx0HlvfW.cjs} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-C2o5idph.cjs.map → getVerifiedCredentialForWalletAccount-Bx0HlvfW.cjs.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-Cjwoeej7.esm.js → getVerifiedCredentialForWalletAccount-_3MExyld.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-Cjwoeej7.esm.js.map → getVerifiedCredentialForWalletAccount-_3MExyld.esm.js.map} +1 -1
- package/dist/index.cjs +536 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +534 -83
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +492 -83
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-BIBmJbV9.esm.js → isMfaRequiredForAction-BDmY2_Sj.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-BIBmJbV9.esm.js.map → isMfaRequiredForAction-BDmY2_Sj.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-DuSU67yq.native.esm.js → isMfaRequiredForAction-BrRCSvEX.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-DuSU67yq.native.esm.js.map → isMfaRequiredForAction-BrRCSvEX.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-yM84r7l7.cjs → isMfaRequiredForAction-DnKzPDZk.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-yM84r7l7.cjs.map → isMfaRequiredForAction-DnKzPDZk.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-BRTOnK8V.cjs → isUserOnboardingComplete-7GzNYU2g.cjs} +3 -3
- package/dist/{isUserOnboardingComplete-BRTOnK8V.cjs.map → isUserOnboardingComplete-7GzNYU2g.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-DCIlkCub.native.esm.js → isUserOnboardingComplete-BfMMBtkF.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-DCIlkCub.native.esm.js.map → isUserOnboardingComplete-BfMMBtkF.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-B2Ha2dkP.esm.js → isUserOnboardingComplete-D1-QluDm.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-B2Ha2dkP.esm.js.map → isUserOnboardingComplete-D1-QluDm.esm.js.map} +1 -1
- package/dist/{logoutWithReason-HqGlUccb.native.esm.js → logoutWithReason-3UICYir7.native.esm.js} +2 -2
- package/dist/{logoutWithReason-HqGlUccb.native.esm.js.map → logoutWithReason-3UICYir7.native.esm.js.map} +1 -1
- package/dist/{logoutWithReason-DV89zJmJ.esm.js → logoutWithReason-CHyuBHdx.esm.js} +2 -2
- package/dist/{logoutWithReason-DV89zJmJ.esm.js.map → logoutWithReason-CHyuBHdx.esm.js.map} +1 -1
- package/dist/{logoutWithReason-DlA15deT.cjs → logoutWithReason-C_T7KddM.cjs} +2 -2
- package/dist/{logoutWithReason-DlA15deT.cjs.map → logoutWithReason-C_T7KddM.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-CiOS4_Nq.esm.js → migrateFromFireblocks-BMO3u6rO.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-CiOS4_Nq.esm.js.map → migrateFromFireblocks-BMO3u6rO.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-CqIpxGRS.cjs → migrateFromFireblocks-C9Kuke5V.cjs} +2 -2
- package/dist/{migrateFromFireblocks-CqIpxGRS.cjs.map → migrateFromFireblocks-C9Kuke5V.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-DnQsGmIW.native.esm.js → migrateFromFireblocks-DJt9bktR.native.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-DnQsGmIW.native.esm.js.map → migrateFromFireblocks-DJt9bktR.native.esm.js.map} +1 -1
- package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.d.ts +7 -1
- package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.types.d.ts +4 -0
- package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.types.d.ts.map +1 -0
- package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.d.ts +9 -0
- package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts +9 -1
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.d.ts +7 -1
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/filterConnectionOptionsByEnabledChains.d.ts +30 -0
- package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/filterConnectionOptionsByEnabledChains.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/index.d.ts +2 -0
- package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/index.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts +4 -0
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts +2 -1
- package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts.map +1 -1
- package/dist/modules/wallets/connectWallet.types.d.ts +35 -0
- package/dist/modules/wallets/connectWallet.types.d.ts.map +1 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/connectWithUriConnectionOption.d.ts +52 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/connectWithUriConnectionOption.d.ts.map +1 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/getConnectionUriDeeplink/getConnectionUriDeeplink.d.ts +34 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/getConnectionUriDeeplink/getConnectionUriDeeplink.d.ts.map +1 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/getConnectionUriDeeplink/index.d.ts +2 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/getConnectionUriDeeplink/index.d.ts.map +1 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/index.d.ts +2 -0
- package/dist/modules/wallets/connectWithUriConnectionOption/index.d.ts.map +1 -0
- package/dist/modules/wallets/networks/getEnabledChains/getEnabledChains.d.ts +25 -0
- package/dist/modules/wallets/networks/getEnabledChains/getEnabledChains.d.ts.map +1 -0
- package/dist/modules/wallets/networks/getEnabledChains/index.d.ts +2 -0
- package/dist/modules/wallets/networks/getEnabledChains/index.d.ts.map +1 -0
- package/dist/modules/wallets/networks/networkProviderBuilderRegistry/createNetworkProviderBuilderRegistry/createNetworkProviderBuilderRegistry.d.ts +2 -1
- package/dist/modules/wallets/networks/networkProviderBuilderRegistry/createNetworkProviderBuilderRegistry/createNetworkProviderBuilderRegistry.d.ts.map +1 -1
- package/dist/modules/wallets/networks/networkProviderBuilderRegistry/events.d.ts +16 -0
- package/dist/modules/wallets/networks/networkProviderBuilderRegistry/events.d.ts.map +1 -0
- package/dist/modules/wallets/redirectToInAppBrowser/index.d.ts +2 -0
- package/dist/modules/wallets/redirectToInAppBrowser/index.d.ts.map +1 -0
- package/dist/modules/wallets/redirectToInAppBrowser/redirectToInAppBrowser.d.ts +60 -0
- package/dist/modules/wallets/redirectToInAppBrowser/redirectToInAppBrowser.d.ts.map +1 -0
- package/dist/modules/wallets/resolveWalletConnectionOption/index.d.ts +3 -0
- package/dist/modules/wallets/resolveWalletConnectionOption/index.d.ts.map +1 -0
- package/dist/modules/wallets/resolveWalletConnectionOption/resolveWalletConnectionOption.d.ts +36 -0
- package/dist/modules/wallets/resolveWalletConnectionOption/resolveWalletConnectionOption.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/createUriConnectionStarterRegistry/createUriConnectionStarterRegistry.d.ts +22 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/createUriConnectionStarterRegistry/createUriConnectionStarterRegistry.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/createUriConnectionStarterRegistry/index.d.ts +2 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/createUriConnectionStarterRegistry/index.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/events.d.ts +18 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/events.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/getUriConnectionStarterRegistry/getUriConnectionStarterRegistry.d.ts +22 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/getUriConnectionStarterRegistry/getUriConnectionStarterRegistry.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/getUriConnectionStarterRegistry/index.d.ts +2 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/getUriConnectionStarterRegistry/index.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/index.d.ts +3 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/index.d.ts.map +1 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/uriConnectionStarterRegistry.types.d.ts +32 -0
- package/dist/modules/wallets/uriConnectionStarterRegistry/uriConnectionStarterRegistry.types.d.ts.map +1 -0
- package/dist/modules/wallets/walletProviderUriConnection.types.d.ts +19 -0
- package/dist/modules/wallets/walletProviderUriConnection.types.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/buildInAppBrowserUrl/buildInAppBrowserUrl.d.ts +32 -0
- package/dist/utils/buildInAppBrowserUrl/buildInAppBrowserUrl.d.ts.map +1 -0
- package/dist/utils/buildInAppBrowserUrl/index.d.ts +2 -0
- package/dist/utils/buildInAppBrowserUrl/index.d.ts.map +1 -0
- package/dist/utils/getPreferredWalletDeepLink/getPreferredWalletDeepLink.d.ts +33 -0
- package/dist/utils/getPreferredWalletDeepLink/getPreferredWalletDeepLink.d.ts.map +1 -0
- package/dist/utils/getPreferredWalletDeepLink/index.d.ts +2 -0
- package/dist/utils/getPreferredWalletDeepLink/index.d.ts.map +1 -0
- package/dist/utils/isAndroid/index.d.ts +2 -0
- package/dist/utils/isAndroid/index.d.ts.map +1 -0
- package/dist/utils/isAndroid/isAndroid.d.ts +20 -0
- package/dist/utils/isAndroid/isAndroid.d.ts.map +1 -0
- package/dist/utils/isIOS/index.d.ts +2 -0
- package/dist/utils/isIOS/index.d.ts.map +1 -0
- package/dist/utils/isIOS/isIOS.d.ts +23 -0
- package/dist/utils/isIOS/isIOS.d.ts.map +1 -0
- package/dist/utils/isMobile/isMobile.d.ts +17 -36
- package/dist/utils/isMobile/isMobile.d.ts.map +1 -1
- package/dist/utils/userAgentChecks/userAgentChecks.d.ts +35 -0
- package/dist/utils/userAgentChecks/userAgentChecks.d.ts.map +1 -0
- package/dist/{waas-CkQYVo6U.native.esm.js → waas-9QajYGeK.native.esm.js} +4 -4
- package/dist/{waas-CkQYVo6U.native.esm.js.map → waas-9QajYGeK.native.esm.js.map} +1 -1
- package/dist/{waas-BOKafCeH.cjs → waas-Bxsd0-HG.cjs} +4 -4
- package/dist/{waas-BOKafCeH.cjs.map → waas-Bxsd0-HG.cjs.map} +1 -1
- package/dist/{waas-CUDgU2pl.esm.js → waas-T_dHXyI9.esm.js} +4 -4
- package/dist/{waas-CUDgU2pl.esm.js.map → waas-T_dHXyI9.esm.js.map} +1 -1
- package/dist/waas.cjs +4 -4
- package/dist/waas.esm.js +4 -4
- package/dist/waas.native.esm.js +4 -4
- package/dist/waasCore.cjs +10 -40
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +5 -35
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +5 -35
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +2 -2
- package/dist/getNetworkProviderFromNetworkId-BN2jUhHm.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-DUym3Qq0.native.esm.js.map +0 -1
- package/dist/getSignedSessionId-9ADIJCl1.cjs.map +0 -1
- package/dist/getSignedSessionId-Dr4Ic68X.native.esm.js.map +0 -1
- package/dist/getSignedSessionId-DxpqG4pv.esm.js.map +0 -1
package/dist/{migrateFromFireblocks-CiOS4_Nq.esm.js → migrateFromFireblocks-BMO3u6rO.esm.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as getWalletProviders, Ct as BaseError, E as isWaasWalletProvider, k as DYNAMIC_WAAS_METADATA, l as __refreshAuth_wrapped, mt as assertDefined, o as getWalletProviderFromWalletAccount, s as NoWalletProviderFoundError, yt as getDefaultClient } from "./logoutWithReason-
|
|
1
|
+
import { A as getWalletProviders, Ct as BaseError, E as isWaasWalletProvider, k as DYNAMIC_WAAS_METADATA, l as __refreshAuth_wrapped, mt as assertDefined, o as getWalletProviderFromWalletAccount, s as NoWalletProviderFoundError, yt as getDefaultClient } from "./logoutWithReason-CHyuBHdx.esm.js";
|
|
2
2
|
import { EmbeddedWalletVersionEnum } from "@dynamic-labs/sdk-api-core";
|
|
3
3
|
|
|
4
4
|
//#region src/errors/NotWaasWalletProviderError.ts
|
|
@@ -125,4 +125,4 @@ const migrateFromFireblocks = async ({ coinTypes, deviceId, expectedAddresses, j
|
|
|
125
125
|
|
|
126
126
|
//#endregion
|
|
127
127
|
export { TransactionBroadcastError as a, NotWaasWalletAccountError as i, isDynamicWaasEnabled as n, NotWaasWalletProviderError as o, getWaasWalletProviderFromWalletAccount as r, migrateFromFireblocks as t };
|
|
128
|
-
//# sourceMappingURL=migrateFromFireblocks-
|
|
128
|
+
//# sourceMappingURL=migrateFromFireblocks-BMO3u6rO.esm.js.map
|
package/dist/{migrateFromFireblocks-CiOS4_Nq.esm.js.map → migrateFromFireblocks-BMO3u6rO.esm.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrateFromFireblocks-CiOS4_Nq.esm.js","names":["refreshAuth"],"sources":["../src/errors/NotWaasWalletProviderError.ts","../src/errors/TransactionBroadcastError.ts","../src/errors/NotWaasWalletAccountError.ts","../src/modules/waas/getWaasWalletProviderFromWalletAccount/getWaasWalletProviderFromWalletAccount.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts","../src/modules/waas/migrateFromFireblocks/migrateFromFireblocks.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NotWaasWalletProviderErrorParams = {\n walletProviderKey: string;\n};\n\nexport class NotWaasWalletProviderError extends BaseError {\n constructor({ walletProviderKey }: NotWaasWalletProviderErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_provider_error',\n docsUrl: null,\n name: 'NotWaasWalletProviderError',\n shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`,\n });\n }\n}\n","import { BaseError } from './base';\n\n/**\n * Error codes that identify why a v3 WaaS transaction broadcast was rejected.\n *\n * @example 'BROADCAST_REJECTED'\n * @see transactionBroadcastErrorMapper\n * @see broadcastWaasTransaction\n */\nexport type TransactionBroadcastErrorCode =\n | 'BROADCAST_IDEMPOTENCY_CONFLICT'\n | 'BROADCAST_OUTCOME_UNKNOWN'\n | 'BROADCAST_RATE_LIMITED'\n | 'BROADCAST_REJECTED'\n | 'BROADCAST_REQUIRES_RESIGN'\n | 'BROADCAST_WALLET_INELIGIBLE'\n | 'INVALID_SIGNED_TRANSACTION'\n | 'NETWORK_NOT_ENABLED'\n | 'SIGNED_TRANSACTION_WALLET_MISMATCH'\n | 'UNSUPPORTED_WAAS_CHAIN';\n\n/**\n * States describing whether the signed transaction reached the chain.\n *\n * @example 'not_submitted'\n * @see TransactionBroadcastError\n * @see broadcastWaasTransaction\n */\nexport type TransactionBroadcastSubmissionState =\n | 'not_submitted'\n | 'requires_resign'\n | 'unknown';\n\ntype TransactionBroadcastErrorParams = {\n attempts: number;\n broadcastId: string;\n cause: Error;\n code: TransactionBroadcastErrorCode;\n message: string;\n retryable: boolean;\n submissionState: TransactionBroadcastSubmissionState;\n transactionId?: string;\n};\n\n/**\n * Error raised when Redcoast fails to submit a v3 WaaS transaction after the SDK signed it.\n *\n * @example new TransactionBroadcastError({ attempts: 1, broadcastId: 'broadcast-id', cause, code: 'BROADCAST_REJECTED', message: 'rejected', retryable: false, submissionState: 'not_submitted', transactionId: undefined })\n * @see transactionBroadcastErrorMapper\n * @see broadcastWaasTransaction\n */\nexport class TransactionBroadcastError extends BaseError {\n attempts: number;\n broadcastId: string;\n retryable: boolean;\n submissionState: TransactionBroadcastSubmissionState;\n transactionId: string | undefined;\n\n constructor({\n attempts,\n broadcastId,\n cause,\n code,\n message,\n retryable,\n submissionState,\n transactionId,\n }: TransactionBroadcastErrorParams) {\n super({\n cause,\n code,\n docsUrl: null,\n name: 'TransactionBroadcastError',\n shortMessage: message,\n });\n\n this.attempts = attempts;\n this.broadcastId = broadcastId;\n this.retryable = retryable;\n this.submissionState = submissionState;\n this.transactionId = transactionId;\n }\n}\n","import { BaseError } from './base';\n\ntype NotWaasWalletAccountErrorParams = {\n walletAddress: string;\n};\n\nexport class NotWaasWalletAccountError extends BaseError {\n constructor({ walletAddress }: NotWaasWalletAccountErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_account_error',\n docsUrl: null,\n name: 'NotWaasWalletAccountError',\n shortMessage: `Wallet account ${walletAddress} is not a Dynamic WaaS wallet account`,\n });\n }\n}\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NotWaasWalletAccountError } from '../../../errors/NotWaasWalletAccountError';\nimport { getWalletProviderFromWalletAccount } from '../../wallets/utils/getWalletProviderFromWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport type { WaasWalletProvider } from '../waas.types';\n\ntype GetWalletProviderFromWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/** @notInstrumented */\nexport const getWaasWalletProviderFromWalletAccount = (\n { walletAccount }: GetWalletProviderFromWalletAccountParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletAccountError({\n walletAddress: walletAccount.address,\n });\n }\n\n return walletProvider;\n};\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n * @notInstrumented\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()): boolean => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n","import type { MigrateFromFireblocksResponse } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport { NotWaasWalletProviderError } from '../../../errors/NotWaasWalletProviderError';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport { getWalletProviders } from '../../wallets/getWalletProviders';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\n\ntype MigrateFromFireblocksParams = {\n /**\n * Optional SLIP-0044 coin types per chain name for BIP44 derivation off the\n * Fireblocks takeover xprv (e.g. `{ EVM: 1 }` for Sepolia).\n */\n coinTypes?: Record<string, number>;\n /**\n * The Fireblocks NCW device id whose key material is being migrated.\n */\n deviceId: string;\n /**\n * Required per-chain expected wallet address (the address Fireblocks held). Its\n * keys are the chains migration runs on, and the migration iframe verifies each\n * imported Dynamic address matches the value, so a wrong derivation fails loudly\n * instead of producing an unusable wallet.\n */\n expectedAddresses: Record<string, string>;\n /**\n * The Fireblocks-issued JWT authorizing the takeover.\n */\n jwt: string;\n /**\n * The password that encrypted the legacy Fireblocks NCW device storage.\n */\n password: string;\n /**\n * The serialized Fireblocks NCW device storage (the local key share backup).\n */\n storage: Record<string, string>;\n};\n\n/**\n * Migrates an existing Fireblocks NCW wallet into Dynamic's WaaS infrastructure.\n *\n * Migration is a single cross-chain operation: one call takes over the Fireblocks\n * key material and provisions Dynamic WaaS wallet accounts for every supported\n * chain. Because it is not per-chain, this resolves a single WaaS wallet provider\n * (any registered chain) and delegates the takeover to it.\n *\n * @param params.deviceId - The Fireblocks NCW device id being migrated.\n * @param params.jwt - The Fireblocks-issued JWT authorizing the takeover.\n * @param params.storage - The serialized Fireblocks NCW device storage.\n * @param params.password - The password that encrypted the legacy device storage.\n * @param params.expectedAddresses - Required per-chain expected address; its keys are the chains migration runs on, and each imported address is verified against it.\n * @param [params.coinTypes] - Optional SLIP-0044 coin types per chain name.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise resolving to the per-chain migration results.\n * @notInstrumented\n */\nexport const migrateFromFireblocks = async (\n {\n coinTypes,\n deviceId,\n expectedAddresses,\n jwt,\n password,\n storage,\n }: MigrateFromFireblocksParams,\n client = getDefaultClient()\n): Promise<MigrateFromFireblocksResponse> => {\n const providers = getWalletProviders(client);\n\n if (providers.length === 0) {\n throw new NoWalletProviderFoundError({\n walletProviderKey: DYNAMIC_WAAS_METADATA.displayName,\n });\n }\n\n // Migration is cross-chain, so any registered WaaS provider can drive the\n // takeover. Resolve the first one rather than iterating per chain.\n const waasProvider = providers.find(isWaasWalletProvider);\n\n if (!waasProvider) {\n throw new NotWaasWalletProviderError({\n walletProviderKey: providers[0].key,\n });\n }\n\n const result = await waasProvider.migrateFromFireblocks({\n coinTypes,\n deviceId,\n expectedAddresses,\n jwt,\n password,\n storage,\n });\n\n await refreshAuth(client);\n\n return result;\n};\n"],"mappings":";;;;AAMA,IAAa,6BAAb,cAAgD,UAAU;CACxD,YAAY,EAAE,qBAAuD;AACnE,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,mBAAmB,kBAAkB;GACpD,CAAC;;;;;;;;;;;;;ACqCN,IAAa,4BAAb,cAA+C,UAAU;CACvD;CACA;CACA;CACA;CACA;CAEA,YAAY,EACV,UACA,aACA,OACA,MACA,SACA,WACA,iBACA,iBACkC;AAClC,QAAM;GACJ;GACA;GACA,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,WAAW;AAChB,OAAK,cAAc;AACnB,OAAK,YAAY;AACjB,OAAK,kBAAkB;AACvB,OAAK,gBAAgB;;;;;;AC1EzB,IAAa,4BAAb,cAA+C,UAAU;CACvD,YAAY,EAAE,iBAAkD;AAC9D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,kBAAkB,cAAc;GAC/C,CAAC;;;;;;;ACFN,MAAa,0CACX,EAAE,iBACF,WACuB;CACvB,MAAM,iBAAiB,mCACrB,EAAE,eAAe,EACjB,OACD;AAED,KAAI,CAAC,qBAAqB,eAAe,CACvC,OAAM,IAAI,0BAA0B,EAClC,eAAe,cAAc,SAC9B,CAAC;AAGJ,QAAO;;;;;;;;;;;;;;;ACZT,MAAa,wBAAwB,SAAS,kBAAkB,KAAc;CAC5E,MAAM,kBAAkB,OAAO;AAE/B,eAAc,iBAAiB,qCAAqC;AAQpE,QAN+B,gBAAgB,IAAI,iBAGzB,yBACxB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;ACmC9B,MAAa,wBAAwB,OACnC,EACE,WACA,UACA,mBACA,KACA,UACA,WAEF,SAAS,kBAAkB,KACgB;CAC3C,MAAM,YAAY,mBAAmB,OAAO;AAE5C,KAAI,UAAU,WAAW,EACvB,OAAM,IAAI,2BAA2B,EACnC,mBAAmB,sBAAsB,aAC1C,CAAC;CAKJ,MAAM,eAAe,UAAU,KAAK,qBAAqB;AAEzD,KAAI,CAAC,aACH,OAAM,IAAI,2BAA2B,EACnC,mBAAmB,UAAU,GAAG,KACjC,CAAC;CAGJ,MAAM,SAAS,MAAM,aAAa,sBAAsB;EACtD;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,OAAMA,sBAAY,OAAO;AAEzB,QAAO"}
|
|
1
|
+
{"version":3,"file":"migrateFromFireblocks-BMO3u6rO.esm.js","names":["refreshAuth"],"sources":["../src/errors/NotWaasWalletProviderError.ts","../src/errors/TransactionBroadcastError.ts","../src/errors/NotWaasWalletAccountError.ts","../src/modules/waas/getWaasWalletProviderFromWalletAccount/getWaasWalletProviderFromWalletAccount.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts","../src/modules/waas/migrateFromFireblocks/migrateFromFireblocks.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NotWaasWalletProviderErrorParams = {\n walletProviderKey: string;\n};\n\nexport class NotWaasWalletProviderError extends BaseError {\n constructor({ walletProviderKey }: NotWaasWalletProviderErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_provider_error',\n docsUrl: null,\n name: 'NotWaasWalletProviderError',\n shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`,\n });\n }\n}\n","import { BaseError } from './base';\n\n/**\n * Error codes that identify why a v3 WaaS transaction broadcast was rejected.\n *\n * @example 'BROADCAST_REJECTED'\n * @see transactionBroadcastErrorMapper\n * @see broadcastWaasTransaction\n */\nexport type TransactionBroadcastErrorCode =\n | 'BROADCAST_IDEMPOTENCY_CONFLICT'\n | 'BROADCAST_OUTCOME_UNKNOWN'\n | 'BROADCAST_RATE_LIMITED'\n | 'BROADCAST_REJECTED'\n | 'BROADCAST_REQUIRES_RESIGN'\n | 'BROADCAST_WALLET_INELIGIBLE'\n | 'INVALID_SIGNED_TRANSACTION'\n | 'NETWORK_NOT_ENABLED'\n | 'SIGNED_TRANSACTION_WALLET_MISMATCH'\n | 'UNSUPPORTED_WAAS_CHAIN';\n\n/**\n * States describing whether the signed transaction reached the chain.\n *\n * @example 'not_submitted'\n * @see TransactionBroadcastError\n * @see broadcastWaasTransaction\n */\nexport type TransactionBroadcastSubmissionState =\n | 'not_submitted'\n | 'requires_resign'\n | 'unknown';\n\ntype TransactionBroadcastErrorParams = {\n attempts: number;\n broadcastId: string;\n cause: Error;\n code: TransactionBroadcastErrorCode;\n message: string;\n retryable: boolean;\n submissionState: TransactionBroadcastSubmissionState;\n transactionId?: string;\n};\n\n/**\n * Error raised when Redcoast fails to submit a v3 WaaS transaction after the SDK signed it.\n *\n * @example new TransactionBroadcastError({ attempts: 1, broadcastId: 'broadcast-id', cause, code: 'BROADCAST_REJECTED', message: 'rejected', retryable: false, submissionState: 'not_submitted', transactionId: undefined })\n * @see transactionBroadcastErrorMapper\n * @see broadcastWaasTransaction\n */\nexport class TransactionBroadcastError extends BaseError {\n attempts: number;\n broadcastId: string;\n retryable: boolean;\n submissionState: TransactionBroadcastSubmissionState;\n transactionId: string | undefined;\n\n constructor({\n attempts,\n broadcastId,\n cause,\n code,\n message,\n retryable,\n submissionState,\n transactionId,\n }: TransactionBroadcastErrorParams) {\n super({\n cause,\n code,\n docsUrl: null,\n name: 'TransactionBroadcastError',\n shortMessage: message,\n });\n\n this.attempts = attempts;\n this.broadcastId = broadcastId;\n this.retryable = retryable;\n this.submissionState = submissionState;\n this.transactionId = transactionId;\n }\n}\n","import { BaseError } from './base';\n\ntype NotWaasWalletAccountErrorParams = {\n walletAddress: string;\n};\n\nexport class NotWaasWalletAccountError extends BaseError {\n constructor({ walletAddress }: NotWaasWalletAccountErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_account_error',\n docsUrl: null,\n name: 'NotWaasWalletAccountError',\n shortMessage: `Wallet account ${walletAddress} is not a Dynamic WaaS wallet account`,\n });\n }\n}\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NotWaasWalletAccountError } from '../../../errors/NotWaasWalletAccountError';\nimport { getWalletProviderFromWalletAccount } from '../../wallets/utils/getWalletProviderFromWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport type { WaasWalletProvider } from '../waas.types';\n\ntype GetWalletProviderFromWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/** @notInstrumented */\nexport const getWaasWalletProviderFromWalletAccount = (\n { walletAccount }: GetWalletProviderFromWalletAccountParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletAccountError({\n walletAddress: walletAccount.address,\n });\n }\n\n return walletProvider;\n};\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n * @notInstrumented\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()): boolean => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n","import type { MigrateFromFireblocksResponse } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport { NotWaasWalletProviderError } from '../../../errors/NotWaasWalletProviderError';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport { getWalletProviders } from '../../wallets/getWalletProviders';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\n\ntype MigrateFromFireblocksParams = {\n /**\n * Optional SLIP-0044 coin types per chain name for BIP44 derivation off the\n * Fireblocks takeover xprv (e.g. `{ EVM: 1 }` for Sepolia).\n */\n coinTypes?: Record<string, number>;\n /**\n * The Fireblocks NCW device id whose key material is being migrated.\n */\n deviceId: string;\n /**\n * Required per-chain expected wallet address (the address Fireblocks held). Its\n * keys are the chains migration runs on, and the migration iframe verifies each\n * imported Dynamic address matches the value, so a wrong derivation fails loudly\n * instead of producing an unusable wallet.\n */\n expectedAddresses: Record<string, string>;\n /**\n * The Fireblocks-issued JWT authorizing the takeover.\n */\n jwt: string;\n /**\n * The password that encrypted the legacy Fireblocks NCW device storage.\n */\n password: string;\n /**\n * The serialized Fireblocks NCW device storage (the local key share backup).\n */\n storage: Record<string, string>;\n};\n\n/**\n * Migrates an existing Fireblocks NCW wallet into Dynamic's WaaS infrastructure.\n *\n * Migration is a single cross-chain operation: one call takes over the Fireblocks\n * key material and provisions Dynamic WaaS wallet accounts for every supported\n * chain. Because it is not per-chain, this resolves a single WaaS wallet provider\n * (any registered chain) and delegates the takeover to it.\n *\n * @param params.deviceId - The Fireblocks NCW device id being migrated.\n * @param params.jwt - The Fireblocks-issued JWT authorizing the takeover.\n * @param params.storage - The serialized Fireblocks NCW device storage.\n * @param params.password - The password that encrypted the legacy device storage.\n * @param params.expectedAddresses - Required per-chain expected address; its keys are the chains migration runs on, and each imported address is verified against it.\n * @param [params.coinTypes] - Optional SLIP-0044 coin types per chain name.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise resolving to the per-chain migration results.\n * @notInstrumented\n */\nexport const migrateFromFireblocks = async (\n {\n coinTypes,\n deviceId,\n expectedAddresses,\n jwt,\n password,\n storage,\n }: MigrateFromFireblocksParams,\n client = getDefaultClient()\n): Promise<MigrateFromFireblocksResponse> => {\n const providers = getWalletProviders(client);\n\n if (providers.length === 0) {\n throw new NoWalletProviderFoundError({\n walletProviderKey: DYNAMIC_WAAS_METADATA.displayName,\n });\n }\n\n // Migration is cross-chain, so any registered WaaS provider can drive the\n // takeover. Resolve the first one rather than iterating per chain.\n const waasProvider = providers.find(isWaasWalletProvider);\n\n if (!waasProvider) {\n throw new NotWaasWalletProviderError({\n walletProviderKey: providers[0].key,\n });\n }\n\n const result = await waasProvider.migrateFromFireblocks({\n coinTypes,\n deviceId,\n expectedAddresses,\n jwt,\n password,\n storage,\n });\n\n await refreshAuth(client);\n\n return result;\n};\n"],"mappings":";;;;AAMA,IAAa,6BAAb,cAAgD,UAAU;CACxD,YAAY,EAAE,qBAAuD;AACnE,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,mBAAmB,kBAAkB;GACpD,CAAC;;;;;;;;;;;;;ACqCN,IAAa,4BAAb,cAA+C,UAAU;CACvD;CACA;CACA;CACA;CACA;CAEA,YAAY,EACV,UACA,aACA,OACA,MACA,SACA,WACA,iBACA,iBACkC;AAClC,QAAM;GACJ;GACA;GACA,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,WAAW;AAChB,OAAK,cAAc;AACnB,OAAK,YAAY;AACjB,OAAK,kBAAkB;AACvB,OAAK,gBAAgB;;;;;;AC1EzB,IAAa,4BAAb,cAA+C,UAAU;CACvD,YAAY,EAAE,iBAAkD;AAC9D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,kBAAkB,cAAc;GAC/C,CAAC;;;;;;;ACFN,MAAa,0CACX,EAAE,iBACF,WACuB;CACvB,MAAM,iBAAiB,mCACrB,EAAE,eAAe,EACjB,OACD;AAED,KAAI,CAAC,qBAAqB,eAAe,CACvC,OAAM,IAAI,0BAA0B,EAClC,eAAe,cAAc,SAC9B,CAAC;AAGJ,QAAO;;;;;;;;;;;;;;;ACZT,MAAa,wBAAwB,SAAS,kBAAkB,KAAc;CAC5E,MAAM,kBAAkB,OAAO;AAE/B,eAAc,iBAAiB,qCAAqC;AAQpE,QAN+B,gBAAgB,IAAI,iBAGzB,yBACxB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;ACmC9B,MAAa,wBAAwB,OACnC,EACE,WACA,UACA,mBACA,KACA,UACA,WAEF,SAAS,kBAAkB,KACgB;CAC3C,MAAM,YAAY,mBAAmB,OAAO;AAE5C,KAAI,UAAU,WAAW,EACvB,OAAM,IAAI,2BAA2B,EACnC,mBAAmB,sBAAsB,aAC1C,CAAC;CAKJ,MAAM,eAAe,UAAU,KAAK,qBAAqB;AAEzD,KAAI,CAAC,aACH,OAAM,IAAI,2BAA2B,EACnC,mBAAmB,UAAU,GAAG,KACjC,CAAC;CAGJ,MAAM,SAAS,MAAM,aAAa,sBAAsB;EACtD;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,OAAMA,sBAAY,OAAO;AAEzB,QAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_logoutWithReason = require('./logoutWithReason-
|
|
1
|
+
const require_logoutWithReason = require('./logoutWithReason-C_T7KddM.cjs');
|
|
2
2
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
3
3
|
|
|
4
4
|
//#region src/errors/NotWaasWalletProviderError.ts
|
|
@@ -160,4 +160,4 @@ Object.defineProperty(exports, 'migrateFromFireblocks', {
|
|
|
160
160
|
return migrateFromFireblocks;
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
|
-
//# sourceMappingURL=migrateFromFireblocks-
|
|
163
|
+
//# sourceMappingURL=migrateFromFireblocks-C9Kuke5V.cjs.map
|
package/dist/{migrateFromFireblocks-CqIpxGRS.cjs.map → migrateFromFireblocks-C9Kuke5V.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrateFromFireblocks-CqIpxGRS.cjs","names":["BaseError","BaseError","BaseError","getWalletProviderFromWalletAccount","isWaasWalletProvider","getDefaultClient","EmbeddedWalletVersionEnum","getDefaultClient","getWalletProviders","NoWalletProviderFoundError","DYNAMIC_WAAS_METADATA","isWaasWalletProvider","refreshAuth"],"sources":["../src/errors/NotWaasWalletProviderError.ts","../src/errors/TransactionBroadcastError.ts","../src/errors/NotWaasWalletAccountError.ts","../src/modules/waas/getWaasWalletProviderFromWalletAccount/getWaasWalletProviderFromWalletAccount.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts","../src/modules/waas/migrateFromFireblocks/migrateFromFireblocks.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NotWaasWalletProviderErrorParams = {\n walletProviderKey: string;\n};\n\nexport class NotWaasWalletProviderError extends BaseError {\n constructor({ walletProviderKey }: NotWaasWalletProviderErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_provider_error',\n docsUrl: null,\n name: 'NotWaasWalletProviderError',\n shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`,\n });\n }\n}\n","import { BaseError } from './base';\n\n/**\n * Error codes that identify why a v3 WaaS transaction broadcast was rejected.\n *\n * @example 'BROADCAST_REJECTED'\n * @see transactionBroadcastErrorMapper\n * @see broadcastWaasTransaction\n */\nexport type TransactionBroadcastErrorCode =\n | 'BROADCAST_IDEMPOTENCY_CONFLICT'\n | 'BROADCAST_OUTCOME_UNKNOWN'\n | 'BROADCAST_RATE_LIMITED'\n | 'BROADCAST_REJECTED'\n | 'BROADCAST_REQUIRES_RESIGN'\n | 'BROADCAST_WALLET_INELIGIBLE'\n | 'INVALID_SIGNED_TRANSACTION'\n | 'NETWORK_NOT_ENABLED'\n | 'SIGNED_TRANSACTION_WALLET_MISMATCH'\n | 'UNSUPPORTED_WAAS_CHAIN';\n\n/**\n * States describing whether the signed transaction reached the chain.\n *\n * @example 'not_submitted'\n * @see TransactionBroadcastError\n * @see broadcastWaasTransaction\n */\nexport type TransactionBroadcastSubmissionState =\n | 'not_submitted'\n | 'requires_resign'\n | 'unknown';\n\ntype TransactionBroadcastErrorParams = {\n attempts: number;\n broadcastId: string;\n cause: Error;\n code: TransactionBroadcastErrorCode;\n message: string;\n retryable: boolean;\n submissionState: TransactionBroadcastSubmissionState;\n transactionId?: string;\n};\n\n/**\n * Error raised when Redcoast fails to submit a v3 WaaS transaction after the SDK signed it.\n *\n * @example new TransactionBroadcastError({ attempts: 1, broadcastId: 'broadcast-id', cause, code: 'BROADCAST_REJECTED', message: 'rejected', retryable: false, submissionState: 'not_submitted', transactionId: undefined })\n * @see transactionBroadcastErrorMapper\n * @see broadcastWaasTransaction\n */\nexport class TransactionBroadcastError extends BaseError {\n attempts: number;\n broadcastId: string;\n retryable: boolean;\n submissionState: TransactionBroadcastSubmissionState;\n transactionId: string | undefined;\n\n constructor({\n attempts,\n broadcastId,\n cause,\n code,\n message,\n retryable,\n submissionState,\n transactionId,\n }: TransactionBroadcastErrorParams) {\n super({\n cause,\n code,\n docsUrl: null,\n name: 'TransactionBroadcastError',\n shortMessage: message,\n });\n\n this.attempts = attempts;\n this.broadcastId = broadcastId;\n this.retryable = retryable;\n this.submissionState = submissionState;\n this.transactionId = transactionId;\n }\n}\n","import { BaseError } from './base';\n\ntype NotWaasWalletAccountErrorParams = {\n walletAddress: string;\n};\n\nexport class NotWaasWalletAccountError extends BaseError {\n constructor({ walletAddress }: NotWaasWalletAccountErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_account_error',\n docsUrl: null,\n name: 'NotWaasWalletAccountError',\n shortMessage: `Wallet account ${walletAddress} is not a Dynamic WaaS wallet account`,\n });\n }\n}\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NotWaasWalletAccountError } from '../../../errors/NotWaasWalletAccountError';\nimport { getWalletProviderFromWalletAccount } from '../../wallets/utils/getWalletProviderFromWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport type { WaasWalletProvider } from '../waas.types';\n\ntype GetWalletProviderFromWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/** @notInstrumented */\nexport const getWaasWalletProviderFromWalletAccount = (\n { walletAccount }: GetWalletProviderFromWalletAccountParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletAccountError({\n walletAddress: walletAccount.address,\n });\n }\n\n return walletProvider;\n};\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n * @notInstrumented\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()): boolean => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n","import type { MigrateFromFireblocksResponse } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport { NotWaasWalletProviderError } from '../../../errors/NotWaasWalletProviderError';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport { getWalletProviders } from '../../wallets/getWalletProviders';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\n\ntype MigrateFromFireblocksParams = {\n /**\n * Optional SLIP-0044 coin types per chain name for BIP44 derivation off the\n * Fireblocks takeover xprv (e.g. `{ EVM: 1 }` for Sepolia).\n */\n coinTypes?: Record<string, number>;\n /**\n * The Fireblocks NCW device id whose key material is being migrated.\n */\n deviceId: string;\n /**\n * Required per-chain expected wallet address (the address Fireblocks held). Its\n * keys are the chains migration runs on, and the migration iframe verifies each\n * imported Dynamic address matches the value, so a wrong derivation fails loudly\n * instead of producing an unusable wallet.\n */\n expectedAddresses: Record<string, string>;\n /**\n * The Fireblocks-issued JWT authorizing the takeover.\n */\n jwt: string;\n /**\n * The password that encrypted the legacy Fireblocks NCW device storage.\n */\n password: string;\n /**\n * The serialized Fireblocks NCW device storage (the local key share backup).\n */\n storage: Record<string, string>;\n};\n\n/**\n * Migrates an existing Fireblocks NCW wallet into Dynamic's WaaS infrastructure.\n *\n * Migration is a single cross-chain operation: one call takes over the Fireblocks\n * key material and provisions Dynamic WaaS wallet accounts for every supported\n * chain. Because it is not per-chain, this resolves a single WaaS wallet provider\n * (any registered chain) and delegates the takeover to it.\n *\n * @param params.deviceId - The Fireblocks NCW device id being migrated.\n * @param params.jwt - The Fireblocks-issued JWT authorizing the takeover.\n * @param params.storage - The serialized Fireblocks NCW device storage.\n * @param params.password - The password that encrypted the legacy device storage.\n * @param params.expectedAddresses - Required per-chain expected address; its keys are the chains migration runs on, and each imported address is verified against it.\n * @param [params.coinTypes] - Optional SLIP-0044 coin types per chain name.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise resolving to the per-chain migration results.\n * @notInstrumented\n */\nexport const migrateFromFireblocks = async (\n {\n coinTypes,\n deviceId,\n expectedAddresses,\n jwt,\n password,\n storage,\n }: MigrateFromFireblocksParams,\n client = getDefaultClient()\n): Promise<MigrateFromFireblocksResponse> => {\n const providers = getWalletProviders(client);\n\n if (providers.length === 0) {\n throw new NoWalletProviderFoundError({\n walletProviderKey: DYNAMIC_WAAS_METADATA.displayName,\n });\n }\n\n // Migration is cross-chain, so any registered WaaS provider can drive the\n // takeover. Resolve the first one rather than iterating per chain.\n const waasProvider = providers.find(isWaasWalletProvider);\n\n if (!waasProvider) {\n throw new NotWaasWalletProviderError({\n walletProviderKey: providers[0].key,\n });\n }\n\n const result = await waasProvider.migrateFromFireblocks({\n coinTypes,\n deviceId,\n expectedAddresses,\n jwt,\n password,\n storage,\n });\n\n await refreshAuth(client);\n\n return result;\n};\n"],"mappings":";;;;AAMA,IAAa,6BAAb,cAAgDA,mCAAU;CACxD,YAAY,EAAE,qBAAuD;AACnE,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,mBAAmB,kBAAkB;GACpD,CAAC;;;;;;;;;;;;;ACqCN,IAAa,4BAAb,cAA+CC,mCAAU;CACvD;CACA;CACA;CACA;CACA;CAEA,YAAY,EACV,UACA,aACA,OACA,MACA,SACA,WACA,iBACA,iBACkC;AAClC,QAAM;GACJ;GACA;GACA,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,WAAW;AAChB,OAAK,cAAc;AACnB,OAAK,YAAY;AACjB,OAAK,kBAAkB;AACvB,OAAK,gBAAgB;;;;;;AC1EzB,IAAa,4BAAb,cAA+CC,mCAAU;CACvD,YAAY,EAAE,iBAAkD;AAC9D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,kBAAkB,cAAc;GAC/C,CAAC;;;;;;;ACFN,MAAa,0CACX,EAAE,iBACF,WACuB;CACvB,MAAM,iBAAiBC,4DACrB,EAAE,eAAe,EACjB,OACD;AAED,KAAI,CAACC,8CAAqB,eAAe,CACvC,OAAM,IAAI,0BAA0B,EAClC,eAAe,cAAc,SAC9B,CAAC;AAGJ,QAAO;;;;;;;;;;;;;;;ACZT,MAAa,wBAAwB,SAASC,2CAAkB,KAAc;CAC5E,MAAM,kBAAkB,OAAO;AAE/B,wCAAc,iBAAiB,qCAAqC;AAQpE,QAN+B,gBAAgB,IAAI,iBAGzB,yBACxBC,qDAA0B;;;;;;;;;;;;;;;;;;;;;;;ACmC9B,MAAa,wBAAwB,OACnC,EACE,WACA,UACA,mBACA,KACA,UACA,WAEF,SAASC,2CAAkB,KACgB;CAC3C,MAAM,YAAYC,4CAAmB,OAAO;AAE5C,KAAI,UAAU,WAAW,EACvB,OAAM,IAAIC,oDAA2B,EACnC,mBAAmBC,+CAAsB,aAC1C,CAAC;CAKJ,MAAM,eAAe,UAAU,KAAKC,8CAAqB;AAEzD,KAAI,CAAC,aACH,OAAM,IAAI,2BAA2B,EACnC,mBAAmB,UAAU,GAAG,KACjC,CAAC;CAGJ,MAAM,SAAS,MAAM,aAAa,sBAAsB;EACtD;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,OAAMC,+CAAY,OAAO;AAEzB,QAAO"}
|
|
1
|
+
{"version":3,"file":"migrateFromFireblocks-C9Kuke5V.cjs","names":["BaseError","BaseError","BaseError","getWalletProviderFromWalletAccount","isWaasWalletProvider","getDefaultClient","EmbeddedWalletVersionEnum","getDefaultClient","getWalletProviders","NoWalletProviderFoundError","DYNAMIC_WAAS_METADATA","isWaasWalletProvider","refreshAuth"],"sources":["../src/errors/NotWaasWalletProviderError.ts","../src/errors/TransactionBroadcastError.ts","../src/errors/NotWaasWalletAccountError.ts","../src/modules/waas/getWaasWalletProviderFromWalletAccount/getWaasWalletProviderFromWalletAccount.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts","../src/modules/waas/migrateFromFireblocks/migrateFromFireblocks.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NotWaasWalletProviderErrorParams = {\n walletProviderKey: string;\n};\n\nexport class NotWaasWalletProviderError extends BaseError {\n constructor({ walletProviderKey }: NotWaasWalletProviderErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_provider_error',\n docsUrl: null,\n name: 'NotWaasWalletProviderError',\n shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`,\n });\n }\n}\n","import { BaseError } from './base';\n\n/**\n * Error codes that identify why a v3 WaaS transaction broadcast was rejected.\n *\n * @example 'BROADCAST_REJECTED'\n * @see transactionBroadcastErrorMapper\n * @see broadcastWaasTransaction\n */\nexport type TransactionBroadcastErrorCode =\n | 'BROADCAST_IDEMPOTENCY_CONFLICT'\n | 'BROADCAST_OUTCOME_UNKNOWN'\n | 'BROADCAST_RATE_LIMITED'\n | 'BROADCAST_REJECTED'\n | 'BROADCAST_REQUIRES_RESIGN'\n | 'BROADCAST_WALLET_INELIGIBLE'\n | 'INVALID_SIGNED_TRANSACTION'\n | 'NETWORK_NOT_ENABLED'\n | 'SIGNED_TRANSACTION_WALLET_MISMATCH'\n | 'UNSUPPORTED_WAAS_CHAIN';\n\n/**\n * States describing whether the signed transaction reached the chain.\n *\n * @example 'not_submitted'\n * @see TransactionBroadcastError\n * @see broadcastWaasTransaction\n */\nexport type TransactionBroadcastSubmissionState =\n | 'not_submitted'\n | 'requires_resign'\n | 'unknown';\n\ntype TransactionBroadcastErrorParams = {\n attempts: number;\n broadcastId: string;\n cause: Error;\n code: TransactionBroadcastErrorCode;\n message: string;\n retryable: boolean;\n submissionState: TransactionBroadcastSubmissionState;\n transactionId?: string;\n};\n\n/**\n * Error raised when Redcoast fails to submit a v3 WaaS transaction after the SDK signed it.\n *\n * @example new TransactionBroadcastError({ attempts: 1, broadcastId: 'broadcast-id', cause, code: 'BROADCAST_REJECTED', message: 'rejected', retryable: false, submissionState: 'not_submitted', transactionId: undefined })\n * @see transactionBroadcastErrorMapper\n * @see broadcastWaasTransaction\n */\nexport class TransactionBroadcastError extends BaseError {\n attempts: number;\n broadcastId: string;\n retryable: boolean;\n submissionState: TransactionBroadcastSubmissionState;\n transactionId: string | undefined;\n\n constructor({\n attempts,\n broadcastId,\n cause,\n code,\n message,\n retryable,\n submissionState,\n transactionId,\n }: TransactionBroadcastErrorParams) {\n super({\n cause,\n code,\n docsUrl: null,\n name: 'TransactionBroadcastError',\n shortMessage: message,\n });\n\n this.attempts = attempts;\n this.broadcastId = broadcastId;\n this.retryable = retryable;\n this.submissionState = submissionState;\n this.transactionId = transactionId;\n }\n}\n","import { BaseError } from './base';\n\ntype NotWaasWalletAccountErrorParams = {\n walletAddress: string;\n};\n\nexport class NotWaasWalletAccountError extends BaseError {\n constructor({ walletAddress }: NotWaasWalletAccountErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_account_error',\n docsUrl: null,\n name: 'NotWaasWalletAccountError',\n shortMessage: `Wallet account ${walletAddress} is not a Dynamic WaaS wallet account`,\n });\n }\n}\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NotWaasWalletAccountError } from '../../../errors/NotWaasWalletAccountError';\nimport { getWalletProviderFromWalletAccount } from '../../wallets/utils/getWalletProviderFromWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport type { WaasWalletProvider } from '../waas.types';\n\ntype GetWalletProviderFromWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/** @notInstrumented */\nexport const getWaasWalletProviderFromWalletAccount = (\n { walletAccount }: GetWalletProviderFromWalletAccountParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletAccountError({\n walletAddress: walletAccount.address,\n });\n }\n\n return walletProvider;\n};\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n * @notInstrumented\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()): boolean => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n","import type { MigrateFromFireblocksResponse } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport { NotWaasWalletProviderError } from '../../../errors/NotWaasWalletProviderError';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport { getWalletProviders } from '../../wallets/getWalletProviders';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\n\ntype MigrateFromFireblocksParams = {\n /**\n * Optional SLIP-0044 coin types per chain name for BIP44 derivation off the\n * Fireblocks takeover xprv (e.g. `{ EVM: 1 }` for Sepolia).\n */\n coinTypes?: Record<string, number>;\n /**\n * The Fireblocks NCW device id whose key material is being migrated.\n */\n deviceId: string;\n /**\n * Required per-chain expected wallet address (the address Fireblocks held). Its\n * keys are the chains migration runs on, and the migration iframe verifies each\n * imported Dynamic address matches the value, so a wrong derivation fails loudly\n * instead of producing an unusable wallet.\n */\n expectedAddresses: Record<string, string>;\n /**\n * The Fireblocks-issued JWT authorizing the takeover.\n */\n jwt: string;\n /**\n * The password that encrypted the legacy Fireblocks NCW device storage.\n */\n password: string;\n /**\n * The serialized Fireblocks NCW device storage (the local key share backup).\n */\n storage: Record<string, string>;\n};\n\n/**\n * Migrates an existing Fireblocks NCW wallet into Dynamic's WaaS infrastructure.\n *\n * Migration is a single cross-chain operation: one call takes over the Fireblocks\n * key material and provisions Dynamic WaaS wallet accounts for every supported\n * chain. Because it is not per-chain, this resolves a single WaaS wallet provider\n * (any registered chain) and delegates the takeover to it.\n *\n * @param params.deviceId - The Fireblocks NCW device id being migrated.\n * @param params.jwt - The Fireblocks-issued JWT authorizing the takeover.\n * @param params.storage - The serialized Fireblocks NCW device storage.\n * @param params.password - The password that encrypted the legacy device storage.\n * @param params.expectedAddresses - Required per-chain expected address; its keys are the chains migration runs on, and each imported address is verified against it.\n * @param [params.coinTypes] - Optional SLIP-0044 coin types per chain name.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise resolving to the per-chain migration results.\n * @notInstrumented\n */\nexport const migrateFromFireblocks = async (\n {\n coinTypes,\n deviceId,\n expectedAddresses,\n jwt,\n password,\n storage,\n }: MigrateFromFireblocksParams,\n client = getDefaultClient()\n): Promise<MigrateFromFireblocksResponse> => {\n const providers = getWalletProviders(client);\n\n if (providers.length === 0) {\n throw new NoWalletProviderFoundError({\n walletProviderKey: DYNAMIC_WAAS_METADATA.displayName,\n });\n }\n\n // Migration is cross-chain, so any registered WaaS provider can drive the\n // takeover. Resolve the first one rather than iterating per chain.\n const waasProvider = providers.find(isWaasWalletProvider);\n\n if (!waasProvider) {\n throw new NotWaasWalletProviderError({\n walletProviderKey: providers[0].key,\n });\n }\n\n const result = await waasProvider.migrateFromFireblocks({\n coinTypes,\n deviceId,\n expectedAddresses,\n jwt,\n password,\n storage,\n });\n\n await refreshAuth(client);\n\n return result;\n};\n"],"mappings":";;;;AAMA,IAAa,6BAAb,cAAgDA,mCAAU;CACxD,YAAY,EAAE,qBAAuD;AACnE,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,mBAAmB,kBAAkB;GACpD,CAAC;;;;;;;;;;;;;ACqCN,IAAa,4BAAb,cAA+CC,mCAAU;CACvD;CACA;CACA;CACA;CACA;CAEA,YAAY,EACV,UACA,aACA,OACA,MACA,SACA,WACA,iBACA,iBACkC;AAClC,QAAM;GACJ;GACA;GACA,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,WAAW;AAChB,OAAK,cAAc;AACnB,OAAK,YAAY;AACjB,OAAK,kBAAkB;AACvB,OAAK,gBAAgB;;;;;;AC1EzB,IAAa,4BAAb,cAA+CC,mCAAU;CACvD,YAAY,EAAE,iBAAkD;AAC9D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,kBAAkB,cAAc;GAC/C,CAAC;;;;;;;ACFN,MAAa,0CACX,EAAE,iBACF,WACuB;CACvB,MAAM,iBAAiBC,4DACrB,EAAE,eAAe,EACjB,OACD;AAED,KAAI,CAACC,8CAAqB,eAAe,CACvC,OAAM,IAAI,0BAA0B,EAClC,eAAe,cAAc,SAC9B,CAAC;AAGJ,QAAO;;;;;;;;;;;;;;;ACZT,MAAa,wBAAwB,SAASC,2CAAkB,KAAc;CAC5E,MAAM,kBAAkB,OAAO;AAE/B,wCAAc,iBAAiB,qCAAqC;AAQpE,QAN+B,gBAAgB,IAAI,iBAGzB,yBACxBC,qDAA0B;;;;;;;;;;;;;;;;;;;;;;;ACmC9B,MAAa,wBAAwB,OACnC,EACE,WACA,UACA,mBACA,KACA,UACA,WAEF,SAASC,2CAAkB,KACgB;CAC3C,MAAM,YAAYC,4CAAmB,OAAO;AAE5C,KAAI,UAAU,WAAW,EACvB,OAAM,IAAIC,oDAA2B,EACnC,mBAAmBC,+CAAsB,aAC1C,CAAC;CAKJ,MAAM,eAAe,UAAU,KAAKC,8CAAqB;AAEzD,KAAI,CAAC,aACH,OAAM,IAAI,2BAA2B,EACnC,mBAAmB,UAAU,GAAG,KACjC,CAAC;CAGJ,MAAM,SAAS,MAAM,aAAa,sBAAsB;EACtD;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,OAAMC,+CAAY,OAAO;AAEzB,QAAO"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { St as BaseError, T as getWalletProviders, i as __refreshAuth_wrapped, n as NoWalletProviderFoundError, pt as assertDefined, t as getWalletProviderFromWalletAccount, vt as getDefaultClient, w as DYNAMIC_WAAS_METADATA, x as isWaasWalletProvider } from "./apiClient-
|
|
1
|
+
import { St as BaseError, T as getWalletProviders, i as __refreshAuth_wrapped, n as NoWalletProviderFoundError, pt as assertDefined, t as getWalletProviderFromWalletAccount, vt as getDefaultClient, w as DYNAMIC_WAAS_METADATA, x as isWaasWalletProvider } from "./apiClient-d2qJyIvx.native.esm.js";
|
|
2
2
|
import { EmbeddedWalletVersionEnum } from "@dynamic-labs/sdk-api-core";
|
|
3
3
|
|
|
4
4
|
//#region src/errors/NotWaasWalletProviderError.ts
|
|
@@ -125,4 +125,4 @@ const migrateFromFireblocks = async ({ coinTypes, deviceId, expectedAddresses, j
|
|
|
125
125
|
|
|
126
126
|
//#endregion
|
|
127
127
|
export { TransactionBroadcastError as a, NotWaasWalletAccountError as i, isDynamicWaasEnabled as n, NotWaasWalletProviderError as o, getWaasWalletProviderFromWalletAccount as r, migrateFromFireblocks as t };
|
|
128
|
-
//# sourceMappingURL=migrateFromFireblocks-
|
|
128
|
+
//# sourceMappingURL=migrateFromFireblocks-DJt9bktR.native.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrateFromFireblocks-DnQsGmIW.native.esm.js","names":["refreshAuth"],"sources":["../src/errors/NotWaasWalletProviderError.ts","../src/errors/TransactionBroadcastError.ts","../src/errors/NotWaasWalletAccountError.ts","../src/modules/waas/getWaasWalletProviderFromWalletAccount/getWaasWalletProviderFromWalletAccount.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts","../src/modules/waas/migrateFromFireblocks/migrateFromFireblocks.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NotWaasWalletProviderErrorParams = {\n walletProviderKey: string;\n};\n\nexport class NotWaasWalletProviderError extends BaseError {\n constructor({ walletProviderKey }: NotWaasWalletProviderErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_provider_error',\n docsUrl: null,\n name: 'NotWaasWalletProviderError',\n shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`,\n });\n }\n}\n","import { BaseError } from './base';\n\n/**\n * Error codes that identify why a v3 WaaS transaction broadcast was rejected.\n *\n * @example 'BROADCAST_REJECTED'\n * @see transactionBroadcastErrorMapper\n * @see broadcastWaasTransaction\n */\nexport type TransactionBroadcastErrorCode =\n | 'BROADCAST_IDEMPOTENCY_CONFLICT'\n | 'BROADCAST_OUTCOME_UNKNOWN'\n | 'BROADCAST_RATE_LIMITED'\n | 'BROADCAST_REJECTED'\n | 'BROADCAST_REQUIRES_RESIGN'\n | 'BROADCAST_WALLET_INELIGIBLE'\n | 'INVALID_SIGNED_TRANSACTION'\n | 'NETWORK_NOT_ENABLED'\n | 'SIGNED_TRANSACTION_WALLET_MISMATCH'\n | 'UNSUPPORTED_WAAS_CHAIN';\n\n/**\n * States describing whether the signed transaction reached the chain.\n *\n * @example 'not_submitted'\n * @see TransactionBroadcastError\n * @see broadcastWaasTransaction\n */\nexport type TransactionBroadcastSubmissionState =\n | 'not_submitted'\n | 'requires_resign'\n | 'unknown';\n\ntype TransactionBroadcastErrorParams = {\n attempts: number;\n broadcastId: string;\n cause: Error;\n code: TransactionBroadcastErrorCode;\n message: string;\n retryable: boolean;\n submissionState: TransactionBroadcastSubmissionState;\n transactionId?: string;\n};\n\n/**\n * Error raised when Redcoast fails to submit a v3 WaaS transaction after the SDK signed it.\n *\n * @example new TransactionBroadcastError({ attempts: 1, broadcastId: 'broadcast-id', cause, code: 'BROADCAST_REJECTED', message: 'rejected', retryable: false, submissionState: 'not_submitted', transactionId: undefined })\n * @see transactionBroadcastErrorMapper\n * @see broadcastWaasTransaction\n */\nexport class TransactionBroadcastError extends BaseError {\n attempts: number;\n broadcastId: string;\n retryable: boolean;\n submissionState: TransactionBroadcastSubmissionState;\n transactionId: string | undefined;\n\n constructor({\n attempts,\n broadcastId,\n cause,\n code,\n message,\n retryable,\n submissionState,\n transactionId,\n }: TransactionBroadcastErrorParams) {\n super({\n cause,\n code,\n docsUrl: null,\n name: 'TransactionBroadcastError',\n shortMessage: message,\n });\n\n this.attempts = attempts;\n this.broadcastId = broadcastId;\n this.retryable = retryable;\n this.submissionState = submissionState;\n this.transactionId = transactionId;\n }\n}\n","import { BaseError } from './base';\n\ntype NotWaasWalletAccountErrorParams = {\n walletAddress: string;\n};\n\nexport class NotWaasWalletAccountError extends BaseError {\n constructor({ walletAddress }: NotWaasWalletAccountErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_account_error',\n docsUrl: null,\n name: 'NotWaasWalletAccountError',\n shortMessage: `Wallet account ${walletAddress} is not a Dynamic WaaS wallet account`,\n });\n }\n}\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NotWaasWalletAccountError } from '../../../errors/NotWaasWalletAccountError';\nimport { getWalletProviderFromWalletAccount } from '../../wallets/utils/getWalletProviderFromWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport type { WaasWalletProvider } from '../waas.types';\n\ntype GetWalletProviderFromWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/** @notInstrumented */\nexport const getWaasWalletProviderFromWalletAccount = (\n { walletAccount }: GetWalletProviderFromWalletAccountParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletAccountError({\n walletAddress: walletAccount.address,\n });\n }\n\n return walletProvider;\n};\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n * @notInstrumented\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()): boolean => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n","import type { MigrateFromFireblocksResponse } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport { NotWaasWalletProviderError } from '../../../errors/NotWaasWalletProviderError';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport { getWalletProviders } from '../../wallets/getWalletProviders';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\n\ntype MigrateFromFireblocksParams = {\n /**\n * Optional SLIP-0044 coin types per chain name for BIP44 derivation off the\n * Fireblocks takeover xprv (e.g. `{ EVM: 1 }` for Sepolia).\n */\n coinTypes?: Record<string, number>;\n /**\n * The Fireblocks NCW device id whose key material is being migrated.\n */\n deviceId: string;\n /**\n * Required per-chain expected wallet address (the address Fireblocks held). Its\n * keys are the chains migration runs on, and the migration iframe verifies each\n * imported Dynamic address matches the value, so a wrong derivation fails loudly\n * instead of producing an unusable wallet.\n */\n expectedAddresses: Record<string, string>;\n /**\n * The Fireblocks-issued JWT authorizing the takeover.\n */\n jwt: string;\n /**\n * The password that encrypted the legacy Fireblocks NCW device storage.\n */\n password: string;\n /**\n * The serialized Fireblocks NCW device storage (the local key share backup).\n */\n storage: Record<string, string>;\n};\n\n/**\n * Migrates an existing Fireblocks NCW wallet into Dynamic's WaaS infrastructure.\n *\n * Migration is a single cross-chain operation: one call takes over the Fireblocks\n * key material and provisions Dynamic WaaS wallet accounts for every supported\n * chain. Because it is not per-chain, this resolves a single WaaS wallet provider\n * (any registered chain) and delegates the takeover to it.\n *\n * @param params.deviceId - The Fireblocks NCW device id being migrated.\n * @param params.jwt - The Fireblocks-issued JWT authorizing the takeover.\n * @param params.storage - The serialized Fireblocks NCW device storage.\n * @param params.password - The password that encrypted the legacy device storage.\n * @param params.expectedAddresses - Required per-chain expected address; its keys are the chains migration runs on, and each imported address is verified against it.\n * @param [params.coinTypes] - Optional SLIP-0044 coin types per chain name.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise resolving to the per-chain migration results.\n * @notInstrumented\n */\nexport const migrateFromFireblocks = async (\n {\n coinTypes,\n deviceId,\n expectedAddresses,\n jwt,\n password,\n storage,\n }: MigrateFromFireblocksParams,\n client = getDefaultClient()\n): Promise<MigrateFromFireblocksResponse> => {\n const providers = getWalletProviders(client);\n\n if (providers.length === 0) {\n throw new NoWalletProviderFoundError({\n walletProviderKey: DYNAMIC_WAAS_METADATA.displayName,\n });\n }\n\n // Migration is cross-chain, so any registered WaaS provider can drive the\n // takeover. Resolve the first one rather than iterating per chain.\n const waasProvider = providers.find(isWaasWalletProvider);\n\n if (!waasProvider) {\n throw new NotWaasWalletProviderError({\n walletProviderKey: providers[0].key,\n });\n }\n\n const result = await waasProvider.migrateFromFireblocks({\n coinTypes,\n deviceId,\n expectedAddresses,\n jwt,\n password,\n storage,\n });\n\n await refreshAuth(client);\n\n return result;\n};\n"],"mappings":";;;;AAMA,IAAa,6BAAb,cAAgD,UAAU;CACxD,YAAY,EAAE,qBAAuD;AACnE,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,mBAAmB,kBAAkB;GACpD,CAAC;;;;;;;;;;;;;ACqCN,IAAa,4BAAb,cAA+C,UAAU;CACvD;CACA;CACA;CACA;CACA;CAEA,YAAY,EACV,UACA,aACA,OACA,MACA,SACA,WACA,iBACA,iBACkC;AAClC,QAAM;GACJ;GACA;GACA,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,WAAW;AAChB,OAAK,cAAc;AACnB,OAAK,YAAY;AACjB,OAAK,kBAAkB;AACvB,OAAK,gBAAgB;;;;;;AC1EzB,IAAa,4BAAb,cAA+C,UAAU;CACvD,YAAY,EAAE,iBAAkD;AAC9D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,kBAAkB,cAAc;GAC/C,CAAC;;;;;;;ACFN,MAAa,0CACX,EAAE,iBACF,WACuB;CACvB,MAAM,iBAAiB,mCACrB,EAAE,eAAe,EACjB,OACD;AAED,KAAI,CAAC,qBAAqB,eAAe,CACvC,OAAM,IAAI,0BAA0B,EAClC,eAAe,cAAc,SAC9B,CAAC;AAGJ,QAAO;;;;;;;;;;;;;;;ACZT,MAAa,wBAAwB,SAAS,kBAAkB,KAAc;CAC5E,MAAM,kBAAkB,OAAO;AAE/B,eAAc,iBAAiB,qCAAqC;AAQpE,QAN+B,gBAAgB,IAAI,iBAGzB,yBACxB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;ACmC9B,MAAa,wBAAwB,OACnC,EACE,WACA,UACA,mBACA,KACA,UACA,WAEF,SAAS,kBAAkB,KACgB;CAC3C,MAAM,YAAY,mBAAmB,OAAO;AAE5C,KAAI,UAAU,WAAW,EACvB,OAAM,IAAI,2BAA2B,EACnC,mBAAmB,sBAAsB,aAC1C,CAAC;CAKJ,MAAM,eAAe,UAAU,KAAK,qBAAqB;AAEzD,KAAI,CAAC,aACH,OAAM,IAAI,2BAA2B,EACnC,mBAAmB,UAAU,GAAG,KACjC,CAAC;CAGJ,MAAM,SAAS,MAAM,aAAa,sBAAsB;EACtD;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,OAAMA,sBAAY,OAAO;AAEzB,QAAO"}
|
|
1
|
+
{"version":3,"file":"migrateFromFireblocks-DJt9bktR.native.esm.js","names":["refreshAuth"],"sources":["../src/errors/NotWaasWalletProviderError.ts","../src/errors/TransactionBroadcastError.ts","../src/errors/NotWaasWalletAccountError.ts","../src/modules/waas/getWaasWalletProviderFromWalletAccount/getWaasWalletProviderFromWalletAccount.ts","../src/modules/waas/isDynamicWaasEnabled/isDynamicWaasEnabled.ts","../src/modules/waas/migrateFromFireblocks/migrateFromFireblocks.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NotWaasWalletProviderErrorParams = {\n walletProviderKey: string;\n};\n\nexport class NotWaasWalletProviderError extends BaseError {\n constructor({ walletProviderKey }: NotWaasWalletProviderErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_provider_error',\n docsUrl: null,\n name: 'NotWaasWalletProviderError',\n shortMessage: `Wallet provider ${walletProviderKey} is not a Dynamic WaaS wallet provider`,\n });\n }\n}\n","import { BaseError } from './base';\n\n/**\n * Error codes that identify why a v3 WaaS transaction broadcast was rejected.\n *\n * @example 'BROADCAST_REJECTED'\n * @see transactionBroadcastErrorMapper\n * @see broadcastWaasTransaction\n */\nexport type TransactionBroadcastErrorCode =\n | 'BROADCAST_IDEMPOTENCY_CONFLICT'\n | 'BROADCAST_OUTCOME_UNKNOWN'\n | 'BROADCAST_RATE_LIMITED'\n | 'BROADCAST_REJECTED'\n | 'BROADCAST_REQUIRES_RESIGN'\n | 'BROADCAST_WALLET_INELIGIBLE'\n | 'INVALID_SIGNED_TRANSACTION'\n | 'NETWORK_NOT_ENABLED'\n | 'SIGNED_TRANSACTION_WALLET_MISMATCH'\n | 'UNSUPPORTED_WAAS_CHAIN';\n\n/**\n * States describing whether the signed transaction reached the chain.\n *\n * @example 'not_submitted'\n * @see TransactionBroadcastError\n * @see broadcastWaasTransaction\n */\nexport type TransactionBroadcastSubmissionState =\n | 'not_submitted'\n | 'requires_resign'\n | 'unknown';\n\ntype TransactionBroadcastErrorParams = {\n attempts: number;\n broadcastId: string;\n cause: Error;\n code: TransactionBroadcastErrorCode;\n message: string;\n retryable: boolean;\n submissionState: TransactionBroadcastSubmissionState;\n transactionId?: string;\n};\n\n/**\n * Error raised when Redcoast fails to submit a v3 WaaS transaction after the SDK signed it.\n *\n * @example new TransactionBroadcastError({ attempts: 1, broadcastId: 'broadcast-id', cause, code: 'BROADCAST_REJECTED', message: 'rejected', retryable: false, submissionState: 'not_submitted', transactionId: undefined })\n * @see transactionBroadcastErrorMapper\n * @see broadcastWaasTransaction\n */\nexport class TransactionBroadcastError extends BaseError {\n attempts: number;\n broadcastId: string;\n retryable: boolean;\n submissionState: TransactionBroadcastSubmissionState;\n transactionId: string | undefined;\n\n constructor({\n attempts,\n broadcastId,\n cause,\n code,\n message,\n retryable,\n submissionState,\n transactionId,\n }: TransactionBroadcastErrorParams) {\n super({\n cause,\n code,\n docsUrl: null,\n name: 'TransactionBroadcastError',\n shortMessage: message,\n });\n\n this.attempts = attempts;\n this.broadcastId = broadcastId;\n this.retryable = retryable;\n this.submissionState = submissionState;\n this.transactionId = transactionId;\n }\n}\n","import { BaseError } from './base';\n\ntype NotWaasWalletAccountErrorParams = {\n walletAddress: string;\n};\n\nexport class NotWaasWalletAccountError extends BaseError {\n constructor({ walletAddress }: NotWaasWalletAccountErrorParams) {\n super({\n cause: null,\n code: 'not_waas_wallet_account_error',\n docsUrl: null,\n name: 'NotWaasWalletAccountError',\n shortMessage: `Wallet account ${walletAddress} is not a Dynamic WaaS wallet account`,\n });\n }\n}\n","import type { DynamicClient } from '../../../client/types/DynamicClient';\nimport { NotWaasWalletAccountError } from '../../../errors/NotWaasWalletAccountError';\nimport { getWalletProviderFromWalletAccount } from '../../wallets/utils/getWalletProviderFromWalletAccount';\nimport type { WalletAccount } from '../../wallets/walletAccount';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\nimport type { WaasWalletProvider } from '../waas.types';\n\ntype GetWalletProviderFromWalletAccountParams = {\n walletAccount: WalletAccount;\n};\n\n/** @notInstrumented */\nexport const getWaasWalletProviderFromWalletAccount = (\n { walletAccount }: GetWalletProviderFromWalletAccountParams,\n client: DynamicClient\n): WaasWalletProvider => {\n const walletProvider = getWalletProviderFromWalletAccount(\n { walletAccount },\n client\n );\n\n if (!isWaasWalletProvider(walletProvider)) {\n throw new NotWaasWalletAccountError({\n walletAddress: walletAccount.address,\n });\n }\n\n return walletProvider;\n};\n","import { EmbeddedWalletVersionEnum } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Checks if Dynamic WaaS (Wallet as a Service) is enabled for the current project.\n *\n * This function examines the project settings to determine if Dynamic WaaS is\n * enabled in the Dynamic Dashboard or not.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if Dynamic WaaS is enabled, false otherwise.\n * @notInstrumented\n */\nexport const isDynamicWaasEnabled = (client = getDefaultClient()): boolean => {\n const projectSettings = client.projectSettings;\n\n assertDefined(projectSettings, 'Project settings are not available');\n\n const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;\n\n const dynamicWaasIsEnabled =\n embeddedWalletSettings?.defaultWalletVersion ===\n EmbeddedWalletVersionEnum.V3;\n\n return dynamicWaasIsEnabled;\n};\n","import type { MigrateFromFireblocksResponse } from '@dynamic-labs-wallet/browser-wallet-client';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { NoWalletProviderFoundError } from '../../../errors/NoWalletProviderFoundError';\nimport { NotWaasWalletProviderError } from '../../../errors/NotWaasWalletProviderError';\nimport { refreshAuth } from '../../user/refreshAuth';\nimport { getWalletProviders } from '../../wallets/getWalletProviders';\nimport { DYNAMIC_WAAS_METADATA } from '../constants';\nimport { isWaasWalletProvider } from '../isWaasWalletProvider';\n\ntype MigrateFromFireblocksParams = {\n /**\n * Optional SLIP-0044 coin types per chain name for BIP44 derivation off the\n * Fireblocks takeover xprv (e.g. `{ EVM: 1 }` for Sepolia).\n */\n coinTypes?: Record<string, number>;\n /**\n * The Fireblocks NCW device id whose key material is being migrated.\n */\n deviceId: string;\n /**\n * Required per-chain expected wallet address (the address Fireblocks held). Its\n * keys are the chains migration runs on, and the migration iframe verifies each\n * imported Dynamic address matches the value, so a wrong derivation fails loudly\n * instead of producing an unusable wallet.\n */\n expectedAddresses: Record<string, string>;\n /**\n * The Fireblocks-issued JWT authorizing the takeover.\n */\n jwt: string;\n /**\n * The password that encrypted the legacy Fireblocks NCW device storage.\n */\n password: string;\n /**\n * The serialized Fireblocks NCW device storage (the local key share backup).\n */\n storage: Record<string, string>;\n};\n\n/**\n * Migrates an existing Fireblocks NCW wallet into Dynamic's WaaS infrastructure.\n *\n * Migration is a single cross-chain operation: one call takes over the Fireblocks\n * key material and provisions Dynamic WaaS wallet accounts for every supported\n * chain. Because it is not per-chain, this resolves a single WaaS wallet provider\n * (any registered chain) and delegates the takeover to it.\n *\n * @param params.deviceId - The Fireblocks NCW device id being migrated.\n * @param params.jwt - The Fireblocks-issued JWT authorizing the takeover.\n * @param params.storage - The serialized Fireblocks NCW device storage.\n * @param params.password - The password that encrypted the legacy device storage.\n * @param params.expectedAddresses - Required per-chain expected address; its keys are the chains migration runs on, and each imported address is verified against it.\n * @param [params.coinTypes] - Optional SLIP-0044 coin types per chain name.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise resolving to the per-chain migration results.\n * @notInstrumented\n */\nexport const migrateFromFireblocks = async (\n {\n coinTypes,\n deviceId,\n expectedAddresses,\n jwt,\n password,\n storage,\n }: MigrateFromFireblocksParams,\n client = getDefaultClient()\n): Promise<MigrateFromFireblocksResponse> => {\n const providers = getWalletProviders(client);\n\n if (providers.length === 0) {\n throw new NoWalletProviderFoundError({\n walletProviderKey: DYNAMIC_WAAS_METADATA.displayName,\n });\n }\n\n // Migration is cross-chain, so any registered WaaS provider can drive the\n // takeover. Resolve the first one rather than iterating per chain.\n const waasProvider = providers.find(isWaasWalletProvider);\n\n if (!waasProvider) {\n throw new NotWaasWalletProviderError({\n walletProviderKey: providers[0].key,\n });\n }\n\n const result = await waasProvider.migrateFromFireblocks({\n coinTypes,\n deviceId,\n expectedAddresses,\n jwt,\n password,\n storage,\n });\n\n await refreshAuth(client);\n\n return result;\n};\n"],"mappings":";;;;AAMA,IAAa,6BAAb,cAAgD,UAAU;CACxD,YAAY,EAAE,qBAAuD;AACnE,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,mBAAmB,kBAAkB;GACpD,CAAC;;;;;;;;;;;;;ACqCN,IAAa,4BAAb,cAA+C,UAAU;CACvD;CACA;CACA;CACA;CACA;CAEA,YAAY,EACV,UACA,aACA,OACA,MACA,SACA,WACA,iBACA,iBACkC;AAClC,QAAM;GACJ;GACA;GACA,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,WAAW;AAChB,OAAK,cAAc;AACnB,OAAK,YAAY;AACjB,OAAK,kBAAkB;AACvB,OAAK,gBAAgB;;;;;;AC1EzB,IAAa,4BAAb,cAA+C,UAAU;CACvD,YAAY,EAAE,iBAAkD;AAC9D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc,kBAAkB,cAAc;GAC/C,CAAC;;;;;;;ACFN,MAAa,0CACX,EAAE,iBACF,WACuB;CACvB,MAAM,iBAAiB,mCACrB,EAAE,eAAe,EACjB,OACD;AAED,KAAI,CAAC,qBAAqB,eAAe,CACvC,OAAM,IAAI,0BAA0B,EAClC,eAAe,cAAc,SAC9B,CAAC;AAGJ,QAAO;;;;;;;;;;;;;;;ACZT,MAAa,wBAAwB,SAAS,kBAAkB,KAAc;CAC5E,MAAM,kBAAkB,OAAO;AAE/B,eAAc,iBAAiB,qCAAqC;AAQpE,QAN+B,gBAAgB,IAAI,iBAGzB,yBACxB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;ACmC9B,MAAa,wBAAwB,OACnC,EACE,WACA,UACA,mBACA,KACA,UACA,WAEF,SAAS,kBAAkB,KACgB;CAC3C,MAAM,YAAY,mBAAmB,OAAO;AAE5C,KAAI,UAAU,WAAW,EACvB,OAAM,IAAI,2BAA2B,EACnC,mBAAmB,sBAAsB,aAC1C,CAAC;CAKJ,MAAM,eAAe,UAAU,KAAK,qBAAqB;AAEzD,KAAI,CAAC,aACH,OAAM,IAAI,2BAA2B,EACnC,mBAAmB,UAAU,GAAG,KACjC,CAAC;CAGJ,MAAM,SAAS,MAAM,aAAa,sBAAsB;EACtD;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,OAAMA,sBAAY,OAAO;AAEzB,QAAO"}
|
package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ClearSocialRedirectParamsParams } from './clearSocialRedirectParams.types';
|
|
2
|
+
export type { ClearSocialRedirectParamsParams } from './clearSocialRedirectParams.types';
|
|
1
3
|
/**
|
|
2
4
|
* Removes the social OAuth redirect parameters that `signInWithSocialRedirect`
|
|
3
5
|
* appends to the return URL from the browser's current URL, leaving every other
|
|
@@ -11,6 +13,10 @@
|
|
|
11
13
|
* browser. Calling it during server-side rendering (no `window`) throws
|
|
12
14
|
* `UnavailableInServerSideError`.
|
|
13
15
|
*
|
|
16
|
+
* @param [params.expectedState] - When given, the parameters are only removed
|
|
17
|
+
* while the current URL still carries this `dynamicOauthState`. Use it to
|
|
18
|
+
* clean up after a specific callback without touching a newer one that has
|
|
19
|
+
* meanwhile landed in the address bar.
|
|
14
20
|
* @returns Nothing. The current URL is rewritten in place via
|
|
15
21
|
* `window.history.replaceState`.
|
|
16
22
|
*
|
|
@@ -30,5 +36,5 @@
|
|
|
30
36
|
*
|
|
31
37
|
* @notInstrumented
|
|
32
38
|
*/
|
|
33
|
-
export declare const clearSocialRedirectParams: () => void;
|
|
39
|
+
export declare const clearSocialRedirectParams: ({ expectedState, }?: ClearSocialRedirectParamsParams) => void;
|
|
34
40
|
//# sourceMappingURL=clearSocialRedirectParams.d.ts.map
|
package/dist/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearSocialRedirectParams.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clearSocialRedirectParams.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEzF,YAAY,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEzF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,yBAAyB,wBAEnC,+BAA+B,KAAQ,IAwBzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clearSocialRedirectParams.types.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/social/oauth/clearSocialRedirectParams/clearSocialRedirectParams.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,+BAA+B,GAAG;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
|
|
@@ -8,6 +8,14 @@ export type { CompleteSocialRedirectParams } from './completeSocialRedirect.type
|
|
|
8
8
|
* authenticating (or linking) the user with the social provider. This is the
|
|
9
9
|
* final step after `signInWithSocialRedirect` + `detectSocialRedirectUrl`.
|
|
10
10
|
*
|
|
11
|
+
* A callback URL whose stored redirect state is missing or does not match can
|
|
12
|
+
* never complete, so its OAuth parameters are stripped from the browser URL
|
|
13
|
+
* before the error is rethrown. Callers that decide whether to complete a
|
|
14
|
+
* redirect by inspecting the URL therefore see the failure once instead of
|
|
15
|
+
* retrying the same doomed callback on every render. The clean-up is scoped to
|
|
16
|
+
* the state of the callback it failed on, so a newer callback sitting in the
|
|
17
|
+
* address bar is left alone.
|
|
18
|
+
*
|
|
11
19
|
* @example
|
|
12
20
|
* ```ts
|
|
13
21
|
* const redirectUrl = detectSocialRedirectUrl();
|
|
@@ -21,6 +29,7 @@ export type { CompleteSocialRedirectParams } from './completeSocialRedirect.type
|
|
|
21
29
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
22
30
|
* @returns A promise that resolves to the authenticated user or null.
|
|
23
31
|
* @throws MissingSocialUrlParamError If required OAuth parameters are missing.
|
|
32
|
+
* @throws MissingRedirectStorageStateError If no stored redirect state exists.
|
|
24
33
|
* @throws InvalidRedirectStorageStateError If the stored state doesn't match.
|
|
25
34
|
* @see signInWithSocialRedirect
|
|
26
35
|
* @see detectSocialRedirectUrl
|
package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completeSocialRedirect.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"completeSocialRedirect.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGxD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAEnF,YAAY,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,sBAAsB,6BACP,4BAA4B,8DAErD,OAAO,CAAC,IAAI,GAAG,IAAI,CA2BrB,CAAC"}
|
package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { Chain } from '../../chain';
|
|
1
2
|
import type { WalletBookSchema } from '../../legacyWalletBook/legacyWalletBook.types';
|
|
2
3
|
import type { ConnectionOptionForWalletOption } from '../groupOptionsByWalletOption/groupOptionsByWalletOption';
|
|
3
4
|
type BuildInAppBrowserOptionsParams = {
|
|
5
|
+
enabledChains: Set<Chain>;
|
|
4
6
|
walletBook: WalletBookSchema;
|
|
5
7
|
};
|
|
6
8
|
/**
|
|
@@ -13,10 +15,16 @@ type BuildInAppBrowserOptionsParams = {
|
|
|
13
15
|
* and injected-only wallets are dropped — so the catalogue's notion of
|
|
14
16
|
* "external wallet" stays consistent across option types.
|
|
15
17
|
*
|
|
18
|
+
* A wallet's in-app browser opens a single session, so it emits one option
|
|
19
|
+
* tagged with the first chain it advertises that the client has an
|
|
20
|
+
* extension for — a multi-chain wallet is still reachable when only one of
|
|
21
|
+
* its chains is enabled.
|
|
22
|
+
*
|
|
23
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
16
24
|
* @param params.walletBook - The fetched wallet book.
|
|
17
25
|
* @returns Tagged `inAppBrowser` options paired with their wallet option keys.
|
|
18
26
|
* @notInstrumented
|
|
19
27
|
*/
|
|
20
|
-
export declare const buildInAppBrowserOptions: ({ walletBook, }: BuildInAppBrowserOptionsParams) => ConnectionOptionForWalletOption[];
|
|
28
|
+
export declare const buildInAppBrowserOptions: ({ enabledChains, walletBook, }: BuildInAppBrowserOptionsParams) => ConnectionOptionForWalletOption[];
|
|
21
29
|
export {};
|
|
22
30
|
//# sourceMappingURL=buildInAppBrowserOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildInAppBrowserOptions.d.ts","sourceRoot":"","sources":["../../../../src/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildInAppBrowserOptions.d.ts","sourceRoot":"","sources":["../../../../src/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AAEtF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,0DAA0D,CAAC;AAIhH,KAAK,8BAA8B,GAAG;IACpC,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1B,UAAU,EAAE,gBAAgB,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,wBAAwB,mCAGlC,8BAA8B,KAAG,+BAA+B,EAiClE,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { Chain } from '../../chain';
|
|
1
2
|
import type { WalletBookSchema } from '../../legacyWalletBook/legacyWalletBook.types';
|
|
2
3
|
import type { InstallationUrls } from '../walletOptionsCatalogue.types';
|
|
3
4
|
type BuildInstallationUrlsByWalletOptionKeyParams = {
|
|
5
|
+
enabledChains: Set<Chain>;
|
|
4
6
|
walletBook: WalletBookSchema;
|
|
5
7
|
};
|
|
6
8
|
/**
|
|
@@ -18,10 +20,14 @@ type BuildInstallationUrlsByWalletOptionKeyParams = {
|
|
|
18
20
|
* Reuses the generic `shouldFilterWallet` rules so embedded wallets do
|
|
19
21
|
* not appear here either — they're not user-installable products.
|
|
20
22
|
*
|
|
23
|
+
* Wallets that advertise no chain this client has an extension for are
|
|
24
|
+
* skipped: installing them would not make them connectable.
|
|
25
|
+
*
|
|
26
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
21
27
|
* @param params.walletBook - The fetched wallet book.
|
|
22
28
|
* @returns A map from wallet option key to its install URL bag.
|
|
23
29
|
* @notInstrumented
|
|
24
30
|
*/
|
|
25
|
-
export declare const buildInstallationUrlsByWalletOptionKey: ({ walletBook, }: BuildInstallationUrlsByWalletOptionKeyParams) => Map<string, InstallationUrls>;
|
|
31
|
+
export declare const buildInstallationUrlsByWalletOptionKey: ({ enabledChains, walletBook, }: BuildInstallationUrlsByWalletOptionKeyParams) => Map<string, InstallationUrls>;
|
|
26
32
|
export {};
|
|
27
33
|
//# sourceMappingURL=buildInstallationUrlsByWalletOptionKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildInstallationUrlsByWalletOptionKey.d.ts","sourceRoot":"","sources":["../../../../src/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AAItF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAcxE,KAAK,4CAA4C,GAAG;IAClD,UAAU,EAAE,gBAAgB,CAAC;CAC9B,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"buildInstallationUrlsByWalletOptionKey.d.ts","sourceRoot":"","sources":["../../../../src/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AAItF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAcxE,KAAK,4CAA4C,GAAG;IAClD,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1B,UAAU,EAAE,gBAAgB,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,sCAAsC,mCAGhD,4CAA4C,KAAG,GAAG,CACnD,MAAM,EACN,gBAAgB,CAiCjB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Chain } from '../../chain';
|
|
2
|
+
import type { ConnectionOptionForWalletOption } from '../groupOptionsByWalletOption/groupOptionsByWalletOption';
|
|
3
|
+
type FilterConnectionOptionsByEnabledChainsParams = {
|
|
4
|
+
enabledChains: Set<Chain>;
|
|
5
|
+
options: ConnectionOptionForWalletOption[];
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Drops options whose chain has no extension on this client. The wallet
|
|
9
|
+
* book advertises every chain a wallet supports, so options derived from
|
|
10
|
+
* it have to be narrowed to the chains the client can actually connect
|
|
11
|
+
* on — otherwise the catalogue surfaces a connection the customer has no
|
|
12
|
+
* primitive to drive.
|
|
13
|
+
*
|
|
14
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
15
|
+
* @param params.options - The tagged options to narrow.
|
|
16
|
+
* @returns The options on enabled chains, in input order.
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* filterConnectionOptionsByEnabledChains({
|
|
20
|
+
* enabledChains: new Set(['EVM']),
|
|
21
|
+
* options: [evmOption, solOption],
|
|
22
|
+
* }); // [evmOption]
|
|
23
|
+
* ```
|
|
24
|
+
* @see {@link getEnabledChains} for how the enabled chains are derived.
|
|
25
|
+
* @see {@link getWalletOptionsCatalogue} for the catalogue that applies this filter.
|
|
26
|
+
* @notInstrumented
|
|
27
|
+
*/
|
|
28
|
+
export declare const filterConnectionOptionsByEnabledChains: ({ enabledChains, options, }: FilterConnectionOptionsByEnabledChainsParams) => ConnectionOptionForWalletOption[];
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=filterConnectionOptionsByEnabledChains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterConnectionOptionsByEnabledChains.d.ts","sourceRoot":"","sources":["../../../../src/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/filterConnectionOptionsByEnabledChains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,0DAA0D,CAAC;AAEhH,KAAK,4CAA4C,GAAG;IAClD,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IAC1B,OAAO,EAAE,+BAA+B,EAAE,CAAC;CAC5C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,sCAAsC,gCAGhD,4CAA4C,KAAG,+BAA+B,EAChB,CAAC"}
|
package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sCAAsC,EAAE,MAAM,0CAA0C,CAAC"}
|
package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ import type { GetWalletOptionsCatalogueParams, WalletOptionsCatalogue } from '..
|
|
|
5
5
|
* pass `includeMobileOptions: true` to additionally surface
|
|
6
6
|
* WalletConnect, in-app-browser, and install links.
|
|
7
7
|
*
|
|
8
|
+
* Options sourced from the wallet book are scoped to the chains this
|
|
9
|
+
* client has an extension for — a wallet is only surfaced on chains the
|
|
10
|
+
* customer can actually connect on.
|
|
11
|
+
*
|
|
8
12
|
* Pass `excludedConnectionOptionTypes` to drop specific connection types
|
|
9
13
|
* from the catalogue (e.g. `['inAppBrowser']` on desktop). Wallets whose
|
|
10
14
|
* only connection was an excluded type fall through to the install-only
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWalletOptionsCatalogue.d.ts","sourceRoot":"","sources":["../../../../src/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getWalletOptionsCatalogue.d.ts","sourceRoot":"","sources":["../../../../src/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,+BAA+B,EAG/B,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AAIzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,YAC5B,+BAA+B,wDAEtC,OAAO,CAAC,sBAAsB,CAwFhC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Chain } from '../chain';
|
|
2
|
+
import type { UriConnectionType } from '../wallets/walletProviderUriConnection.types';
|
|
2
3
|
/**
|
|
3
4
|
* Identifies where a registered wallet provider came from. Used as the
|
|
4
5
|
* `source` discriminator on `WithWalletProviderConnectionOption` so customer
|
|
@@ -51,7 +52,7 @@ export type UriDeeplinkConnectionOption = {
|
|
|
51
52
|
/** Universal link (e.g. `https://link.trustwallet.com`). */
|
|
52
53
|
universal?: string;
|
|
53
54
|
};
|
|
54
|
-
type:
|
|
55
|
+
type: UriConnectionType;
|
|
55
56
|
};
|
|
56
57
|
/**
|
|
57
58
|
* A mobile wallet that exposes an in-app browser entry URL. The URL is a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletOptionsCatalogue.types.d.ts","sourceRoot":"","sources":["../../../src/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"walletOptionsCatalogue.types.d.ts","sourceRoot":"","sources":["../../../src/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEtF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,wBAAwB,GAChC,eAAe,GACf,gBAAgB,GAChB,KAAK,CAAC;AAEV;;;;;;;;;GASG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,wBAAwB,CAAC;IACjC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,EAAE;QACT,gDAAgD;QAChD,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,4DAA4D;QAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,IAAI,EAAE,iBAAiB,CAAC;CACzB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAC9B,kCAAkC,GAClC,2BAA2B,GAC3B,4BAA4B,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;OAKG;IACH,iBAAiB,EAAE,sBAAsB,EAAE,CAAC;IAC5C,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,2DAA2D;IAC3D,GAAG,EAAE,MAAM,CAAC;IACZ,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,cAAc,CAAC;AAEhE,kDAAkD;AAClD,MAAM,MAAM,+BAA+B,GAAG;IAC5C;;;;;;;;;OASG;IACH,6BAA6B,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;IACjE;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mEAAmE;IACnE,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handed to `onConnectionUri` when a connection is established through a URI
|
|
3
|
+
* pairing, so the customer can surface it to the user while the connection
|
|
4
|
+
* promise is still pending.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const onConnectionUri = ({ deeplink, uri }: ConnectionUriHandlerParams) => {
|
|
9
|
+
* if (deeplink) {
|
|
10
|
+
* window.location.href = deeplink;
|
|
11
|
+
* return;
|
|
12
|
+
* }
|
|
13
|
+
*
|
|
14
|
+
* renderQrCode(uri);
|
|
15
|
+
* };
|
|
16
|
+
* ```
|
|
17
|
+
* @see connectWithUriConnectionOption
|
|
18
|
+
* @see getUriConnectionStarterRegistry
|
|
19
|
+
*/
|
|
20
|
+
export type ConnectionUriHandlerParams = {
|
|
21
|
+
/**
|
|
22
|
+
* The single deeplink that hands the pairing off to the wallet — open it as
|
|
23
|
+
* is. For a WalletConnect pairing it is the wallet's own deeplink carrying
|
|
24
|
+
* the URI, with the variant the current platform can open picked for you:
|
|
25
|
+
* the native scheme on mobile, the universal link on desktop, the other one
|
|
26
|
+
* as fallback. For a MetaMask SDK pairing it is the launch link MetaMask
|
|
27
|
+
* minted, which already targets the wallet. Undefined when the wallet book
|
|
28
|
+
* carries no deeplink for the wallet, in which case render `uri` as a QR
|
|
29
|
+
* code.
|
|
30
|
+
*/
|
|
31
|
+
deeplink?: string;
|
|
32
|
+
/** The pairing URI, typically rendered as a QR code on desktop. */
|
|
33
|
+
uri: string;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=connectWallet.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectWallet.types.d.ts","sourceRoot":"","sources":["../../../src/modules/wallets/connectWallet.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;CACb,CAAC"}
|
package/dist/modules/wallets/connectWithUriConnectionOption/connectWithUriConnectionOption.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { DynamicClient } from '../../../client/types';
|
|
2
|
+
import type { UriDeeplinkConnectionOption } from '../../walletOptionsCatalogue/walletOptionsCatalogue.types';
|
|
3
|
+
import type { ConnectionUriHandlerParams } from '../connectWallet.types';
|
|
4
|
+
import type { WalletAccount } from '../walletAccount';
|
|
5
|
+
type ConnectWithUriConnectionOptionParams = {
|
|
6
|
+
addToDynamicWalletAccounts: boolean;
|
|
7
|
+
connectionOption: UriDeeplinkConnectionOption;
|
|
8
|
+
onConnectionUri?: (params: ConnectionUriHandlerParams) => Promise<void> | void;
|
|
9
|
+
walletKey: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Connects to a wallet through a URI pairing and returns the connected wallet
|
|
13
|
+
* account.
|
|
14
|
+
*
|
|
15
|
+
* Mints the pairing URI with the starter the chain extension registered for
|
|
16
|
+
* the option's chain and URI type, hands the URI and the wallet's deeplink to
|
|
17
|
+
* `onConnectionUri` so the customer can render a QR code or open the wallet
|
|
18
|
+
* app, then waits for the user to approve the pairing on the wallet side.
|
|
19
|
+
*
|
|
20
|
+
* The handler is awaited, so an async handler that fails to open the wallet
|
|
21
|
+
* rejects the connection rather than letting the pairing resolve into an
|
|
22
|
+
* account nobody asked for.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const walletAccount = await connectWithUriConnectionOption(
|
|
27
|
+
* {
|
|
28
|
+
* addToDynamicWalletAccounts: true,
|
|
29
|
+
* connectionOption,
|
|
30
|
+
* onConnectionUri: ({ uri }) => renderQrCode(uri),
|
|
31
|
+
* walletKey: 'trust',
|
|
32
|
+
* },
|
|
33
|
+
* client
|
|
34
|
+
* );
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @param params.addToDynamicWalletAccounts - Whether the connected wallet account should be added to the client's wallet accounts.
|
|
38
|
+
* @param params.connectionOption - The URI deeplink connection option to drive.
|
|
39
|
+
* @param params.onConnectionUri - Called with the pairing URI and the wallet's deeplink once the URI is minted. Awaited before the approval is waited on.
|
|
40
|
+
* @param params.walletKey - The wallet being connected, keyed as in the wallet options catalogue.
|
|
41
|
+
* @param client - The Dynamic client instance.
|
|
42
|
+
* @returns A promise that resolves to the connected wallet account.
|
|
43
|
+
* @throws ConnectionUriHandlerMissingError If no onConnectionUri handler was passed.
|
|
44
|
+
* @throws NoConnectionOptionAvailableError If no URI connection starter is registered for the option's chain and type.
|
|
45
|
+
* @throws NoAddressFoundError If the pairing was approved but no address was shared with your app.
|
|
46
|
+
* @see getUriConnectionStarterRegistry
|
|
47
|
+
* @see getWalletOptionsCatalogue
|
|
48
|
+
* @notInstrumented
|
|
49
|
+
*/
|
|
50
|
+
export declare const connectWithUriConnectionOption: ({ addToDynamicWalletAccounts, connectionOption, onConnectionUri, walletKey, }: ConnectWithUriConnectionOptionParams, client: DynamicClient) => Promise<WalletAccount>;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=connectWithUriConnectionOption.d.ts.map
|
package/dist/modules/wallets/connectWithUriConnectionOption/connectWithUriConnectionOption.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectWithUriConnectionOption.d.ts","sourceRoot":"","sources":["../../../../src/modules/wallets/connectWithUriConnectionOption/connectWithUriConnectionOption.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAC;AAC7G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,KAAK,oCAAoC,GAAG;IAC1C,0BAA0B,EAAE,OAAO,CAAC;IACpC,gBAAgB,EAAE,2BAA2B,CAAC;IAC9C,eAAe,CAAC,EAAE,CAChB,MAAM,EAAE,0BAA0B,KAC/B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,8BAA8B,kFAMtC,oCAAoC,UAC/B,aAAa,KACpB,OAAO,CAAC,aAAa,CAoCvB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { UriDeeplinkConnectionOption } from '../../../walletOptionsCatalogue/walletOptionsCatalogue.types';
|
|
2
|
+
type GetConnectionUriDeeplinkParams = {
|
|
3
|
+
deeplinks: UriDeeplinkConnectionOption['deeplinks'];
|
|
4
|
+
type: UriDeeplinkConnectionOption['type'];
|
|
5
|
+
uri: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Builds the single deeplink that hands a pairing URI to the wallet, picking
|
|
9
|
+
* the shape the URI's protocol expects.
|
|
10
|
+
*
|
|
11
|
+
* A WalletConnect URI travels as the `uri` query parameter of the wallet's own
|
|
12
|
+
* deeplink, whereas the MetaMask SDK mints a launch link that already targets
|
|
13
|
+
* MetaMask, so it is handed over untouched.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const deeplink = getConnectionUriDeeplink({
|
|
18
|
+
* deeplinks: connectionOption.deeplinks,
|
|
19
|
+
* type: connectionOption.type,
|
|
20
|
+
* uri,
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param params.deeplinks - The wallet's deeplink variants, as carried by the wallet book.
|
|
25
|
+
* @param params.type - The URI connection type that minted the URI.
|
|
26
|
+
* @param params.uri - The pairing URI.
|
|
27
|
+
* @returns The deeplink to open, or `undefined` when the wallet publishes no deeplink to carry the URI.
|
|
28
|
+
* @see getPreferredWalletDeepLink
|
|
29
|
+
* @see appendConnectionUriToDeeplink
|
|
30
|
+
* @notInstrumented
|
|
31
|
+
*/
|
|
32
|
+
export declare const getConnectionUriDeeplink: ({ deeplinks, type, uri, }: GetConnectionUriDeeplinkParams) => string | undefined;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=getConnectionUriDeeplink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConnectionUriDeeplink.d.ts","sourceRoot":"","sources":["../../../../../src/modules/wallets/connectWithUriConnectionOption/getConnectionUriDeeplink/getConnectionUriDeeplink.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8DAA8D,CAAC;AAEhH,KAAK,8BAA8B,GAAG;IACpC,SAAS,EAAE,2BAA2B,CAAC,WAAW,CAAC,CAAC;IACpD,IAAI,EAAE,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAC1C,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,wBAAwB,8BAIlC,8BAA8B,KAAG,MAAM,GAAG,SAY5C,CAAC"}
|
package/dist/modules/wallets/connectWithUriConnectionOption/getConnectionUriDeeplink/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/wallets/connectWithUriConnectionOption/getConnectionUriDeeplink/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/wallets/connectWithUriConnectionOption/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC"}
|