@dynamic-labs-sdk/client 1.32.0 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/{apiClient-Bwd6cllS.native.esm.js → apiClient-4r7VAsLC.native.esm.js} +45 -12
  2. package/dist/apiClient-4r7VAsLC.native.esm.js.map +1 -0
  3. package/dist/constants.d.ts +6 -0
  4. package/dist/constants.d.ts.map +1 -1
  5. package/dist/core.cjs +78 -5
  6. package/dist/core.cjs.map +1 -1
  7. package/dist/core.esm.js +77 -6
  8. package/dist/core.esm.js.map +1 -1
  9. package/dist/core.native.esm.js +79 -8
  10. package/dist/core.native.esm.js.map +1 -1
  11. package/dist/errors/UnexpectedConsentResponseError.d.ts +7 -0
  12. package/dist/errors/UnexpectedConsentResponseError.d.ts.map +1 -0
  13. package/dist/exports/core.d.ts +2 -0
  14. package/dist/exports/core.d.ts.map +1 -1
  15. package/dist/exports/index.d.ts +2 -0
  16. package/dist/exports/index.d.ts.map +1 -1
  17. package/dist/exports/waas.d.ts +2 -1
  18. package/dist/exports/waas.d.ts.map +1 -1
  19. package/dist/{getNetworkProviderFromNetworkId-DSsGkava.native.esm.js → getNetworkProviderFromNetworkId-BV229QF3.native.esm.js} +112 -89
  20. package/dist/getNetworkProviderFromNetworkId-BV229QF3.native.esm.js.map +1 -0
  21. package/dist/{getNetworkProviderFromNetworkId-TTqmAiJh.esm.js → getNetworkProviderFromNetworkId-D9oRzWA6.esm.js} +106 -83
  22. package/dist/getNetworkProviderFromNetworkId-D9oRzWA6.esm.js.map +1 -0
  23. package/dist/{getNetworkProviderFromNetworkId-5UBZwUg2.cjs → getNetworkProviderFromNetworkId-DOrcvuFv.cjs} +105 -82
  24. package/dist/getNetworkProviderFromNetworkId-DOrcvuFv.cjs.map +1 -0
  25. package/dist/{getSignedSessionId-DBUnRGjt.cjs → getSignedSessionId-4qHh_BOh.cjs} +3 -3
  26. package/dist/{getSignedSessionId-DBUnRGjt.cjs.map → getSignedSessionId-4qHh_BOh.cjs.map} +1 -1
  27. package/dist/{getSignedSessionId-BkYhH1zc.native.esm.js → getSignedSessionId-Cd8CCp5d.native.esm.js} +3 -3
  28. package/dist/{getSignedSessionId-BkYhH1zc.native.esm.js.map → getSignedSessionId-Cd8CCp5d.native.esm.js.map} +1 -1
  29. package/dist/{getSignedSessionId-DeeDyino.esm.js → getSignedSessionId-DA-MMsJm.esm.js} +3 -3
  30. package/dist/{getSignedSessionId-DeeDyino.esm.js.map → getSignedSessionId-DA-MMsJm.esm.js.map} +1 -1
  31. package/dist/{getVerifiedCredentialForWalletAccount-BSxiaaVp.cjs → getVerifiedCredentialForWalletAccount-Bw5q7QZn.cjs} +2 -2
  32. package/dist/{getVerifiedCredentialForWalletAccount-BSxiaaVp.cjs.map → getVerifiedCredentialForWalletAccount-Bw5q7QZn.cjs.map} +1 -1
  33. package/dist/{getVerifiedCredentialForWalletAccount-C--Dza_K.esm.js → getVerifiedCredentialForWalletAccount-Fr3bEKeU.esm.js} +2 -2
  34. package/dist/{getVerifiedCredentialForWalletAccount-C--Dza_K.esm.js.map → getVerifiedCredentialForWalletAccount-Fr3bEKeU.esm.js.map} +1 -1
  35. package/dist/index.cjs +379 -638
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.esm.js +375 -635
  38. package/dist/index.esm.js.map +1 -1
  39. package/dist/index.native.esm.js +377 -637
  40. package/dist/index.native.esm.js.map +1 -1
  41. package/dist/{isMfaRequiredForAction-BPEXPqSt.esm.js → isMfaRequiredForAction-BdU62usM.esm.js} +3 -9
  42. package/dist/{isMfaRequiredForAction-BPEXPqSt.esm.js.map → isMfaRequiredForAction-BdU62usM.esm.js.map} +1 -1
  43. package/dist/{isMfaRequiredForAction-DfrEFvU2.native.esm.js → isMfaRequiredForAction-DZfEkyIU.native.esm.js} +3 -9
  44. package/dist/{isMfaRequiredForAction-DfrEFvU2.native.esm.js.map → isMfaRequiredForAction-DZfEkyIU.native.esm.js.map} +1 -1
  45. package/dist/{isMfaRequiredForAction-62zh3W-2.cjs → isMfaRequiredForAction-Djd-jkSl.cjs} +3 -9
  46. package/dist/{isMfaRequiredForAction-62zh3W-2.cjs.map → isMfaRequiredForAction-Djd-jkSl.cjs.map} +1 -1
  47. package/dist/{isUserOnboardingComplete-Dmck83_2.esm.js → isUserOnboardingComplete-BEZOYohA.esm.js} +3 -3
  48. package/dist/{isUserOnboardingComplete-Dmck83_2.esm.js.map → isUserOnboardingComplete-BEZOYohA.esm.js.map} +1 -1
  49. package/dist/{isUserOnboardingComplete-DtxIznZD.cjs → isUserOnboardingComplete-Bwvv6Urs.cjs} +3 -3
  50. package/dist/{isUserOnboardingComplete-DtxIznZD.cjs.map → isUserOnboardingComplete-Bwvv6Urs.cjs.map} +1 -1
  51. package/dist/{isUserOnboardingComplete-BWrCHXXO.native.esm.js → isUserOnboardingComplete-CEUkAzCi.native.esm.js} +3 -3
  52. package/dist/{isUserOnboardingComplete-BWrCHXXO.native.esm.js.map → isUserOnboardingComplete-CEUkAzCi.native.esm.js.map} +1 -1
  53. package/dist/{logoutWithReason-yDqQ0UIt.cjs → logoutWithReason-B-ZF0VmN.cjs} +57 -18
  54. package/dist/logoutWithReason-B-ZF0VmN.cjs.map +1 -0
  55. package/dist/{logoutWithReason-DIc7cC6T.native.esm.js → logoutWithReason-DvnEa2Uv.native.esm.js} +3 -9
  56. package/dist/{logoutWithReason-DIc7cC6T.native.esm.js.map → logoutWithReason-DvnEa2Uv.native.esm.js.map} +1 -1
  57. package/dist/{logoutWithReason-x8mE7EAy.esm.js → logoutWithReason-I6vShLpA.esm.js} +46 -19
  58. package/dist/logoutWithReason-I6vShLpA.esm.js.map +1 -0
  59. package/dist/{migrateFromFireblocks-BUhWQCqm.native.esm.js → migrateFromFireblocks-6I7lkraQ.native.esm.js} +2 -2
  60. package/dist/{migrateFromFireblocks-BUhWQCqm.native.esm.js.map → migrateFromFireblocks-6I7lkraQ.native.esm.js.map} +1 -1
  61. package/dist/{migrateFromFireblocks-qYPrnWF8.cjs → migrateFromFireblocks-C23-24bK.cjs} +2 -2
  62. package/dist/{migrateFromFireblocks-qYPrnWF8.cjs.map → migrateFromFireblocks-C23-24bK.cjs.map} +1 -1
  63. package/dist/{migrateFromFireblocks-BapjEhra.esm.js → migrateFromFireblocks-Dtk6t8hN.esm.js} +2 -2
  64. package/dist/{migrateFromFireblocks-BapjEhra.esm.js.map → migrateFromFireblocks-Dtk6t8hN.esm.js.map} +1 -1
  65. package/dist/modules/funding/coinbase/getCoinbaseAccounts/getCoinbaseAccounts.d.ts +1 -1
  66. package/dist/modules/funding/coinbase/getCoinbaseBuyUrl/getCoinbaseBuyUrl.d.ts +1 -1
  67. package/dist/modules/funding/kraken/getKrakenAccounts/getKrakenAccounts.d.ts +1 -1
  68. package/dist/modules/funding/kraken/getKrakenWhitelistedAddresses/getKrakenWhitelistedAddresses.d.ts +1 -1
  69. package/dist/modules/sessionKeys/signBusinessAccountIntent/signBusinessAccountIntent.d.ts +95 -0
  70. package/dist/modules/sessionKeys/signBusinessAccountIntent/signBusinessAccountIntent.d.ts.map +1 -0
  71. package/dist/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.d.ts +3 -1
  72. package/dist/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.d.ts.map +1 -1
  73. package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts +15 -6
  74. package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts.map +1 -1
  75. package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.d.ts +7 -3
  76. package/dist/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.d.ts.map +1 -1
  77. package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts +115 -2
  78. package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts.map +1 -1
  79. package/dist/modules/waas/businessAccounts/isBusinessAccountActionRequired/index.d.ts +2 -0
  80. package/dist/modules/waas/businessAccounts/isBusinessAccountActionRequired/index.d.ts.map +1 -0
  81. package/dist/modules/waas/businessAccounts/isBusinessAccountActionRequired/isBusinessAccountActionRequired.d.ts +27 -0
  82. package/dist/modules/waas/businessAccounts/isBusinessAccountActionRequired/isBusinessAccountActionRequired.d.ts.map +1 -0
  83. package/dist/modules/waas/businessAccounts/updateBusinessAccountMemberRole/updateBusinessAccountMemberRole.d.ts +13 -6
  84. package/dist/modules/waas/businessAccounts/updateBusinessAccountMemberRole/updateBusinessAccountMemberRole.d.ts.map +1 -1
  85. package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
  86. package/dist/modules/waas/waas.types.d.ts +5 -2
  87. package/dist/modules/waas/waas.types.d.ts.map +1 -1
  88. package/dist/modules/walletOptionsCatalogue/buildWalletBookConnectionOptions/buildWalletBookConnectionOptions.d.ts +42 -0
  89. package/dist/modules/walletOptionsCatalogue/buildWalletBookConnectionOptions/buildWalletBookConnectionOptions.d.ts.map +1 -0
  90. package/dist/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.d.ts +7 -1
  91. package/dist/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.d.ts.map +1 -1
  92. package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts.map +1 -1
  93. package/dist/modules/walletOptionsCatalogue/deriveSupportedChains/deriveSupportedChains.d.ts +27 -0
  94. package/dist/modules/walletOptionsCatalogue/deriveSupportedChains/deriveSupportedChains.d.ts.map +1 -0
  95. package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts +4 -0
  96. package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts.map +1 -1
  97. package/dist/modules/walletOptionsCatalogue/isWalletExtensionInstalled/index.d.ts +3 -0
  98. package/dist/modules/walletOptionsCatalogue/isWalletExtensionInstalled/index.d.ts.map +1 -0
  99. package/dist/modules/walletOptionsCatalogue/isWalletExtensionInstalled/isWalletExtensionInstalled.d.ts +35 -0
  100. package/dist/modules/walletOptionsCatalogue/isWalletExtensionInstalled/isWalletExtensionInstalled.d.ts.map +1 -0
  101. package/dist/modules/walletOptionsCatalogue/sortWalletOptions/sortWalletOptions.d.ts +1 -1
  102. package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts +7 -0
  103. package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts.map +1 -1
  104. package/dist/modules/wallets/resolveWalletConnectionOption/resolveWalletConnectionOption.d.ts.map +1 -1
  105. package/dist/modules/wallets/uriConnectionStarterRegistry/getUriConnectionStarterChains/getUriConnectionStarterChains.d.ts +27 -0
  106. package/dist/modules/wallets/uriConnectionStarterRegistry/getUriConnectionStarterChains/getUriConnectionStarterChains.d.ts.map +1 -0
  107. package/dist/modules/wallets/uriConnectionStarterRegistry/getUriConnectionStarterChains/index.d.ts +2 -0
  108. package/dist/modules/wallets/uriConnectionStarterRegistry/getUriConnectionStarterChains/index.d.ts.map +1 -0
  109. package/dist/modules/wallets/verifyMessageSignatureOwnership/verifyMessageSignatureOwnership.d.ts.map +1 -1
  110. package/dist/services/instrumentation/instrumentFunction/instrumentFunction.d.ts +6 -5
  111. package/dist/services/instrumentation/instrumentFunction/instrumentFunction.d.ts.map +1 -1
  112. package/dist/services/instrumentation/resolveInstrumentationCore/index.d.ts +2 -0
  113. package/dist/services/instrumentation/resolveInstrumentationCore/index.d.ts.map +1 -0
  114. package/dist/services/instrumentation/resolveInstrumentationCore/resolveInstrumentationCore.d.ts +19 -0
  115. package/dist/services/instrumentation/resolveInstrumentationCore/resolveInstrumentationCore.d.ts.map +1 -0
  116. package/dist/services/instrumentation/transports/createDynamicTransport/createDynamicTransport.d.ts +4 -3
  117. package/dist/services/instrumentation/transports/createDynamicTransport/createDynamicTransport.d.ts.map +1 -1
  118. package/dist/services/realtime/createRealtimeService/createRealtimeService.d.ts.map +1 -1
  119. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  120. package/dist/utils/isScreeningBlockedError/index.d.ts +2 -0
  121. package/dist/utils/isScreeningBlockedError/index.d.ts.map +1 -0
  122. package/dist/utils/isScreeningBlockedError/isScreeningBlockedError.d.ts +24 -0
  123. package/dist/utils/isScreeningBlockedError/isScreeningBlockedError.d.ts.map +1 -0
  124. package/dist/{waas-WID2Fy_N.cjs → waas-C0IDCf3u.cjs} +81 -18
  125. package/dist/waas-C0IDCf3u.cjs.map +1 -0
  126. package/dist/{waas-CyUrvkQr.native.esm.js → waas-DJeW02-Y.native.esm.js} +77 -20
  127. package/dist/waas-DJeW02-Y.native.esm.js.map +1 -0
  128. package/dist/{waas-DzcYsWU8.esm.js → waas-D_alZrtb.esm.js} +77 -20
  129. package/dist/waas-D_alZrtb.esm.js.map +1 -0
  130. package/dist/waas.cjs +5 -4
  131. package/dist/waas.esm.js +5 -5
  132. package/dist/waas.native.esm.js +5 -5
  133. package/dist/waasCore.cjs +8 -6
  134. package/dist/waasCore.cjs.map +1 -1
  135. package/dist/waasCore.esm.js +8 -6
  136. package/dist/waasCore.esm.js.map +1 -1
  137. package/dist/waasCore.native.esm.js +8 -6
  138. package/dist/waasCore.native.esm.js.map +1 -1
  139. package/package.json +5 -4
  140. package/dist/apiClient-Bwd6cllS.native.esm.js.map +0 -1
  141. package/dist/getNetworkProviderFromNetworkId-5UBZwUg2.cjs.map +0 -1
  142. package/dist/getNetworkProviderFromNetworkId-DSsGkava.native.esm.js.map +0 -1
  143. package/dist/getNetworkProviderFromNetworkId-TTqmAiJh.esm.js.map +0 -1
  144. package/dist/logoutWithReason-x8mE7EAy.esm.js.map +0 -1
  145. package/dist/logoutWithReason-yDqQ0UIt.cjs.map +0 -1
  146. package/dist/modules/walletOptionsCatalogue/hasInstalledProvider/hasInstalledProvider.d.ts +0 -18
  147. package/dist/modules/walletOptionsCatalogue/hasInstalledProvider/hasInstalledProvider.d.ts.map +0 -1
  148. package/dist/waas-CyUrvkQr.native.esm.js.map +0 -1
  149. package/dist/waas-DzcYsWU8.esm.js.map +0 -1
  150. package/dist/waas-WID2Fy_N.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"migrateFromFireblocks-BUhWQCqm.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-6I7lkraQ.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,4 +1,4 @@
1
- const require_logoutWithReason = require('./logoutWithReason-yDqQ0UIt.cjs');
1
+ const require_logoutWithReason = require('./logoutWithReason-B-ZF0VmN.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-qYPrnWF8.cjs.map
163
+ //# sourceMappingURL=migrateFromFireblocks-C23-24bK.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrateFromFireblocks-qYPrnWF8.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-C23-24bK.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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AAY,OAAO;AAEzB,QAAO"}
@@ -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-x8mE7EAy.esm.js";
1
+ import { A as DYNAMIC_WAAS_METADATA, D as isWaasWalletProvider, Tt as BaseError, gt as assertDefined, j as getWalletProviders, l as __refreshAuth_wrapped, o as getWalletProviderFromWalletAccount, s as NoWalletProviderFoundError, xt as getDefaultClient } from "./logoutWithReason-I6vShLpA.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-BapjEhra.esm.js.map
128
+ //# sourceMappingURL=migrateFromFireblocks-Dtk6t8hN.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrateFromFireblocks-BapjEhra.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,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,"file":"migrateFromFireblocks-Dtk6t8hN.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"}
@@ -35,7 +35,7 @@ export type GetCoinbaseAccountsParams = {
35
35
  * ```
36
36
  * @see createCoinbaseExchangeTransfer
37
37
  * @see GetCoinbaseAccountsParams
38
- * @notInstrumented
38
+ * @instrumented
39
39
  */
40
40
  export declare const getCoinbaseAccounts: (params?: GetCoinbaseAccountsParams, client?: import("../../../../exports").DynamicClient) => Promise<CoinbaseAccount[]>;
41
41
  //# sourceMappingURL=getCoinbaseAccounts.d.ts.map
@@ -5,7 +5,7 @@ import type { CoinbaseOnrampGetBuyUrlRequest, CoinbaseOnrampGetBuyUrlResponse }
5
5
  * @param buyUrlParams CoinbaseOnrampGetBuyUrlRequest - The parameters for the buy URL.
6
6
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
7
7
  * @returns an object containing the buy URL
8
- * @notInstrumented
8
+ * @instrumented
9
9
  */
10
10
  export declare const getCoinbaseBuyUrl: (buyUrlParams: CoinbaseOnrampGetBuyUrlRequest, client?: import("../../../../exports").DynamicClient) => Promise<CoinbaseOnrampGetBuyUrlResponse>;
11
11
  //# sourceMappingURL=getCoinbaseBuyUrl.d.ts.map
@@ -17,7 +17,7 @@ export type GetKrakenAccountsParams = {
17
17
  * @param [params] GetKrakenAccountsParams - Optional filters for the accounts.
18
18
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
19
19
  * @returns Array of Kraken accounts with balances
20
- * @notInstrumented
20
+ * @instrumented
21
21
  */
22
22
  export declare const getKrakenAccounts: (params?: GetKrakenAccountsParams, client?: import("../../../../exports").DynamicClient) => Promise<KrakenAccount[]>;
23
23
  //# sourceMappingURL=getKrakenAccounts.d.ts.map
@@ -4,7 +4,7 @@ import type { TransferDestinationResponse } from '../kraken.types';
4
4
  *
5
5
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
6
6
  * @returns Transfer destinations response with whitelisted addresses
7
- * @notInstrumented
7
+ * @instrumented
8
8
  */
9
9
  export declare const getKrakenWhitelistedAddresses: (client?: import("../../../../exports").DynamicClient) => Promise<TransferDestinationResponse>;
10
10
  //# sourceMappingURL=getKrakenWhitelistedAddresses.d.ts.map
@@ -0,0 +1,95 @@
1
+ import type { DynamicClient } from '../../../client/types';
2
+ /**
3
+ * A business-account intent: a signed statement of what the initiator is asking
4
+ * for. The enclave binds it to the change set actually submitted and verifies
5
+ * the signature against the `sessionPublicKey` claim in the caller's JWT, so a
6
+ * verified intent cannot be paired with a different mutation.
7
+ *
8
+ * There is deliberately no `expiresAt`. How long an intent stays redeemable is
9
+ * the account's governance to decide, measured from `createdAt` — an
10
+ * initiator-chosen expiry would be an initiator-chosen authorization lifetime.
11
+ */
12
+ export type BusinessAccountIntent = {
13
+ actionType: string;
14
+ businessAccountId: string;
15
+ createdAt: string;
16
+ initiatorUserId: string;
17
+ intentId: string;
18
+ payload: {
19
+ changeSet: Record<string, unknown>[];
20
+ };
21
+ };
22
+ type SignBusinessAccountIntentParams = {
23
+ intent: BusinessAccountIntent;
24
+ };
25
+ /** The signed intent and the signature over its canonical form. */
26
+ export type SignBusinessAccountIntentResult = {
27
+ intent: BusinessAccountIntent;
28
+ intentSignature: string;
29
+ };
30
+ /**
31
+ * Sign an intent with the session key.
32
+ *
33
+ * The signature is over the CANONICAL form, not over `JSON.stringify(intent)` —
34
+ * the enclave re-canonicalizes before verifying, so a signature over any other
35
+ * byte sequence will not verify. Nothing here chooses that byte sequence
36
+ * freely: it is fixed by `canonicalizeJson`.
37
+ *
38
+ * The private half never enters JS. `keychain.sign` holds a non-extractable
39
+ * key and returns a P1363 hex signature, which is the form the enclave's
40
+ * WebCrypto verify expects.
41
+ *
42
+ * @param params.intent - The intent to sign.
43
+ * @param client - The Dynamic client instance.
44
+ * @returns The intent alongside the P1363 hex signature over its canonical form.
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * const { intent, intentSignature } = await signBusinessAccountIntent({ intent: draftIntent });
49
+ * ```
50
+ *
51
+ * @see {@link signBusinessAccountApproval} for a co-signer approving this intent.
52
+ * @see {@link BusinessAccountIntent} for the shape being signed.
53
+ * @notInstrumented
54
+ */
55
+ export declare const signBusinessAccountIntent: ({ intent }: SignBusinessAccountIntentParams, client: DynamicClient) => Promise<SignBusinessAccountIntentResult>;
56
+ type SignBusinessAccountApprovalParams = {
57
+ /** Defaults to now. Accepted for tests and for a caller that has already
58
+ * recorded when the human consented. */
59
+ approvedAt?: string;
60
+ intent: BusinessAccountIntent;
61
+ };
62
+ /** An approval's signature and the timestamp it was signed over. */
63
+ export type SignBusinessAccountApprovalResult = {
64
+ approvedAt: string;
65
+ signature: string;
66
+ };
67
+ /**
68
+ * Sign an approval of someone else's intent.
69
+ *
70
+ * The payload is `{ approvedAt, intent }` rather than the intent alone, so each
71
+ * approver attests WHEN they consented as well as what to. The enclave measures
72
+ * the execution window from the latest of those timestamps, which it could not
73
+ * do from an unsigned value — a caller could simply claim a fresher one.
74
+ *
75
+ * Sent whether or not the account configures an execution window: a signed
76
+ * shape that varied with configuration would mean reading governance before
77
+ * knowing what to sign.
78
+ *
79
+ * @param params.intent - The intent being approved.
80
+ * @param params.approvedAt - When the approver consented. Defaults to now.
81
+ * @param client - The Dynamic client instance.
82
+ * @returns The timestamp signed over, alongside the P1363 hex signature.
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * const { approvedAt, signature } = await signBusinessAccountApproval({ intent });
87
+ * ```
88
+ *
89
+ * @see {@link signBusinessAccountIntent} for the initiator's own signature over the intent.
90
+ * @see {@link BusinessAccountIntent} for the shape being approved.
91
+ * @notInstrumented
92
+ */
93
+ export declare const signBusinessAccountApproval: ({ intent, approvedAt, }: SignBusinessAccountApprovalParams, client: DynamicClient) => Promise<SignBusinessAccountApprovalResult>;
94
+ export {};
95
+ //# sourceMappingURL=signBusinessAccountIntent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signBusinessAccountIntent.d.ts","sourceRoot":"","sources":["../../../../src/modules/sessionKeys/signBusinessAccountIntent/signBusinessAccountIntent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAM3D;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;KAAE,CAAC;CACnD,CAAC;AAEF,KAAK,+BAA+B,GAAG;IACrC,MAAM,EAAE,qBAAqB,CAAC;CAC/B,CAAC;AAEF,mEAAmE;AACnE,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,EAAE,qBAAqB,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,yBAAyB,eACxB,+BAA+B,UACnC,aAAa,KACpB,OAAO,CAAC,+BAA+B,CASzC,CAAC;AAEF,KAAK,iCAAiC,GAAG;IACvC;6CACyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,qBAAqB,CAAC;CAC/B,CAAC;AAEF,oEAAoE;AACpE,MAAM,MAAM,iCAAiC,GAAG;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,eAAO,MAAM,2BAA2B,4BAInC,iCAAiC,UAC5B,aAAa,KACpB,OAAO,CAAC,iCAAiC,CAY3C,CAAC"}
@@ -16,7 +16,9 @@ type AddMemberParams = {
16
16
  *
17
17
  * @param params.businessAccountId - The ID of the business account.
18
18
  * @param params.targetIdentity - The member to add (userId, or identifier + identifierType).
19
- * @param [params.role] - The member role (`admin` or `viewer`). Defaults to `viewer`.
19
+ * @param [params.role] - The member role: a built-in (`admin`, `viewer`) or a
20
+ * role this account defined. Defaults to `viewer`. `owner` is rejected — use
21
+ * `transferBusinessAccountOwnership`.
20
22
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
21
23
  * @returns The created business account member.
22
24
  * @notInstrumented
@@ -1 +1 @@
1
- {"version":3,"file":"addBusinessAccountMember.d.ts","sourceRoot":"","sources":["../../../../../src/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI9D,OAAO,KAAK,EACV,qBAAqB,EACrB,yBAAyB,EACzB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,KAAK,eAAe,GAAG;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,yBAAyB,CAAC;IACjC,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,wBAAwB,gDACU,eAAe,WACpD,aAAa,KACpB,OAAO,CAAC,qBAAqB,CA4B/B,CAAC"}
1
+ {"version":3,"file":"addBusinessAccountMember.d.ts","sourceRoot":"","sources":["../../../../../src/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI9D,OAAO,KAAK,EACV,qBAAqB,EACrB,yBAAyB,EACzB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,KAAK,eAAe,GAAG;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,yBAAyB,CAAC;IACjC,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,wBAAwB,gDACU,eAAe,WACpD,aAAa,KACpB,OAAO,CAAC,qBAAqB,CA2B/B,CAAC"}
@@ -1,7 +1,17 @@
1
1
  import type { WaasWalletAccount } from '../../waas.types';
2
- import type { BusinessAccountSignerType, TargetIdentity } from '../businessAccounts.types';
2
+ import type { BusinessAccountActionRequired, BusinessAccountMutationIntent, BusinessAccountSignerType, TargetIdentity } from '../businessAccounts.types';
3
+ type AddBusinessAccountSignerResult = {
4
+ shareSetId: string;
5
+ } | BusinessAccountActionRequired;
3
6
  type AddSignerParams = {
4
7
  businessAccountId?: string;
8
+ /**
9
+ * The initiator's signed proposal, when the account governs addSigner. The
10
+ * first call answers consent-pending with the bytes to sign; passing them
11
+ * back is what opens the proposal. Omit on the first call.
12
+ */
13
+ intent?: BusinessAccountMutationIntent;
14
+ intentSignature?: string;
5
15
  password?: string;
6
16
  signerType?: BusinessAccountSignerType;
7
17
  targetIdentity: TargetIdentity;
@@ -9,9 +19,6 @@ type AddSignerParams = {
9
19
  walletAccount: WaasWalletAccount;
10
20
  walletId?: string;
11
21
  };
12
- type AddBusinessAccountSignerResult = {
13
- shareSetId: string;
14
- };
15
22
  /**
16
23
  * Adds a signer to a business-account wallet via the reshare ceremony, minting
17
24
  * the new signer's share set. Identify the target by `userId`, or `identifier`
@@ -30,9 +37,11 @@ type AddBusinessAccountSignerResult = {
30
37
  * @param [params.password] - Password for the current signer's share, if it is password-encrypted.
31
38
  * @param [params.targetSignerPassword] - Password used to encrypt the new signer's share. Required when wallet passwords are required by the environment.
32
39
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
33
- * @returns The new signer's share set id.
40
+ * @returns The new signer's share set id, or a consent-pending answer when the
41
+ * account governs `addSignerToWallet` — the reshare has NOT run in that case.
42
+ * Narrow it with `isBusinessAccountActionRequired`.
34
43
  * @notInstrumented
35
44
  */
36
- export declare const addBusinessAccountSigner: ({ walletAccount, businessAccountId, walletId, targetIdentity, signerType, password, targetSignerPassword, }: AddSignerParams, client?: import("../../../../exports").DynamicClient) => Promise<AddBusinessAccountSignerResult>;
45
+ export declare const addBusinessAccountSigner: ({ walletAccount, businessAccountId, walletId, targetIdentity, signerType, password, targetSignerPassword, intent, intentSignature, }: AddSignerParams, client?: import("../../../../exports").DynamicClient) => Promise<AddBusinessAccountSignerResult>;
37
46
  export {};
38
47
  //# sourceMappingURL=addBusinessAccountSigner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addBusinessAccountSigner.d.ts","sourceRoot":"","sources":["../../../../../src/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAEV,yBAAyB,EACzB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,KAAK,eAAe,GAAG;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,yBAAyB,CAAC;IACvC,cAAc,EAAE,cAAc,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,8BAA8B,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,wBAAwB,gHAShC,eAAe,2DAEjB,OAAO,CAAC,8BAA8B,CA2DxC,CAAC"}
1
+ {"version":3,"file":"addBusinessAccountSigner.d.ts","sourceRoot":"","sources":["../../../../../src/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EACV,6BAA6B,EAE7B,6BAA6B,EAC7B,yBAAyB,EACzB,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,KAAK,8BAA8B,GAC/B;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GACtB,6BAA6B,CAAC;AAElC,KAAK,eAAe,GAAG;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,6BAA6B,CAAC;IACvC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,yBAAyB,CAAC;IACvC,cAAc,EAAE,cAAc,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,wBAAwB,yIAWhC,eAAe,2DAEjB,OAAO,CAAC,8BAA8B,CAgExC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { DynamicClient } from '../../../../client/types';
2
- import type { BusinessAccountDetail } from '../businessAccounts.types';
2
+ import type { BusinessAccountActionRequired, BusinessAccountDetail } from '../businessAccounts.types';
3
3
  type AddWalletParams = {
4
4
  businessAccountId?: string;
5
5
  walletId: string;
@@ -13,12 +13,16 @@ type AddWalletParams = {
13
13
  * mutation with no MPC step, so a rejection (e.g. a 422 resource-limit) surfaces
14
14
  * as a thrown error rather than stalling in the iframe bridge.
15
15
  *
16
+ * When the account governs `linkWallet`, nothing is written and the 202 body is
17
+ * returned instead — first the intent to sign, then the proposal collecting
18
+ * approvals. Narrow it with `isBusinessAccountActionRequired`.
19
+ *
16
20
  * @param [params.businessAccountId] - The business account to link to; found-or-created when omitted.
17
21
  * @param params.walletId - The ID of the wallet to link.
18
22
  * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
19
- * @returns The updated business account detail.
23
+ * @returns The updated business account detail, or the outstanding action required.
20
24
  * @notInstrumented
21
25
  */
22
- export declare const addWalletToBusinessAccount: ({ businessAccountId, walletId }: AddWalletParams, client?: DynamicClient) => Promise<BusinessAccountDetail>;
26
+ export declare const addWalletToBusinessAccount: ({ businessAccountId, walletId }: AddWalletParams, client?: DynamicClient) => Promise<BusinessAccountActionRequired | BusinessAccountDetail>;
23
27
  export {};
24
28
  //# sourceMappingURL=addWalletToBusinessAccount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addWalletToBusinessAccount.d.ts","sourceRoot":"","sources":["../../../../../src/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,KAAK,eAAe,GAAG;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,0BAA0B,oCACJ,eAAe,WACxC,aAAa,KACpB,OAAO,CAAC,qBAAqB,CAoB/B,CAAC"}
1
+ {"version":3,"file":"addWalletToBusinessAccount.d.ts","sourceRoot":"","sources":["../../../../../src/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI9D,OAAO,KAAK,EACV,6BAA6B,EAC7B,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,KAAK,eAAe,GAAG;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,oCACJ,eAAe,WACxC,aAAa,KACpB,OAAO,CAAC,6BAA6B,GAAG,qBAAqB,CA2C/D,CAAC"}
@@ -152,7 +152,45 @@ export type BusinessAccountList = {
152
152
  items?: BusinessAccount[];
153
153
  nextCursor?: string;
154
154
  };
155
- export type BusinessAccountMemberRole = 'owner' | 'admin' | 'viewer';
155
+ /**
156
+ * The roles every business account has, whatever else it defines.
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * const role: BuiltInBusinessAccountMemberRole = 'admin';
161
+ * ```
162
+ *
163
+ * @see {@link BusinessAccountMemberRole} for the full type, built-in or custom.
164
+ * @see {@link addBusinessAccountMember} for where a role is assigned.
165
+ */
166
+ export type BuiltInBusinessAccountMemberRole = 'owner' | 'admin' | 'viewer';
167
+ /**
168
+ * A role a member holds: a built-in, or one this account defined. Deliberately
169
+ * not a closed union — the set is per-account, and `listBusinessAccountRoles`
170
+ * is what enumerates it. The `string & {}` branch keeps editor completion for
171
+ * the built-ins while still accepting a custom name.
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * const role: BusinessAccountMemberRole = 'compliance-reviewer';
176
+ * ```
177
+ *
178
+ * @see {@link BuiltInBusinessAccountMemberRole} for the roles every account has.
179
+ * @see {@link addBusinessAccountMember} for where a role is assigned.
180
+ */
181
+ export type BusinessAccountMemberRole = BuiltInBusinessAccountMemberRole | (string & {});
182
+ /**
183
+ * The kind of identity a business-account signer is: a human (`endUser`) or a
184
+ * service account acting on the account's behalf (`server`).
185
+ *
186
+ * @example
187
+ * ```ts
188
+ * const signerType: BusinessAccountSignerType = 'server';
189
+ * ```
190
+ *
191
+ * @see {@link addBusinessAccountSigner} for where a signer's type is set.
192
+ * @see {@link BusinessAccountSigner} for the signer this describes.
193
+ */
156
194
  export type BusinessAccountSignerType = 'endUser' | 'server';
157
195
  export type BusinessAccountSignerIdentifierType = 'email' | 'phoneNumber' | 'externalUserId' | 'socialUsername' | 'socialAccountId' | 'id';
158
196
  export type SocialProvider = `${ProviderEnum}`;
@@ -167,6 +205,81 @@ export type TargetIdentity = {
167
205
  socialProvider?: SocialProvider;
168
206
  userId?: string;
169
207
  };
208
+ /**
209
+ * One governance rule and how close it is to being met.
210
+ *
211
+ * `satisfied` is authoritative — do NOT infer it from `approved >= required`. A
212
+ * rule can also mandate that particular roles approve, so the count alone can be
213
+ * met while the rule is not.
214
+ *
215
+ * @example
216
+ * ```ts
217
+ * const met = actionRequired.approvalRequirements?.every((r) => r.satisfied);
218
+ * ```
219
+ *
220
+ * @see {@link BusinessAccountActionRequired} for where these are reported.
221
+ * @see {@link isBusinessAccountActionRequired} for narrowing to a value that carries them.
222
+ */
223
+ export type BusinessAccountApprovalRequirement = {
224
+ action: string;
225
+ approved: number;
226
+ required: number;
227
+ requirementId: string;
228
+ satisfied: boolean;
229
+ unmetMandatoryRoles?: string[];
230
+ };
231
+ /**
232
+ * The bytes an initiator signs to authorize a governed mutation.
233
+ *
234
+ * Built by the API, never by the client: the enclave compares this change set to
235
+ * what the API submits by exact canonical equality, so sign the object verbatim.
236
+ * Re-serializing it can change the bytes and invalidate the signature.
237
+ *
238
+ * @example
239
+ * ```ts
240
+ * const { intent, intentSignature } = await signBusinessAccountIntent({ intent: actionRequired.intent });
241
+ * ```
242
+ *
243
+ * @see {@link signBusinessAccountIntent} for signing this intent.
244
+ * @see {@link BusinessAccountActionRequired} for where an unsigned intent is returned.
245
+ */
246
+ export type BusinessAccountMutationIntent = {
247
+ actionType: string;
248
+ autoExecute: boolean;
249
+ businessAccountId: string;
250
+ createdAt: string;
251
+ initiatorUserId: string;
252
+ intentId: string;
253
+ payload: {
254
+ changeSet: Record<string, unknown>[];
255
+ };
256
+ };
257
+ /**
258
+ * A governed action that has not been authorized yet. Not a failure: the caller
259
+ * may perform the action and simply has not collected the authorization it
260
+ * requires.
261
+ *
262
+ * `INTENT_REQUIRED` means nothing is signed yet — sign `intent` and resend.
263
+ * `APPROVALS_REQUIRED` means the intent is signed and recorded as `proposalId`,
264
+ * and `approvalRequirements` says what each rule still needs.
265
+ *
266
+ * @example
267
+ * ```ts
268
+ * const result = await addWalletToBusinessAccount({ walletId });
269
+ * if (isBusinessAccountActionRequired(result)) {
270
+ * await signBusinessAccountIntent({ intent: result.intent });
271
+ * }
272
+ * ```
273
+ *
274
+ * @see {@link isBusinessAccountActionRequired} for narrowing a mutation's result to this shape.
275
+ * @see {@link BusinessAccountMutationIntent} for the `intent` field's shape.
276
+ */
277
+ export type BusinessAccountActionRequired = {
278
+ approvalRequirements?: BusinessAccountApprovalRequirement[];
279
+ intent: BusinessAccountMutationIntent;
280
+ proposalId?: string;
281
+ reason: 'APPROVALS_REQUIRED' | 'INTENT_REQUIRED';
282
+ };
170
283
  export type BusinessAccountsApi = {
171
284
  addMember: (params: {
172
285
  businessAccountId: string;
@@ -184,7 +297,7 @@ export type BusinessAccountsApi = {
184
297
  addWalletToBusinessAccount: (params: {
185
298
  businessAccountId?: string;
186
299
  walletId: string;
187
- }) => Promise<BusinessAccountDetail>;
300
+ }) => Promise<BusinessAccountActionRequired | BusinessAccountDetail>;
188
301
  createBusinessAccount: (args?: {
189
302
  request?: {
190
303
  name?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"businessAccounts.types.d.ts","sourceRoot":"","sources":["../../../../src/modules/waas/businessAccounts/businessAccounts.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,eAAe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CAAC;QACvC,cAAc,EAAE,cAAc,CAAC;QAC/B,QAAQ,EAAE,MAAM,CAAC;KAClB,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACrC,0BAA0B,EAAE,CAAC,MAAM,EAAE;QACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,QAAQ,EAAE,MAAM,CAAC;KAClB,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACrC,qBAAqB,EAAE,CAAC,IAAI,CAAC,EAAE;QAC7B,OAAO,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,CAAC;KACpC,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IAC/B,kBAAkB,EAAE,CAAC,MAAM,EAAE;QAC3B,iBAAiB,EAAE,MAAM,CAAC;KAC3B,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACrC,oBAAoB,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1D,CAAC"}
1
+ {"version":3,"file":"businessAccounts.types.d.ts","sourceRoot":"","sources":["../../../../src/modules/waas/businessAccounts/businessAccounts.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,CAAC,EAAE,MAA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,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1D,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { isBusinessAccountActionRequired } from './isBusinessAccountActionRequired';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/modules/waas/businessAccounts/isBusinessAccountActionRequired/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC"}