@dynamic-labs-sdk/client 1.30.2 → 1.31.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 (348) hide show
  1. package/dist/{updateAuthFromVerifyResponse-CTvWpZLa.native.esm.js → apiClient-DpzKqY39.native.esm.js} +557 -465
  2. package/dist/apiClient-DpzKqY39.native.esm.js.map +1 -0
  3. package/dist/client/types/DynamicClient.d.ts +1 -1
  4. package/dist/client/types/DynamicClient.d.ts.map +1 -1
  5. package/dist/core.cjs +121 -61
  6. package/dist/core.cjs.map +1 -1
  7. package/dist/core.esm.js +64 -6
  8. package/dist/core.esm.js.map +1 -1
  9. package/dist/core.native.esm.js +64 -6
  10. package/dist/core.native.esm.js.map +1 -1
  11. package/dist/errors/WaasRbacStaleRetryUnsafeError.d.ts +36 -0
  12. package/dist/errors/WaasRbacStaleRetryUnsafeError.d.ts.map +1 -0
  13. package/dist/exports/core.d.ts +6 -0
  14. package/dist/exports/core.d.ts.map +1 -1
  15. package/dist/exports/index.d.ts +16 -4
  16. package/dist/exports/index.d.ts.map +1 -1
  17. package/dist/exports/waas.d.ts +3 -2
  18. package/dist/exports/waas.d.ts.map +1 -1
  19. package/dist/{getNetworkProviderFromNetworkId-CamHn2s3.esm.js → getNetworkProviderFromNetworkId-BN2jUhHm.esm.js} +8 -3
  20. package/dist/getNetworkProviderFromNetworkId-BN2jUhHm.esm.js.map +1 -0
  21. package/dist/{getNetworkProviderFromNetworkId-igDf2OPy.cjs → getNetworkProviderFromNetworkId-BoNAPSjx.cjs} +62 -51
  22. package/dist/getNetworkProviderFromNetworkId-BoNAPSjx.cjs.map +1 -0
  23. package/dist/{getNetworkProviderFromNetworkId--X0cb1ad.native.esm.js → getNetworkProviderFromNetworkId-DUym3Qq0.native.esm.js} +9 -4
  24. package/dist/getNetworkProviderFromNetworkId-DUym3Qq0.native.esm.js.map +1 -0
  25. package/dist/{getSignedSessionId-DGa_pu-i.cjs → getSignedSessionId-9ADIJCl1.cjs} +11 -11
  26. package/dist/{getSignedSessionId-DGa_pu-i.cjs.map → getSignedSessionId-9ADIJCl1.cjs.map} +1 -1
  27. package/dist/{getSignedSessionId--XNTxNFo.native.esm.js → getSignedSessionId-Dr4Ic68X.native.esm.js} +3 -3
  28. package/dist/{getSignedSessionId--XNTxNFo.native.esm.js.map → getSignedSessionId-Dr4Ic68X.native.esm.js.map} +1 -1
  29. package/dist/{getSignedSessionId-DY-ietfO.esm.js → getSignedSessionId-DxpqG4pv.esm.js} +3 -3
  30. package/dist/{getSignedSessionId-DY-ietfO.esm.js.map → getSignedSessionId-DxpqG4pv.esm.js.map} +1 -1
  31. package/dist/{getWalletProviderByKey-DzpmoNlv.cjs → getVerifiedCredentialForWalletAccount-C2o5idph.cjs} +10 -10
  32. package/dist/getVerifiedCredentialForWalletAccount-C2o5idph.cjs.map +1 -0
  33. package/dist/{getWalletProviderByKey-xqyD3ybv.esm.js → getVerifiedCredentialForWalletAccount-Cjwoeej7.esm.js} +10 -10
  34. package/dist/getVerifiedCredentialForWalletAccount-Cjwoeej7.esm.js.map +1 -0
  35. package/dist/index.cjs +677 -672
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.esm.js +47 -23
  38. package/dist/index.esm.js.map +1 -1
  39. package/dist/index.native.esm.js +47 -23
  40. package/dist/index.native.esm.js.map +1 -1
  41. package/dist/{isMfaRequiredForAction-CatS60F6.esm.js → isMfaRequiredForAction-BIBmJbV9.esm.js} +2 -2
  42. package/dist/isMfaRequiredForAction-BIBmJbV9.esm.js.map +1 -0
  43. package/dist/{isMfaRequiredForAction-BcJvy7Gw.native.esm.js → isMfaRequiredForAction-DuSU67yq.native.esm.js} +2 -2
  44. package/dist/isMfaRequiredForAction-DuSU67yq.native.esm.js.map +1 -0
  45. package/dist/{isMfaRequiredForAction-DKfoMhEk.cjs → isMfaRequiredForAction-yM84r7l7.cjs} +11 -11
  46. package/dist/isMfaRequiredForAction-yM84r7l7.cjs.map +1 -0
  47. package/dist/{isUserOnboardingComplete-BWVuE4Jg.native.esm.js → isUserOnboardingComplete-B2Ha2dkP.esm.js} +47 -4
  48. package/dist/isUserOnboardingComplete-B2Ha2dkP.esm.js.map +1 -0
  49. package/dist/{isUserOnboardingComplete-jv_idxWY.cjs → isUserOnboardingComplete-BRTOnK8V.cjs} +63 -14
  50. package/dist/isUserOnboardingComplete-BRTOnK8V.cjs.map +1 -0
  51. package/dist/{isUserOnboardingComplete-jkAQQVdP.esm.js → isUserOnboardingComplete-DCIlkCub.native.esm.js} +47 -4
  52. package/dist/isUserOnboardingComplete-DCIlkCub.native.esm.js.map +1 -0
  53. package/dist/{updateAuthFromVerifyResponse-BLgNMqwN.esm.js → logoutWithReason-DV89zJmJ.esm.js} +679 -587
  54. package/dist/logoutWithReason-DV89zJmJ.esm.js.map +1 -0
  55. package/dist/{updateAuthFromVerifyResponse-Dsw-eAro.cjs → logoutWithReason-DlA15deT.cjs} +691 -587
  56. package/dist/logoutWithReason-DlA15deT.cjs.map +1 -0
  57. package/dist/{getWalletProviderByKey-Cl6WDOoD.native.esm.js → logoutWithReason-HqGlUccb.native.esm.js} +19 -19
  58. package/dist/logoutWithReason-HqGlUccb.native.esm.js.map +1 -0
  59. package/dist/migrateFromFireblocks-CiOS4_Nq.esm.js +128 -0
  60. package/dist/migrateFromFireblocks-CiOS4_Nq.esm.js.map +1 -0
  61. package/dist/migrateFromFireblocks-CqIpxGRS.cjs +163 -0
  62. package/dist/migrateFromFireblocks-CqIpxGRS.cjs.map +1 -0
  63. package/dist/migrateFromFireblocks-DnQsGmIW.native.esm.js +128 -0
  64. package/dist/migrateFromFireblocks-DnQsGmIW.native.esm.js.map +1 -0
  65. package/dist/modules/apiClient/apiClient.types.d.ts +1 -1
  66. package/dist/modules/apiClient/apiClient.types.d.ts.map +1 -1
  67. package/dist/modules/apiClient/createApiClient.d.ts.map +1 -1
  68. package/dist/modules/apiClient/utils/rbacStaleMiddleware/createRbacStaleMiddleware.d.ts +10 -0
  69. package/dist/modules/apiClient/utils/rbacStaleMiddleware/createRbacStaleMiddleware.d.ts.map +1 -0
  70. package/dist/modules/auth/auth.types.d.ts +45 -0
  71. package/dist/modules/auth/auth.types.d.ts.map +1 -0
  72. package/dist/modules/auth/checkStepUpAuth/checkStepUpAuth.d.ts +2 -1
  73. package/dist/modules/auth/checkStepUpAuth/checkStepUpAuth.d.ts.map +1 -1
  74. package/dist/modules/auth/consts.d.ts +9 -0
  75. package/dist/modules/auth/consts.d.ts.map +1 -1
  76. package/dist/modules/auth/createVisit/createVisit.d.ts.map +1 -1
  77. package/dist/modules/auth/externalAuth/requestExternalAuthElevatedToken/requestExternalAuthElevatedToken.d.ts +1 -1
  78. package/dist/modules/auth/externalAuth/requestExternalAuthElevatedToken/requestExternalAuthElevatedToken.d.ts.map +1 -1
  79. package/dist/modules/auth/externalAuth/signInWithExternalJwt/signInWithExternalJwt.d.ts +1 -1
  80. package/dist/modules/auth/externalAuth/signInWithExternalJwt/signInWithExternalJwt.d.ts.map +1 -1
  81. package/dist/modules/auth/getActionAuthorizationTokens/getActionAuthorizationTokens.d.ts +2 -1
  82. package/dist/modules/auth/getActionAuthorizationTokens/getActionAuthorizationTokens.d.ts.map +1 -1
  83. package/dist/modules/auth/mergeUserAccounts/mergeUserAccounts.d.ts +4 -3
  84. package/dist/modules/auth/mergeUserAccounts/mergeUserAccounts.d.ts.map +1 -1
  85. package/dist/modules/auth/passkeys/getPasskeys/getPasskeys.d.ts +1 -1
  86. package/dist/modules/auth/passkeys/getPasskeys/getPasskeys.d.ts.map +1 -1
  87. package/dist/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts +2 -1
  88. package/dist/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts.map +1 -1
  89. package/dist/modules/auth/passkeys/serverAuthenticatePasskey/serverAuthenticatePasskey.d.ts +3 -1
  90. package/dist/modules/auth/passkeys/serverAuthenticatePasskey/serverAuthenticatePasskey.d.ts.map +1 -1
  91. package/dist/modules/auth/passkeys/serverRegisterPasskey/serverRegisterPasskey.d.ts +2 -1
  92. package/dist/modules/auth/passkeys/serverRegisterPasskey/serverRegisterPasskey.d.ts.map +1 -1
  93. package/dist/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts +1 -1
  94. package/dist/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts.map +1 -1
  95. package/dist/modules/auth/social/oauth/completeSocialAuthentication/completeSocialAuthentication.d.ts +1 -1
  96. package/dist/modules/auth/social/oauth/completeSocialAuthentication/completeSocialAuthentication.d.ts.map +1 -1
  97. package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.types.d.ts +1 -1
  98. package/dist/modules/auth/social/oauth/completeSocialRedirect/completeSocialRedirect.types.d.ts.map +1 -1
  99. package/dist/modules/auth/social/oauth/processSocialCallback/processSocialCallback.d.ts +1 -1
  100. package/dist/modules/auth/social/oauth/processSocialCallback/processSocialCallback.d.ts.map +1 -1
  101. package/dist/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.types.d.ts +1 -1
  102. package/dist/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.types.d.ts.map +1 -1
  103. package/dist/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts +1 -1
  104. package/dist/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts.map +1 -1
  105. package/dist/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.d.ts +1 -1
  106. package/dist/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.d.ts.map +1 -1
  107. package/dist/modules/balances/balances.types.d.ts +59 -0
  108. package/dist/modules/balances/balances.types.d.ts.map +1 -0
  109. package/dist/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.d.ts +1 -1
  110. package/dist/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.d.ts.map +1 -1
  111. package/dist/modules/balances/getTokenBalances/getTokenBalances.d.ts +1 -1
  112. package/dist/modules/balances/getTokenBalances/getTokenBalances.d.ts.map +1 -1
  113. package/dist/modules/checkout/broadcastCheckoutTransaction/broadcastCheckoutTransaction.d.ts +1 -1
  114. package/dist/modules/checkout/broadcastCheckoutTransaction/broadcastCheckoutTransaction.d.ts.map +1 -1
  115. package/dist/modules/checkout/checkout.types.d.ts +10 -2
  116. package/dist/modules/checkout/checkout.types.d.ts.map +1 -1
  117. package/dist/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.d.ts +1 -1
  118. package/dist/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.d.ts.map +1 -1
  119. package/dist/modules/deviceRegistration/deviceRegistration.types.d.ts +9 -0
  120. package/dist/modules/deviceRegistration/deviceRegistration.types.d.ts.map +1 -0
  121. package/dist/modules/deviceRegistration/getRegisteredDevices/getRegisteredDevices.d.ts +1 -1
  122. package/dist/modules/deviceRegistration/getRegisteredDevices/getRegisteredDevices.d.ts.map +1 -1
  123. package/dist/modules/funding/coinbase/coinbase.types.d.ts +2 -40
  124. package/dist/modules/funding/coinbase/coinbase.types.d.ts.map +1 -1
  125. package/dist/modules/funding/coinbase/createCoinbaseExchangeTransfer/createCoinbaseExchangeTransfer.d.ts +1 -1
  126. package/dist/modules/funding/coinbase/createCoinbaseExchangeTransfer/createCoinbaseExchangeTransfer.d.ts.map +1 -1
  127. package/dist/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/validateUserCredentialsForCoinbaseOnrampOrder.d.ts +2 -2
  128. package/dist/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/validateUserCredentialsForCoinbaseOnrampOrder.d.ts.map +1 -1
  129. package/dist/modules/funding/cryptoDotCom/cryptoDotCom.types.d.ts +2 -2
  130. package/dist/modules/funding/cryptoDotCom/cryptoDotCom.types.d.ts.map +1 -1
  131. package/dist/modules/funding/funding.types.d.ts +26 -0
  132. package/dist/modules/funding/funding.types.d.ts.map +1 -0
  133. package/dist/modules/funding/kraken/createKrakenExchangeTransfer/createKrakenExchangeTransfer.d.ts +4 -4
  134. package/dist/modules/funding/kraken/createKrakenExchangeTransfer/createKrakenExchangeTransfer.d.ts.map +1 -1
  135. package/dist/modules/mfa/authenticateMfaRecoveryCode/authenticateMfaRecoveryCode.d.ts +3 -1
  136. package/dist/modules/mfa/authenticateMfaRecoveryCode/authenticateMfaRecoveryCode.d.ts.map +1 -1
  137. package/dist/modules/mfa/authenticatePasskeyMFA/authenticatePasskeyMFA.d.ts +3 -1
  138. package/dist/modules/mfa/authenticatePasskeyMFA/authenticatePasskeyMFA.d.ts.map +1 -1
  139. package/dist/modules/mfa/authenticateTotpMfaDevice/authenticateTotpMfaDevice.d.ts +3 -1
  140. package/dist/modules/mfa/authenticateTotpMfaDevice/authenticateTotpMfaDevice.d.ts.map +1 -1
  141. package/dist/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.d.ts +1 -1
  142. package/dist/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.d.ts.map +1 -1
  143. package/dist/modules/mfa/getMfaDevices/getMfaDevices.d.ts +1 -1
  144. package/dist/modules/mfa/getMfaDevices/getMfaDevices.d.ts.map +1 -1
  145. package/dist/modules/mfa/getMfaMethods/getMfaMethods.d.ts +1 -1
  146. package/dist/modules/mfa/getMfaMethods/getMfaMethods.d.ts.map +1 -1
  147. package/dist/modules/mfa/getMfaRecoveryCodes/getMfaRecoveryCodes.d.ts +1 -1
  148. package/dist/modules/mfa/getMfaRecoveryCodes/getMfaRecoveryCodes.d.ts.map +1 -1
  149. package/dist/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.d.ts +1 -1
  150. package/dist/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.d.ts.map +1 -1
  151. package/dist/modules/mfa/mfa.consts.d.ts +10 -0
  152. package/dist/modules/mfa/mfa.consts.d.ts.map +1 -0
  153. package/dist/modules/mfa/mfa.types.d.ts +66 -1
  154. package/dist/modules/mfa/mfa.types.d.ts.map +1 -1
  155. package/dist/modules/mfa/registerTotpMfaDevice/registerTotpMfaDevice.d.ts +1 -1
  156. package/dist/modules/mfa/registerTotpMfaDevice/registerTotpMfaDevice.d.ts.map +1 -1
  157. package/dist/modules/otp/verifyOTP/verifyOTP.d.ts +2 -1
  158. package/dist/modules/otp/verifyOTP/verifyOTP.d.ts.map +1 -1
  159. package/dist/modules/otp/verifyOTP/verifyOTPForUserSignIn/verifyOTPForUserSignIn.d.ts +1 -1
  160. package/dist/modules/otp/verifyOTP/verifyOTPForUserSignIn/verifyOTPForUserSignIn.d.ts.map +1 -1
  161. package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts +1 -1
  162. package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts.map +1 -1
  163. package/dist/modules/projectSettings/projectSettings.types.d.ts +15 -0
  164. package/dist/modules/projectSettings/projectSettings.types.d.ts.map +1 -0
  165. package/dist/modules/simulation/simulation.types.d.ts +27 -1
  166. package/dist/modules/simulation/simulation.types.d.ts.map +1 -1
  167. package/dist/modules/storageSync/schema.d.ts +2 -2
  168. package/dist/modules/storageSync/schema.d.ts.map +1 -1
  169. package/dist/modules/swap/swap.types.d.ts +15 -2
  170. package/dist/modules/swap/swap.types.d.ts.map +1 -1
  171. package/dist/modules/user/refreshAuth/refreshAuth.d.ts +2 -2
  172. package/dist/modules/user/refreshAuth/refreshAuth.d.ts.map +1 -1
  173. package/dist/modules/user/refreshUser/refreshUser.d.ts +3 -3
  174. package/dist/modules/user/refreshUser/refreshUser.d.ts.map +1 -1
  175. package/dist/modules/user/user.consts.d.ts +19 -0
  176. package/dist/modules/user/user.consts.d.ts.map +1 -0
  177. package/dist/modules/user/user.types.d.ts +22 -2
  178. package/dist/modules/user/user.types.d.ts.map +1 -1
  179. package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts +4 -2
  180. package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts.map +1 -1
  181. package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts +1 -1
  182. package/dist/modules/waas/businessAccounts/businessAccounts.types.d.ts.map +1 -1
  183. package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
  184. package/dist/modules/waas/getWalletAccountShareSets/getWalletAccountShareSets.d.ts +2 -2
  185. package/dist/modules/waas/getWalletAccountShareSets/getWalletAccountShareSets.d.ts.map +1 -1
  186. package/dist/modules/waas/injectWaasVerifiedCredentialFields/injectWaasVerifiedCredentialFields.d.ts +3 -1
  187. package/dist/modules/waas/injectWaasVerifiedCredentialFields/injectWaasVerifiedCredentialFields.d.ts.map +1 -1
  188. package/dist/modules/waas/policies/applyPolicyLayerBatch/applyPolicyLayerBatch.d.ts +2 -1
  189. package/dist/modules/waas/policies/applyPolicyLayerBatch/applyPolicyLayerBatch.d.ts.map +1 -1
  190. package/dist/modules/waas/policies/buildAllowAddressesRule/buildAllowAddressesRule.d.ts +1 -2
  191. package/dist/modules/waas/policies/buildAllowAddressesRule/buildAllowAddressesRule.d.ts.map +1 -1
  192. package/dist/modules/waas/policies/buildAllowPolicyRule/buildAllowPolicyRule.d.ts +1 -2
  193. package/dist/modules/waas/policies/buildAllowPolicyRule/buildAllowPolicyRule.d.ts.map +1 -1
  194. package/dist/modules/waas/policies/buildBlockExportRule/buildBlockExportRule.d.ts +1 -2
  195. package/dist/modules/waas/policies/buildBlockExportRule/buildBlockExportRule.d.ts.map +1 -1
  196. package/dist/modules/waas/policies/buildDenyAddressesRule/buildDenyAddressesRule.d.ts +1 -2
  197. package/dist/modules/waas/policies/buildDenyAddressesRule/buildDenyAddressesRule.d.ts.map +1 -1
  198. package/dist/modules/waas/policies/buildDenyPolicyRule/buildDenyPolicyRule.d.ts +1 -2
  199. package/dist/modules/waas/policies/buildDenyPolicyRule/buildDenyPolicyRule.d.ts.map +1 -1
  200. package/dist/modules/waas/policies/buildMaxAmountPerTransactionRule/buildMaxAmountPerTransactionRule.d.ts +1 -2
  201. package/dist/modules/waas/policies/buildMaxAmountPerTransactionRule/buildMaxAmountPerTransactionRule.d.ts.map +1 -1
  202. package/dist/modules/waas/policies/buildOperationForExistingRule/buildOperationForExistingRule.d.ts +3 -2
  203. package/dist/modules/waas/policies/buildOperationForExistingRule/buildOperationForExistingRule.d.ts.map +1 -1
  204. package/dist/modules/waas/policies/buildOperationsForRule/buildOperationsForRule.d.ts +2 -2
  205. package/dist/modules/waas/policies/buildOperationsForRule/buildOperationsForRule.d.ts.map +1 -1
  206. package/dist/modules/waas/policies/createPolicy/createPolicy.d.ts +2 -1
  207. package/dist/modules/waas/policies/createPolicy/createPolicy.d.ts.map +1 -1
  208. package/dist/modules/waas/policies/desugarPolicyRules/desugarPolicyRules.d.ts +1 -2
  209. package/dist/modules/waas/policies/desugarPolicyRules/desugarPolicyRules.d.ts.map +1 -1
  210. package/dist/modules/waas/policies/expandPolicyRules/expandPolicyRules.d.ts +2 -2
  211. package/dist/modules/waas/policies/expandPolicyRules/expandPolicyRules.d.ts.map +1 -1
  212. package/dist/modules/waas/policies/fillOmittedRuleValues/fillOmittedRuleValues.d.ts +1 -2
  213. package/dist/modules/waas/policies/fillOmittedRuleValues/fillOmittedRuleValues.d.ts.map +1 -1
  214. package/dist/modules/waas/policies/findMatchedRuleKind/findMatchedRuleKind.d.ts +1 -2
  215. package/dist/modules/waas/policies/findMatchedRuleKind/findMatchedRuleKind.d.ts.map +1 -1
  216. package/dist/modules/waas/policies/getAccountPolicyLayer/getAccountPolicyLayer.d.ts +1 -1
  217. package/dist/modules/waas/policies/getAccountPolicyLayer/getAccountPolicyLayer.d.ts.map +1 -1
  218. package/dist/modules/waas/policies/getPolicy/getPolicy.d.ts +2 -2
  219. package/dist/modules/waas/policies/getPolicy/getPolicy.d.ts.map +1 -1
  220. package/dist/modules/waas/policies/getResolvedPolicyLayer/getResolvedPolicyLayer.d.ts +1 -1
  221. package/dist/modules/waas/policies/getResolvedPolicyLayer/getResolvedPolicyLayer.d.ts.map +1 -1
  222. package/dist/modules/waas/policies/getSignerPolicyLayer/getSignerPolicyLayer.d.ts +1 -1
  223. package/dist/modules/waas/policies/getSignerPolicyLayer/getSignerPolicyLayer.d.ts.map +1 -1
  224. package/dist/modules/waas/policies/getWalletPolicyLayer/getWalletPolicyLayer.d.ts +1 -1
  225. package/dist/modules/waas/policies/getWalletPolicyLayer/getWalletPolicyLayer.d.ts.map +1 -1
  226. package/dist/modules/waas/policies/hasAddresses/hasAddresses.d.ts +1 -1
  227. package/dist/modules/waas/policies/hasAddresses/hasAddresses.d.ts.map +1 -1
  228. package/dist/modules/waas/policies/hasUnrecognizedFields/hasUnrecognizedFields.d.ts +1 -1
  229. package/dist/modules/waas/policies/hasUnrecognizedFields/hasUnrecognizedFields.d.ts.map +1 -1
  230. package/dist/modules/waas/policies/isPolicyRuleDeletionMarker/isPolicyRuleDeletionMarker.d.ts +1 -2
  231. package/dist/modules/waas/policies/isPolicyRuleDeletionMarker/isPolicyRuleDeletionMarker.d.ts.map +1 -1
  232. package/dist/modules/waas/policies/matchExistingRules/matchExistingRules.d.ts +1 -1
  233. package/dist/modules/waas/policies/matchExistingRules/matchExistingRules.d.ts.map +1 -1
  234. package/dist/modules/waas/policies/policies.types.d.ts +17 -1
  235. package/dist/modules/waas/policies/policies.types.d.ts.map +1 -1
  236. package/dist/modules/waas/policies/policyRuleKinds.d.ts +1 -2
  237. package/dist/modules/waas/policies/policyRuleKinds.d.ts.map +1 -1
  238. package/dist/modules/waas/policies/readAllowAddressesRule/readAllowAddressesRule.d.ts +1 -2
  239. package/dist/modules/waas/policies/readAllowAddressesRule/readAllowAddressesRule.d.ts.map +1 -1
  240. package/dist/modules/waas/policies/readBlockExportRule/readBlockExportRule.d.ts +1 -2
  241. package/dist/modules/waas/policies/readBlockExportRule/readBlockExportRule.d.ts.map +1 -1
  242. package/dist/modules/waas/policies/readCoveredRule/readCoveredRule.d.ts +1 -2
  243. package/dist/modules/waas/policies/readCoveredRule/readCoveredRule.d.ts.map +1 -1
  244. package/dist/modules/waas/policies/readDenyAddressesRule/readDenyAddressesRule.d.ts +1 -2
  245. package/dist/modules/waas/policies/readDenyAddressesRule/readDenyAddressesRule.d.ts.map +1 -1
  246. package/dist/modules/waas/policies/readMaxAmountPerTransactionRule/readMaxAmountPerTransactionRule.d.ts +1 -2
  247. package/dist/modules/waas/policies/readMaxAmountPerTransactionRule/readMaxAmountPerTransactionRule.d.ts.map +1 -1
  248. package/dist/modules/waas/policies/removeAccountPolicyRule/removeAccountPolicyRule.d.ts +1 -1
  249. package/dist/modules/waas/policies/removeAccountPolicyRule/removeAccountPolicyRule.d.ts.map +1 -1
  250. package/dist/modules/waas/policies/removePolicyRules/removePolicyRules.d.ts +2 -1
  251. package/dist/modules/waas/policies/removePolicyRules/removePolicyRules.d.ts.map +1 -1
  252. package/dist/modules/waas/policies/removeSignerPolicyRule/removeSignerPolicyRule.d.ts +1 -1
  253. package/dist/modules/waas/policies/removeSignerPolicyRule/removeSignerPolicyRule.d.ts.map +1 -1
  254. package/dist/modules/waas/policies/removeWalletPolicyRule/removeWalletPolicyRule.d.ts +1 -1
  255. package/dist/modules/waas/policies/removeWalletPolicyRule/removeWalletPolicyRule.d.ts.map +1 -1
  256. package/dist/modules/waas/policies/resolveRuleName/resolveRuleName.d.ts +1 -2
  257. package/dist/modules/waas/policies/resolveRuleName/resolveRuleName.d.ts.map +1 -1
  258. package/dist/modules/waas/policies/sortRulesByRuleId/sortRulesByRuleId.d.ts +1 -1
  259. package/dist/modules/waas/policies/sortRulesByRuleId/sortRulesByRuleId.d.ts.map +1 -1
  260. package/dist/modules/waas/policies/upsertAccountPolicyRule/upsertAccountPolicyRule.d.ts +2 -1
  261. package/dist/modules/waas/policies/upsertAccountPolicyRule/upsertAccountPolicyRule.d.ts.map +1 -1
  262. package/dist/modules/waas/policies/upsertSignerPolicyRule/upsertSignerPolicyRule.d.ts +2 -1
  263. package/dist/modules/waas/policies/upsertSignerPolicyRule/upsertSignerPolicyRule.d.ts.map +1 -1
  264. package/dist/modules/waas/policies/upsertWalletPolicyRule/upsertWalletPolicyRule.d.ts +2 -1
  265. package/dist/modules/waas/policies/upsertWalletPolicyRule/upsertWalletPolicyRule.d.ts.map +1 -1
  266. package/dist/modules/waas/waas.consts.d.ts +23 -0
  267. package/dist/modules/waas/waas.consts.d.ts.map +1 -0
  268. package/dist/modules/waas/waas.types.d.ts +30 -1
  269. package/dist/modules/waas/waas.types.d.ts.map +1 -1
  270. package/dist/modules/wallets/getWalletAccounts/getWalletAccountsFromState/getWalletAccountsFromState.d.ts +2 -2
  271. package/dist/modules/wallets/getWalletAccounts/getWalletAccountsFromState/getWalletAccountsFromState.d.ts.map +1 -1
  272. package/dist/modules/wallets/networks/getTransactionHistory/getTransactionHistory.d.ts +2 -2
  273. package/dist/modules/wallets/networks/getTransactionHistory/getTransactionHistory.d.ts.map +1 -1
  274. package/dist/modules/wallets/screenTransaction/screenTransaction.d.ts +1 -1
  275. package/dist/modules/wallets/screenTransaction/screenTransaction.d.ts.map +1 -1
  276. package/dist/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.d.ts +2 -2
  277. package/dist/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.d.ts.map +1 -1
  278. package/dist/modules/wallets/userHasExternalWallet/userHasExternalWallet.d.ts +2 -2
  279. package/dist/modules/wallets/userHasExternalWallet/userHasExternalWallet.d.ts.map +1 -1
  280. package/dist/modules/wallets/utils/formatWalletProviderKey/formatWalletProviderKey.d.ts +1 -1
  281. package/dist/modules/wallets/utils/formatWalletProviderKey/formatWalletProviderKey.d.ts.map +1 -1
  282. package/dist/modules/wallets/verifyMessageSignatureOwnership/verifyMessageSignatureOwnership.d.ts +5 -3
  283. package/dist/modules/wallets/verifyMessageSignatureOwnership/verifyMessageSignatureOwnership.d.ts.map +1 -1
  284. package/dist/modules/wallets/verifyWalletAccount/verifyWalletAccount.d.ts +1 -1
  285. package/dist/modules/wallets/verifyWalletAccount/verifyWalletAccount.d.ts.map +1 -1
  286. package/dist/modules/wallets/verifyWalletAccountForSignInOrTransfer/verifyWalletAccountForSignInOrTransfer.d.ts +1 -1
  287. package/dist/modules/wallets/verifyWalletAccountForSignInOrTransfer/verifyWalletAccountForSignInOrTransfer.d.ts.map +1 -1
  288. package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts +4 -2
  289. package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts.map +1 -1
  290. package/dist/modules/wallets/wallets.types.d.ts +47 -0
  291. package/dist/modules/wallets/wallets.types.d.ts.map +1 -0
  292. package/dist/modules/yield/yield.types.d.ts +8 -0
  293. package/dist/modules/yield/yield.types.d.ts.map +1 -1
  294. package/dist/services/eventEmitter/createEventEmitter.d.ts +3 -2
  295. package/dist/services/eventEmitter/createEventEmitter.d.ts.map +1 -1
  296. package/dist/services/eventEmitter/index.d.ts +1 -1
  297. package/dist/services/eventEmitter/index.d.ts.map +1 -1
  298. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  299. package/dist/utils/createSequenceQueue/createSequenceQueue.d.ts +52 -0
  300. package/dist/utils/createSequenceQueue/createSequenceQueue.d.ts.map +1 -0
  301. package/dist/utils/createSequenceQueue/index.d.ts +3 -0
  302. package/dist/utils/createSequenceQueue/index.d.ts.map +1 -0
  303. package/dist/waas-BOKafCeH.cjs +2467 -0
  304. package/dist/waas-BOKafCeH.cjs.map +1 -0
  305. package/dist/waas-CUDgU2pl.esm.js +2150 -0
  306. package/dist/waas-CUDgU2pl.esm.js.map +1 -0
  307. package/dist/waas-CkQYVo6U.native.esm.js +2150 -0
  308. package/dist/waas-CkQYVo6U.native.esm.js.map +1 -0
  309. package/dist/waas.cjs +60 -2185
  310. package/dist/waas.esm.js +5 -2126
  311. package/dist/waas.native.esm.js +5 -2126
  312. package/dist/waasCore.cjs +76 -44
  313. package/dist/waasCore.cjs.map +1 -1
  314. package/dist/waasCore.esm.js +56 -24
  315. package/dist/waasCore.esm.js.map +1 -1
  316. package/dist/waasCore.native.esm.js +56 -24
  317. package/dist/waasCore.native.esm.js.map +1 -1
  318. package/package.json +5 -5
  319. package/dist/getNetworkProviderFromNetworkId--X0cb1ad.native.esm.js.map +0 -1
  320. package/dist/getNetworkProviderFromNetworkId-CamHn2s3.esm.js.map +0 -1
  321. package/dist/getNetworkProviderFromNetworkId-igDf2OPy.cjs.map +0 -1
  322. package/dist/getWalletProviderByKey-Cl6WDOoD.native.esm.js.map +0 -1
  323. package/dist/getWalletProviderByKey-DzpmoNlv.cjs.map +0 -1
  324. package/dist/getWalletProviderByKey-xqyD3ybv.esm.js.map +0 -1
  325. package/dist/isDynamicWaasEnabled-CMccs1-6.cjs +0 -136
  326. package/dist/isDynamicWaasEnabled-CMccs1-6.cjs.map +0 -1
  327. package/dist/isDynamicWaasEnabled-DSqgpEcX.native.esm.js +0 -113
  328. package/dist/isDynamicWaasEnabled-DSqgpEcX.native.esm.js.map +0 -1
  329. package/dist/isDynamicWaasEnabled-DYORq7Jc.esm.js +0 -113
  330. package/dist/isDynamicWaasEnabled-DYORq7Jc.esm.js.map +0 -1
  331. package/dist/isMfaRequiredForAction-BcJvy7Gw.native.esm.js.map +0 -1
  332. package/dist/isMfaRequiredForAction-CatS60F6.esm.js.map +0 -1
  333. package/dist/isMfaRequiredForAction-DKfoMhEk.cjs.map +0 -1
  334. package/dist/isUserOnboardingComplete-BWVuE4Jg.native.esm.js.map +0 -1
  335. package/dist/isUserOnboardingComplete-jkAQQVdP.esm.js.map +0 -1
  336. package/dist/isUserOnboardingComplete-jv_idxWY.cjs.map +0 -1
  337. package/dist/migrateFromFireblocks-B-WUs34v.native.esm.js +0 -65
  338. package/dist/migrateFromFireblocks-B-WUs34v.native.esm.js.map +0 -1
  339. package/dist/migrateFromFireblocks-D4E9bT2H.esm.js +0 -65
  340. package/dist/migrateFromFireblocks-D4E9bT2H.esm.js.map +0 -1
  341. package/dist/migrateFromFireblocks-zp5Jbq2J.cjs +0 -82
  342. package/dist/migrateFromFireblocks-zp5Jbq2J.cjs.map +0 -1
  343. package/dist/updateAuthFromVerifyResponse-BLgNMqwN.esm.js.map +0 -1
  344. package/dist/updateAuthFromVerifyResponse-CTvWpZLa.native.esm.js.map +0 -1
  345. package/dist/updateAuthFromVerifyResponse-Dsw-eAro.cjs.map +0 -1
  346. package/dist/waas.cjs.map +0 -1
  347. package/dist/waas.esm.js.map +0 -1
  348. package/dist/waas.native.esm.js.map +0 -1
package/dist/waas.esm.js CHANGED
@@ -1,2127 +1,6 @@
1
- import { Ct as name, F as getChainFromVerifiedCredentialChain, K as createApiClient, M as getWalletAccounts, N as formatWalletProviderKey, O as NoWalletProviderFoundError, St as getCore, a as InvalidParamError, c as findWaasWalletProviderByChain, f as DYNAMIC_WAAS_METADATA, ft as assertDefined, h as __logoutWithReason_wrapped, l as isWaasWalletProvider, s as isWaasWalletAccount, vt as getDefaultClient, wt as version } from "./updateAuthFromVerifyResponse-BLgNMqwN.esm.js";
2
- import { i as __refreshAuth_wrapped, n as TransactionBroadcastError, t as isDynamicWaasEnabled } from "./isDynamicWaasEnabled-DYORq7Jc.esm.js";
3
- import { n as getVerifiedCredentialForWalletAccount, t as getWalletProviderByKey } from "./getWalletProviderByKey-xqyD3ybv.esm.js";
4
- import { n as getWaasWalletProviderFromWalletAccount, r as NotWaasWalletProviderError, t as migrateFromFireblocks } from "./migrateFromFireblocks-D4E9bT2H.esm.js";
5
- import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
6
- import { AssignableBusinessAccountMemberRole, JwtVerifiedCredentialFormatEnum, TokenScope, UserIdentifierTypeEnum, WaasPolicyLayerRuleOperationOpEnum, WaasPolicyLayerUpdateRequestOpEnum, WaasPolicyRuleType, WaasSignerPolicyLayerUpdateRequestOpEnum, WaasWalletShareSetType, WaasWalletShareSetType as WaasWalletShareSetType$1, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
1
+ import { w as isWaasWalletAccount } from "./logoutWithReason-DV89zJmJ.esm.js";
2
+ import { a as TransactionBroadcastError, n as isDynamicWaasEnabled, o as NotWaasWalletProviderError, t as migrateFromFireblocks } from "./migrateFromFireblocks-CiOS4_Nq.esm.js";
3
+ import { $ as WaasWalletShareSetType, A as getChainsMissingWaasWalletAccounts, B as isWalletCreationRequirement, C as importWaasPrivateKey, D as getWalletAccountShareSets, E as getWalletPolicyLayer, F as desugarPolicyRules, G as createBusinessAccount, H as createPolicy, I as delegateWaasKeyShares, J as backupWaasKeySharesToGoogleDrive, K as buildDenyPolicyRule, L as createWalletForBusinessAccount, M as getAccountPolicyLayer, N as exportWaasPrivateKey, O as getSignerPolicyLayer, P as exportWaasClientKeyshares, Q as WaasChainEnum, R as createWaasWalletAccounts, S as isPasswordRequiredForWaasWallets, T as getWalletRecoveryState, U as resolvePolicyScope, V as createWaasOfflineRecoveryShares, W as expandPolicyRules, X as addBusinessAccountSigner, Y as addWalletToBusinessAccount, Z as addBusinessAccountMember, _ as removeBusinessAccountSigner, a as updateBusinessAccountMemberRole, b as refreshWaasWalletAccountShares, c as transferBusinessAccountOwnership, d as setWaasWalletAccountPassword, f as revokeWaasDelegation, g as removeBusinessAccountWallet, h as removePolicyRules, i as updateWaasPassword, j as getBusinessAccount, k as getPolicy, l as signSerializedTransaction, m as removeSignerPolicyRule, n as upsertSignerPolicyRule, o as updateBusinessAccount, p as removeWalletPolicyRule, q as buildAllowPolicyRule, r as upsertAccountPolicyRule, s as unlockWallet, t as upsertWalletPolicyRule, u as shouldAutoCreateWalletForChain, v as removeBusinessAccountMember, w as hasDelegatedAccess, x as listBusinessAccounts, y as removeAccountPolicyRule, z as normalizeWalletRequirements } from "./waas-CUDgU2pl.esm.js";
4
+ import "./getVerifiedCredentialForWalletAccount-Cjwoeej7.esm.js";
7
5
 
8
- //#region src/modules/waas/businessAccounts/assertTargetIdentity.ts
9
- /**
10
- * Asserts a {@link TargetIdentity} resolves to a user: a `userId`, or an
11
- * `identifier` with its `identifierType`. Throws otherwise.
12
- *
13
- * @notInstrumented
14
- */
15
- const assertTargetIdentity = ({ fnName, targetIdentity }) => {
16
- const hasUserId = Boolean(targetIdentity.userId);
17
- const hasIdentifier = Boolean(targetIdentity.identifier && targetIdentity.identifierType);
18
- if (!hasUserId && !hasIdentifier) throw new InvalidParamError(`${fnName}: targetIdentity must provide a userId, or an identifier with its identifierType`);
19
- };
20
-
21
- //#endregion
22
- //#region src/modules/waas/businessAccounts/businessAccounts.constants.ts
23
- /** Maps the SDK's identifier-type union to the generated API enum. */
24
- const IDENTIFIER_TYPE_TO_API = {
25
- email: UserIdentifierTypeEnum.Email,
26
- externalUserId: UserIdentifierTypeEnum.ExternalUserId,
27
- id: UserIdentifierTypeEnum.Id,
28
- phoneNumber: UserIdentifierTypeEnum.PhoneNumber,
29
- socialAccountId: UserIdentifierTypeEnum.SocialAccountId,
30
- socialUsername: UserIdentifierTypeEnum.SocialUsername
31
- };
32
-
33
- //#endregion
34
- //#region src/modules/waas/businessAccounts/addBusinessAccountMember/addBusinessAccountMember.ts
35
- /**
36
- * Adds a member to an existing business account. Identify the target with a
37
- * `targetIdentity`: a known `userId`, or an `identifier` + `identifierType`
38
- * (e.g. an email — the user is created if absent).
39
- *
40
- * Calls the SDK API directly (not the WaaS iframe): this is a server-state
41
- * mutation with no MPC step, so a rejection (e.g. a 422 resource-limit) surfaces
42
- * as a thrown error rather than stalling in the iframe bridge.
43
- *
44
- * @param params.businessAccountId - The ID of the business account.
45
- * @param params.targetIdentity - The member to add (userId, or identifier + identifierType).
46
- * @param [params.role] - The member role (`admin` or `viewer`). Defaults to `viewer`.
47
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
48
- * @returns The created business account member.
49
- * @notInstrumented
50
- */
51
- const addBusinessAccountMember = async ({ businessAccountId, targetIdentity, role }, client = getDefaultClient()) => {
52
- assertTargetIdentity({
53
- fnName: "addBusinessAccountMember",
54
- targetIdentity
55
- });
56
- const core = getCore(client);
57
- const apiClient = createApiClient({ elevatedAccessTokenScope: TokenScope.BusinessAccountmemberadd }, client);
58
- const { userId, identifier, identifierType, socialProvider, smsCountryCode } = targetIdentity;
59
- return await apiClient.sdkAddBusinessAccountMember({
60
- addBusinessAccountMemberSdkRequest: {
61
- identifier,
62
- role: role === "admin" ? AssignableBusinessAccountMemberRole.Admin : AssignableBusinessAccountMemberRole.Viewer,
63
- smsCountryCode,
64
- socialProvider,
65
- type: identifierType ? IDENTIFIER_TYPE_TO_API[identifierType] : void 0,
66
- userId
67
- },
68
- businessAccountId,
69
- environmentId: core.environmentId
70
- });
71
- };
72
-
73
- //#endregion
74
- //#region src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.ts
75
- /** @notInstrumented */
76
- const getWaasWalletProviderByChain = ({ chain }, client) => {
77
- const waasProvider = findWaasWalletProviderByChain({ chain }, client);
78
- if (!waasProvider) throw new NoWalletProviderFoundError({ walletProviderKey: formatWalletProviderKey({
79
- chain,
80
- displayName: DYNAMIC_WAAS_METADATA.displayName,
81
- walletProviderType: WalletProviderEnum.EmbeddedWallet
82
- }) });
83
- return waasProvider;
84
- };
85
-
86
- //#endregion
87
- //#region src/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.ts
88
- /**
89
- * Adds a signer to a business-account wallet via the reshare ceremony, minting
90
- * the new signer's share set. Identify the target by `userId`, or `identifier`
91
- * + `identifierType` (the user is created if absent).
92
- *
93
- * Omit `businessAccountId` to add a signer to a wallet that isn't in a business
94
- * account yet: the wallet's per-account is found-or-created first (idempotent —
95
- * converts the personal wallet, seating its owner as the first signer), then
96
- * the new signer is reshared in.
97
- *
98
- * @param params.walletAccount - The wallet account to add the signer to.
99
- * @param [params.businessAccountId] - The business account; found-or-created when omitted.
100
- * @param [params.walletId] - The wallet UUID to link when finding-or-creating; defaults to `walletAccount.verifiedCredentialId`.
101
- * @param params.targetIdentity - The signer to add (userId, or identifier + identifierType).
102
- * @param [params.signerType] - `endUser` (default) or `server`.
103
- * @param [params.password] - Password for the reshare, if the wallet is password-encrypted.
104
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
105
- * @returns The new signer's share set id.
106
- * @notInstrumented
107
- */
108
- const addBusinessAccountSigner = async ({ walletAccount, businessAccountId, walletId, targetIdentity, signerType, password }, client = getDefaultClient()) => {
109
- assertTargetIdentity({
110
- fnName: "addBusinessAccountSigner",
111
- targetIdentity
112
- });
113
- if (walletAccount.businessAccountId) assertDefined(businessAccountId, "addBusinessAccountSigner: this wallet is already part of a business account");
114
- let resolvedBusinessAccountId = businessAccountId;
115
- if (!resolvedBusinessAccountId) {
116
- const linkWalletId = walletId ?? walletAccount.verifiedCredentialId;
117
- assertDefined(linkWalletId, "addBusinessAccountSigner: cannot resolve a wallet id to link — pass walletId, or use a verified wallet account");
118
- const core = getCore(client);
119
- resolvedBusinessAccountId = (await createApiClient({ elevatedAccessTokenScope: TokenScope.BusinessAccountsigneradd }, client).sdkLinkBusinessAccountWallet({
120
- environmentId: core.environmentId,
121
- linkBusinessAccountWalletSdkRequest: { walletId: linkWalletId }
122
- })).id;
123
- }
124
- const result = await getWaasWalletProviderByChain({ chain: walletAccount.chain }, client).reshareToNewSignerShareSet({
125
- businessAccountId: resolvedBusinessAccountId,
126
- password,
127
- signerType,
128
- targetSignerIdentity: targetIdentity,
129
- walletAccount
130
- });
131
- await __refreshAuth_wrapped(client);
132
- return result;
133
- };
134
-
135
- //#endregion
136
- //#region src/modules/waas/businessAccounts/addWalletToBusinessAccount/addWalletToBusinessAccount.ts
137
- /**
138
- * Links a wallet to a business account, or omit `businessAccountId` to
139
- * find-or-create the per-wallet business account (the server seats the wallet's
140
- * owner as the first member/signer).
141
- *
142
- * Calls the SDK API directly (not the WaaS iframe): this is a server-state
143
- * mutation with no MPC step, so a rejection (e.g. a 422 resource-limit) surfaces
144
- * as a thrown error rather than stalling in the iframe bridge.
145
- *
146
- * @param [params.businessAccountId] - The business account to link to; found-or-created when omitted.
147
- * @param params.walletId - The ID of the wallet to link.
148
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
149
- * @returns The updated business account detail.
150
- * @notInstrumented
151
- */
152
- const addWalletToBusinessAccount = async ({ businessAccountId, walletId }, client = getDefaultClient()) => {
153
- const core = getCore(client);
154
- const detail = await createApiClient({ elevatedAccessTokenScope: TokenScope.BusinessAccountlinkWallet }, client).sdkLinkBusinessAccountWallet({
155
- environmentId: core.environmentId,
156
- linkBusinessAccountWalletSdkRequest: {
157
- businessAccountId,
158
- walletId
159
- }
160
- });
161
- await __refreshAuth_wrapped(client);
162
- return detail;
163
- };
164
-
165
- //#endregion
166
- //#region src/modules/waas/backupWaasKeySharesToGoogleDrive/backupWaasKeySharesToGoogleDrive.ts
167
- /**
168
- * Backs up WaaS wallet key shares to Google Drive for secure recovery.
169
- *
170
- * This function creates a backup of the wallet's cryptographic key shares
171
- * to Google Drive, allowing users to recover their wallet later.
172
- *
173
- * @param params.walletAccount - The WaaS wallet account to backup.
174
- * @param [params.password] - Optional password to encrypt the backup.
175
- * @param [params.googleDriveAccessToken] - Optional consumer-supplied Drive-scoped access token; used directly instead of the stored OAuth token (avoids a second Google consent). Useful for external-auth setups.
176
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
177
- * @returns A promise that resolves when the backup process is complete.
178
- * @notInstrumented
179
- */
180
- const backupWaasKeySharesToGoogleDrive = async ({ googleDriveAccessToken, password, walletAccount }, client = getDefaultClient()) => {
181
- return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).backupKeySharesToGoogleDrive({
182
- googleDriveAccessToken,
183
- password,
184
- walletAccount
185
- });
186
- };
187
-
188
- //#endregion
189
- //#region src/modules/waas/policies/buildAllowPolicyRule/buildAllowPolicyRule.ts
190
- /**
191
- * Builds a policy rule that permits the described action.
192
- *
193
- * @param rule - The rule fields (name, chain, and any targeting/limit fields).
194
- * @returns A `WaasPolicyRule` with `ruleType` set to `allow`.
195
- * @notInstrumented
196
- */
197
- const buildAllowPolicyRule = (rule) => ({
198
- ...rule,
199
- ruleType: WaasPolicyRuleType.Allow
200
- });
201
-
202
- //#endregion
203
- //#region src/modules/waas/policies/buildDenyPolicyRule/buildDenyPolicyRule.ts
204
- /**
205
- * Builds a policy rule that blocks the described action.
206
- *
207
- * @param rule - The rule fields (name, chain, and any targeting/limit fields).
208
- * @returns A `WaasPolicyRule` with `ruleType` set to `deny`.
209
- * @notInstrumented
210
- */
211
- const buildDenyPolicyRule = (rule) => ({
212
- ...rule,
213
- ruleType: WaasPolicyRuleType.Deny
214
- });
215
-
216
- //#endregion
217
- //#region src/modules/waas/businessAccounts/createBusinessAccount/createBusinessAccount.ts
218
- /**
219
- * Creates a new business account.
220
- *
221
- * @param [params] - Optional parameters for the business account.
222
- * @param [params.name] - Optional name for the business account.
223
- * @param [params.externalRef] - Optional developer-supplied label (not unique; accounts may share one).
224
- * @param [params.metadata] - Optional arbitrary key-value metadata.
225
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
226
- * @returns The created business account.
227
- * @notInstrumented
228
- */
229
- const createBusinessAccount = async (params, client = getDefaultClient()) => {
230
- const core = getCore(client);
231
- const result = await createApiClient({}, client).sdkCreateBusinessAccount({
232
- createBusinessAccountSdkRequest: {
233
- externalRef: params?.externalRef,
234
- metadata: params?.metadata,
235
- name: params?.name
236
- },
237
- environmentId: core.environmentId
238
- });
239
- await __refreshAuth_wrapped(client);
240
- return result;
241
- };
242
-
243
- //#endregion
244
- //#region src/modules/waas/policies/applyPolicyLayerBatch/applyPolicyLayerBatch.ts
245
- /**
246
- * Applies a batch of rule operations to the policy layer a
247
- * {@link ResolvedPolicyScope} points at, atomically in one enclave cycle.
248
- * Shared by {@link createPolicy} and {@link removePolicyRules} so the
249
- * account-vs-wallet-vs-signer branch is written once.
250
- *
251
- * @notInstrumented
252
- */
253
- const applyPolicyLayerBatch = ({ operations, resolvedScope }, client) => {
254
- const { environmentId } = getCore(client);
255
- const apiClient = createApiClient({}, client);
256
- switch (resolvedScope.target) {
257
- case "account": return apiClient.updateBusinessAccountPolicyLayer({
258
- businessAccountId: resolvedScope.businessAccountId,
259
- environmentId,
260
- waasPolicyLayerUpdateRequest: {
261
- op: WaasPolicyLayerUpdateRequestOpEnum.Batch,
262
- operations
263
- }
264
- });
265
- case "wallet": return apiClient.updateWaasWalletSelfPolicyLayer({
266
- environmentId,
267
- waasPolicyLayerUpdateRequest: {
268
- op: WaasPolicyLayerUpdateRequestOpEnum.Batch,
269
- operations
270
- },
271
- walletId: resolvedScope.walletId
272
- });
273
- case "signer": return apiClient.updateWaasSignerSelfPolicyLayer({
274
- environmentId,
275
- waasSignerPolicyLayerUpdateRequest: {
276
- op: WaasSignerPolicyLayerUpdateRequestOpEnum.Batch,
277
- operations,
278
- shareSetId: resolvedScope.shareSetId
279
- },
280
- walletId: resolvedScope.walletId
281
- });
282
- default: {
283
- const unhandledScope = resolvedScope;
284
- throw new InvalidParamError(`applyPolicyLayerBatch: unhandled target "${JSON.stringify(unhandledScope)}"`);
285
- }
286
- }
287
- };
288
-
289
- //#endregion
290
- //#region src/utils/objectKeys/objectKeys.ts
291
- /**
292
- * Typed `Object.keys` — returns `(keyof T)[]` instead of `string[]`, for
293
- * objects whose key set is fully known at the type level.
294
- *
295
- * @notInstrumented
296
- */
297
- const objectKeys = (value) => Object.keys(value);
298
-
299
- //#endregion
300
- //#region src/modules/waas/policies/buildValueLimit/buildValueLimit.ts
301
- /**
302
- * Turns a {@link PolicyRuleMaxAmountPerTransaction} into the `valueLimit` shape a rule stores it as.
303
- * @notInstrumented
304
- */
305
- const buildValueLimit = ({ amount, asset }) => ({
306
- asset,
307
- maxPerCall: amount
308
- });
309
-
310
- //#endregion
311
- //#region src/modules/waas/policies/policyRuleDefaultNames.ts
312
- /**
313
- * Each rule kind's name when the caller doesn't override it via
314
- * `PolicyRules['names']`. Shared between the `build*Rule` functions and
315
- * `desugarPolicyRules` so a rename can't drift the two out of sync — the
316
- * same reason `RULE_KINDS` in `policyRuleKinds.ts` is a single table
317
- * instead of parallel switches.
318
- */
319
- const DEFAULT_POLICY_RULE_NAMES = {
320
- allowAddresses: "Allowed addresses",
321
- blockExport: "Block key export",
322
- denyAddresses: "Denied addresses",
323
- maxAmountPerTransaction: "Per-transaction cap"
324
- };
325
-
326
- //#endregion
327
- //#region src/modules/waas/policies/buildAllowAddressesRule/buildAllowAddressesRule.ts
328
- /**
329
- * Builds the `allowAddresses` rule, absorbing a sibling
330
- * `maxAmountPerTransaction` onto the same rule instead of letting it emit
331
- * its own — see `buildMaxAmountPerTransactionRule`.
332
- * @notInstrumented
333
- */
334
- const buildAllowAddressesRule = ({ context: { chain, chainIds }, rules }) => {
335
- if (!rules.allowAddresses || rules.allowAddresses.length === 0) return void 0;
336
- return {
337
- addresses: rules.allowAddresses,
338
- chain,
339
- chainIds,
340
- name: rules.names?.allowAddresses ?? DEFAULT_POLICY_RULE_NAMES.allowAddresses,
341
- ruleType: WaasPolicyRuleType.Allow,
342
- ...rules.maxAmountPerTransaction ? { valueLimit: buildValueLimit(rules.maxAmountPerTransaction) } : {}
343
- };
344
- };
345
-
346
- //#endregion
347
- //#region src/modules/waas/policies/buildBlockExportRule/buildBlockExportRule.ts
348
- /**
349
- * Builds the `blockExport` rule. `deny`, not `allow`: an addressless
350
- * allow-rule normalizes to an empty allowed-set, denying every transaction.
351
- * `chain`/`chainIds` are stamped for consistency but the enforcement of a
352
- * `blockExport` `operationRestrictions` rule is wallet-wide, ignoring them.
353
- * @notInstrumented
354
- */
355
- const buildBlockExportRule = ({ context: { chain, chainIds }, rules }) => {
356
- if (rules.blockExport !== true) return void 0;
357
- return {
358
- chain,
359
- chainIds,
360
- name: rules.names?.blockExport ?? DEFAULT_POLICY_RULE_NAMES.blockExport,
361
- operationRestrictions: { blockExport: true },
362
- ruleType: WaasPolicyRuleType.Deny
363
- };
364
- };
365
-
366
- //#endregion
367
- //#region src/modules/waas/policies/buildDenyAddressesRule/buildDenyAddressesRule.ts
368
- /**
369
- * Builds the `denyAddresses` rule. Independent of `allowAddresses`.
370
- * @notInstrumented
371
- */
372
- const buildDenyAddressesRule = ({ context: { chain, chainIds }, rules }) => {
373
- if (!rules.denyAddresses || rules.denyAddresses.length === 0) return void 0;
374
- return {
375
- addresses: rules.denyAddresses,
376
- chain,
377
- chainIds,
378
- name: rules.names?.denyAddresses ?? DEFAULT_POLICY_RULE_NAMES.denyAddresses,
379
- ruleType: WaasPolicyRuleType.Deny
380
- };
381
- };
382
-
383
- //#endregion
384
- //#region src/modules/waas/policies/buildMaxAmountPerTransactionRule/buildMaxAmountPerTransactionRule.ts
385
- /**
386
- * Builds the standalone `maxAmountPerTransaction` rule. Only fires when
387
- * `allowAddresses` didn't already absorb this cap onto its own rule. `deny`
388
- * for the same reason as `blockExport`'s builder.
389
- * @notInstrumented
390
- */
391
- const buildMaxAmountPerTransactionRule = ({ context: { chain, chainIds }, rules }) => {
392
- const isAbsorbedByAllowAddresses = Boolean(rules.allowAddresses?.length);
393
- if (!rules.maxAmountPerTransaction || isAbsorbedByAllowAddresses) return void 0;
394
- return {
395
- chain,
396
- chainIds,
397
- name: rules.names?.maxAmountPerTransaction ?? DEFAULT_POLICY_RULE_NAMES.maxAmountPerTransaction,
398
- ruleType: WaasPolicyRuleType.Deny,
399
- valueLimit: buildValueLimit(rules.maxAmountPerTransaction)
400
- };
401
- };
402
-
403
- //#endregion
404
- //#region src/modules/waas/policies/hasAddresses/hasAddresses.ts
405
- /**
406
- * Checks both the current `addresses` array and the legacy singular `address` field.
407
- * @notInstrumented
408
- */
409
- const hasAddresses = (rule) => rule.addresses !== void 0 && rule.addresses.length > 0 || rule.address != null;
410
-
411
- //#endregion
412
- //#region src/modules/waas/policies/hasUnrecognizedFields/hasUnrecognizedFields.ts
413
- const RECOGNIZED_TOP_LEVEL_KEY_SET = new Set([
414
- "ruleId",
415
- "name",
416
- "ruleType",
417
- "addresses",
418
- "chain",
419
- "chainIds",
420
- "valueLimit",
421
- "operationRestrictions"
422
- ]);
423
- /**
424
- * @notInstrumented
425
- */
426
- const hasUnrecognizedFields = (rule) => Object.keys(rule).some((key) => !RECOGNIZED_TOP_LEVEL_KEY_SET.has(key) && rule[key] != null) || rule.valueLimit?.totalLimit != null || rule.operationRestrictions?.blockRevocation != null || rule.operationRestrictions?.blockClientSigning != null;
427
-
428
- //#endregion
429
- //#region src/modules/waas/policies/readValueLimit/readValueLimit.ts
430
- /**
431
- * Reads a stored `valueLimit` back into a {@link PolicyRuleMaxAmountPerTransaction}.
432
- * @notInstrumented
433
- */
434
- const readValueLimit = ({ asset, maxPerCall }) => ({
435
- amount: maxPerCall,
436
- ...asset ? { asset } : {}
437
- });
438
-
439
- //#endregion
440
- //#region src/modules/waas/policies/readAllowAddressesRule/readAllowAddressesRule.ts
441
- /**
442
- * Recognizes an existing rule as `allowAddresses`, reading back a merged
443
- * `maxAmountPerTransaction` cap too when the rule carries one.
444
- * @notInstrumented
445
- */
446
- const readAllowAddressesRule = (rule) => {
447
- if (!(rule.ruleType === WaasPolicyRuleType.Allow && rule.operationRestrictions === void 0 && (rule.valueLimit === void 0 || rule.valueLimit.maxPerCall !== void 0) && hasAddresses(rule) && !hasUnrecognizedFields(rule))) return void 0;
448
- return {
449
- allowAddresses: rule.addresses,
450
- ...rule.valueLimit?.maxPerCall !== void 0 ? { maxAmountPerTransaction: readValueLimit({
451
- asset: rule.valueLimit.asset,
452
- maxPerCall: rule.valueLimit.maxPerCall
453
- }) } : {}
454
- };
455
- };
456
-
457
- //#endregion
458
- //#region src/modules/waas/policies/readBlockExportRule/readBlockExportRule.ts
459
- /**
460
- * Recognizes an existing rule as `blockExport`.
461
- * @notInstrumented
462
- */
463
- const readBlockExportRule = (rule) => {
464
- if (!(rule.ruleType === WaasPolicyRuleType.Deny && rule.operationRestrictions?.blockExport === true && rule.valueLimit === void 0 && !hasAddresses(rule) && !hasUnrecognizedFields(rule))) return void 0;
465
- return { blockExport: true };
466
- };
467
-
468
- //#endregion
469
- //#region src/modules/waas/policies/readDenyAddressesRule/readDenyAddressesRule.ts
470
- /**
471
- * Recognizes an existing rule as `denyAddresses`.
472
- * @notInstrumented
473
- */
474
- const readDenyAddressesRule = (rule) => {
475
- if (!(rule.ruleType === WaasPolicyRuleType.Deny && rule.operationRestrictions === void 0 && rule.valueLimit === void 0 && hasAddresses(rule) && !hasUnrecognizedFields(rule))) return void 0;
476
- return { denyAddresses: rule.addresses };
477
- };
478
-
479
- //#endregion
480
- //#region src/modules/waas/policies/readMaxAmountPerTransactionRule/readMaxAmountPerTransactionRule.ts
481
- /**
482
- * Recognizes an existing rule as a standalone `maxAmountPerTransaction` cap.
483
- * @notInstrumented
484
- */
485
- const readMaxAmountPerTransactionRule = (rule) => {
486
- if (!(rule.ruleType === WaasPolicyRuleType.Deny && rule.operationRestrictions === void 0 && rule.valueLimit?.maxPerCall !== void 0 && !hasAddresses(rule) && !hasUnrecognizedFields(rule))) return void 0;
487
- return { maxAmountPerTransaction: readValueLimit({
488
- asset: rule.valueLimit.asset,
489
- maxPerCall: rule.valueLimit.maxPerCall
490
- }) };
491
- };
492
-
493
- //#endregion
494
- //#region src/modules/waas/policies/policyRuleKinds.ts
495
- /** The four keys of {@link PolicyRules}, each of which produces its own rule. */
496
- const RULE_KIND_KEYS = [
497
- "blockExport",
498
- "allowAddresses",
499
- "denyAddresses",
500
- "maxAmountPerTransaction"
501
- ];
502
- /**
503
- * The single source of truth {@link expandPolicyRules} and
504
- * {@link desugarPolicyRules} both build on. Entries are alphabetized
505
- * (enforced by lint), not grouped by relationship — `allowAddresses` and
506
- * `maxAmountPerTransaction` cooperate (see their builders' comments) despite
507
- * sitting apart here.
508
- */
509
- const RULE_KINDS = {
510
- allowAddresses: {
511
- buildRule: buildAllowAddressesRule,
512
- readRule: readAllowAddressesRule
513
- },
514
- blockExport: {
515
- buildRule: buildBlockExportRule,
516
- readRule: readBlockExportRule
517
- },
518
- denyAddresses: {
519
- buildRule: buildDenyAddressesRule,
520
- readRule: readDenyAddressesRule
521
- },
522
- maxAmountPerTransaction: {
523
- buildRule: buildMaxAmountPerTransactionRule,
524
- readRule: readMaxAmountPerTransactionRule
525
- }
526
- };
527
-
528
- //#endregion
529
- //#region src/modules/waas/policies/readCoveredRule/readCoveredRule.ts
530
- /**
531
- * The sugar keys and values an existing rule structurally represents — a
532
- * single rule can cover more than one key (see `allowAddresses` absorbing
533
- * `maxAmountPerTransaction` in `policyRuleKinds.ts`). A rule carrying a
534
- * per-rule `modifiableBySigner` grant is never matched here — treating it
535
- * as covering keys would let a caller's batch reuse/replace/remove it and
536
- * silently revoke that signer's edit permission (mirrors `desugarPolicyRules`).
537
- *
538
- * @param rule - The existing policy-layer rule to read.
539
- * @returns The sugar keys and values the rule covers, or undefined when it matches no kind or carries a signer grant.
540
- * @notInstrumented
541
- */
542
- const readCoveredRule = (rule) => {
543
- if (rule.modifiableBySigner === true) return;
544
- for (const kind of RULE_KIND_KEYS) {
545
- const values = RULE_KINDS[kind].readRule(rule);
546
- if (values === void 0) continue;
547
- return {
548
- keys: objectKeys(values),
549
- kind,
550
- values
551
- };
552
- }
553
- };
554
-
555
- //#endregion
556
- //#region src/modules/waas/policies/sortRulesByRuleId/sortRulesByRuleId.ts
557
- /**
558
- * Sorts rules by `ruleId` ascending (a rule missing one sorts first, as `''`)
559
- * — the deterministic order {@link matchExistingRules} picks its reuse
560
- * target from, so every caller agrees on which duplicate rule wins.
561
- *
562
- * @param rules - The rules to sort.
563
- * @returns A new array, sorted by `ruleId` ascending.
564
- * @notInstrumented
565
- */
566
- const sortRulesByRuleId = (rules) => [...rules].sort((a, b) => {
567
- const idA = a.ruleId ?? "";
568
- const idB = b.ruleId ?? "";
569
- if (idA < idB) return -1;
570
- if (idA > idB) return 1;
571
- return 0;
572
- });
573
-
574
- //#endregion
575
- //#region src/modules/waas/policies/matchExistingRules/matchExistingRules.ts
576
- const coveredRuleKeys = (rule) => readCoveredRule(rule)?.keys ?? [];
577
- /**
578
- * Matches existing rules covering any of `builtRule`'s keys. Only rules
579
- * being *absorbed* into it — i.e. no other match claims the same key — are
580
- * superseded (safe to remove). Two matches claiming the SAME key (e.g. two
581
- * hand-authored `denyAddresses` rules for this chain scope) are a
582
- * legitimate duplicate, not one superseding the other, so are left alone
583
- * rather than removed.
584
- *
585
- * @param params.builtRule - The newly built rule to match existing rules against.
586
- * @param params.consumedRuleIds - `ruleId`s already reused or removed for a prior built rule this call, so none is touched twice.
587
- * @param params.existingRulesInScope - The layer's rules already narrowed to the target chain scope.
588
- * @returns The rule to reuse `builtRule`'s upsert onto (if any), and every rule it supersedes.
589
- * @notInstrumented
590
- */
591
- const matchExistingRules = ({ builtRule, consumedRuleIds, existingRulesInScope }) => {
592
- const builtKeys = new Set(coveredRuleKeys(builtRule));
593
- const matches = sortRulesByRuleId(existingRulesInScope).filter((existingRule) => existingRule.ruleId !== void 0 && !consumedRuleIds.has(existingRule.ruleId)).map((rule) => ({
594
- keys: coveredRuleKeys(rule),
595
- rule
596
- })).filter(({ keys }) => keys.some((key) => builtKeys.has(key)));
597
- const [reused, ...rest] = matches;
598
- const superseded = rest.filter(({ keys, rule }) => {
599
- const ruleKeys = new Set(keys);
600
- return !matches.some((other) => other.rule.ruleId !== rule.ruleId && other.keys.some((key) => ruleKeys.has(key)));
601
- }).map(({ rule }) => rule);
602
- return {
603
- reused: reused?.rule,
604
- superseded
605
- };
606
- };
607
-
608
- //#endregion
609
- //#region src/modules/waas/policies/resolveRuleName/resolveRuleName.ts
610
- /**
611
- * Keeps the reused rule's label unless the caller overrides it or its
612
- * name-owning kind changed.
613
- *
614
- * @param params.builtRule - The newly built rule about to be upserted.
615
- * @param params.reused - The existing rule `builtRule` is upserted onto, if any.
616
- * @param params.rules - The caller's requested {@link PolicyRules} sugar map.
617
- * @returns The name to use for the upserted rule.
618
- * @notInstrumented
619
- */
620
- const resolveRuleName = ({ builtRule, reused, rules }) => {
621
- if (reused === void 0) return builtRule.name;
622
- const builtKind = readCoveredRule(builtRule)?.kind;
623
- const reusedKind = readCoveredRule(reused)?.kind;
624
- const sameOwningKind = builtKind !== void 0 && builtKind === reusedKind;
625
- const nameOverridden = builtKind !== void 0 && rules.names?.[builtKind] !== void 0;
626
- return sameOwningKind && !nameOverridden ? reused.name : builtRule.name;
627
- };
628
-
629
- //#endregion
630
- //#region src/modules/waas/policies/buildOperationsForRule/buildOperationsForRule.ts
631
- /**
632
- * Upserts `builtRule` onto the existing rule it reuses (if any), and
633
- * removes every rule that rule superseded. Mutates `consumedRuleIds` so a
634
- * later call for a different built rule never reuses or removes the same
635
- * existing rule twice.
636
- *
637
- * @param params.builtRule - The newly built rule to turn into batch operations.
638
- * @param params.consumedRuleIds - `ruleId`s already reused or removed for a prior built rule this call.
639
- * @param params.existingRulesInScope - The layer's rules already narrowed to the target chain scope.
640
- * @param params.rules - The caller's requested {@link PolicyRules} sugar map.
641
- * @returns The batch operations for this built rule — one upsert, plus a remove per superseded rule.
642
- * @notInstrumented
643
- */
644
- const buildOperationsForRule = ({ builtRule, consumedRuleIds, existingRulesInScope, rules }) => {
645
- const { reused, superseded } = matchExistingRules({
646
- builtRule,
647
- consumedRuleIds,
648
- existingRulesInScope
649
- });
650
- const reusedRuleId = reused?.ruleId;
651
- const operations = [{
652
- op: WaasPolicyLayerRuleOperationOpEnum.Upsert,
653
- rule: reusedRuleId ? {
654
- ...builtRule,
655
- name: resolveRuleName({
656
- builtRule,
657
- reused,
658
- rules
659
- }),
660
- ruleId: reusedRuleId
661
- } : builtRule
662
- }];
663
- if (reusedRuleId) consumedRuleIds.add(reusedRuleId);
664
- for (const { ruleId } of superseded) {
665
- consumedRuleIds.add(ruleId);
666
- operations.push({
667
- op: WaasPolicyLayerRuleOperationOpEnum.Remove,
668
- ruleId
669
- });
670
- }
671
- return operations;
672
- };
673
-
674
- //#endregion
675
- //#region src/modules/waas/policies/expandPolicyRules/expandPolicyRules.ts
676
- /**
677
- * Expands the {@link PolicyRules} sugar map into `WaasPolicyRule[]` for one
678
- * chain scope. Omitting `chainIds` (or passing an empty array) builds a
679
- * wildcard rule matching every chain id of `chain`.
680
- *
681
- * @param params.rules - The sugar map describing the desired rules.
682
- * @param params.chain - The chain these rules apply to.
683
- * @param params.chainIds - The chain ids these rules apply to; omit for a wildcard rule that matches every chain id of `chain`.
684
- * @returns The expanded `WaasPolicyRule[]`, without `ruleId`.
685
- * @throws When expansion would produce an `allow` rule with a value limit and no addresses — that empties the allowed set and denies every transaction on the chain.
686
- * @notInstrumented
687
- */
688
- const expandPolicyRules = ({ chain, chainIds, rules }) => {
689
- const context = {
690
- chain,
691
- chainIds: chainIds ?? []
692
- };
693
- const expanded = RULE_KIND_KEYS.flatMap((key) => {
694
- const rule = RULE_KINDS[key].buildRule({
695
- context,
696
- rules
697
- });
698
- return rule ? [rule] : [];
699
- });
700
- if (expanded.some((rule) => rule.ruleType === WaasPolicyRuleType.Allow && rule.valueLimit !== void 0 && (rule.addresses === void 0 || rule.addresses.length === 0))) throw new InvalidParamError("expandPolicyRules: refusing to emit an allow rule with a value limit and no addresses — it would empty the allowed-address set and deny every transaction on this chain");
701
- return expanded;
702
- };
703
-
704
- //#endregion
705
- //#region src/modules/waas/policies/fillOmittedRuleValues/fillOmittedRuleValues.ts
706
- /**
707
- * Whether the caller's value for a sugar key would actually produce a rule —
708
- * an empty `allowAddresses`/`denyAddresses` array builds no rule (see
709
- * `buildAllowAddressesRule`/`buildDenyAddressesRule`), so it must count the
710
- * same as omitted here. Otherwise a real value is present.
711
- */
712
- const isRuleKeyRequested = (value) => Array.isArray(value) ? value.length > 0 : value !== void 0;
713
- /**
714
- * A key the caller omitted can be silently dropped if it's merged into the
715
- * same rule as a key they DID supply (e.g. re-saving only `allowAddresses`
716
- * when the existing rule also carries `maxAmountPerTransaction`) — carries
717
- * it forward so a partial re-save never erases a restriction the caller
718
- * didn't ask to remove.
719
- *
720
- * Rules are visited in the same lexicographically-smallest-`ruleId` order
721
- * `matchExistingRules` reuses, and only the first rule to cover a given key
722
- * fills it — so when duplicate rules cover the same omitted key, the value
723
- * always comes from the rule that will actually be upserted.
724
- *
725
- * @param params.existingRulesInScope - The layer's rules already narrowed to the target chain scope.
726
- * @param params.rules - The caller's requested {@link PolicyRules} sugar map.
727
- * @returns `rules`, with any key a partially-requested existing rule also covers filled in from that rule's current value.
728
- * @notInstrumented
729
- */
730
- const fillOmittedRuleValues = ({ existingRulesInScope, rules }) => {
731
- const mergedRules = { ...rules };
732
- for (const existingRule of sortRulesByRuleId(existingRulesInScope)) {
733
- const covered = readCoveredRule(existingRule);
734
- const isPartiallyRequested = covered !== void 0 && covered.keys.some((key) => isRuleKeyRequested(rules[key])) && covered.keys.some((key) => !isRuleKeyRequested(rules[key]));
735
- if (covered === void 0 || !isPartiallyRequested) continue;
736
- for (const key of covered.keys) if (!isRuleKeyRequested(rules[key]) && mergedRules[key] === void 0) Object.assign(mergedRules, { [key]: covered.values[key] });
737
- }
738
- return mergedRules;
739
- };
740
-
741
- //#endregion
742
- //#region src/modules/waas/policies/getResolvedPolicyLayer/getResolvedPolicyLayer.ts
743
- /**
744
- * Fetches the policy layer a {@link ResolvedPolicyScope} points at. Shared
745
- * by {@link createPolicy}, {@link getPolicy}, and {@link removePolicyRules}
746
- * so the account/wallet/signer branch is written once.
747
- *
748
- * @notInstrumented
749
- */
750
- const getResolvedPolicyLayer = ({ resolvedScope }, client) => {
751
- const { environmentId } = getCore(client);
752
- const apiClient = createApiClient({}, client);
753
- switch (resolvedScope.target) {
754
- case "account": return apiClient.getBusinessAccountPolicyLayer({
755
- businessAccountId: resolvedScope.businessAccountId,
756
- environmentId
757
- });
758
- case "wallet": return apiClient.getWaasWalletSelfPolicyLayer({
759
- environmentId,
760
- walletId: resolvedScope.walletId
761
- });
762
- case "signer": return apiClient.getWaasSignerSelfPolicyLayer({
763
- environmentId,
764
- shareSetId: resolvedScope.shareSetId,
765
- walletId: resolvedScope.walletId
766
- });
767
- default: {
768
- const unhandledScope = resolvedScope;
769
- throw new InvalidParamError(`getResolvedPolicyLayer: unhandled target "${JSON.stringify(unhandledScope)}"`);
770
- }
771
- }
772
- };
773
-
774
- //#endregion
775
- //#region src/modules/waas/policies/resolvePolicyScope/resolvePolicyScope.ts
776
- /** Narrows a {@link WalletAccount} to {@link WaasWalletAccount} so WaaS-only fields (e.g. `shareSetId`) are accessible. */
777
- const isWaasWallet = (walletAccount) => isWaasWalletAccount({ walletAccount });
778
- /**
779
- * Resolves a {@link PolicyScope} to its concrete policy layer. When only a
780
- * `shareSetId` is given, the owning wallet is found locally by scanning the
781
- * client's own wallet accounts — no network request.
782
- *
783
- * @param params.scope - The scope to resolve.
784
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
785
- * @returns The concrete target (`account`, `wallet`, or `signer`) plus the ids needed to call the SDK API.
786
- * @throws When a `shareSetId`-only scope doesn't match any of the client's wallet accounts.
787
- * @notInstrumented
788
- */
789
- const resolvePolicyScope = ({ scope }, client = getDefaultClient()) => {
790
- if ("businessAccountId" in scope) return {
791
- businessAccountId: scope.businessAccountId,
792
- target: "account"
793
- };
794
- if ("walletId" in scope) return scope.shareSetId === void 0 ? {
795
- target: "wallet",
796
- walletId: scope.walletId
797
- } : {
798
- shareSetId: scope.shareSetId,
799
- target: "signer",
800
- walletId: scope.walletId
801
- };
802
- const owningWalletAccount = getWalletAccounts(client).filter(isWaasWallet).find((walletAccount) => walletAccount.shareSetId === scope.shareSetId || walletAccount.otherShareSets?.some((shareSet) => shareSet.shareSetId === scope.shareSetId));
803
- assertDefined(owningWalletAccount?.verifiedCredentialId, `resolvePolicyScope: could not resolve a wallet for shareSetId "${scope.shareSetId}" — no verified wallet account exposes this share set`);
804
- return {
805
- shareSetId: scope.shareSetId,
806
- target: "signer",
807
- walletId: owningWalletAccount.verifiedCredentialId
808
- };
809
- };
810
-
811
- //#endregion
812
- //#region src/modules/waas/policies/sameChainIds/sameChainIds.ts
813
- /**
814
- * Whether two chainIds arrays describe the same set, regardless of order.
815
- * Shared by {@link createPolicy} and {@link removePolicyRules} to keep their
816
- * existing-rule lookups consistent.
817
- *
818
- * @notInstrumented
819
- */
820
- const sameChainIds = ({ existing = [], requested }) => {
821
- if (existing.length !== requested.length) return false;
822
- const sortedExisting = [...existing].sort((x, y) => x - y);
823
- const sortedRequested = [...requested].sort((x, y) => x - y);
824
- return sortedExisting.every((id, index) => id === sortedRequested[index]);
825
- };
826
-
827
- //#endregion
828
- //#region src/modules/waas/policies/createPolicy/createPolicy.ts
829
- /**
830
- * Creates or updates a wallet's, signer's, or business account's policy rules from the
831
- * {@link PolicyRules} sugar map, in one atomic `batch` PATCH. Each key in
832
- * `rules` maps to at most one underlying rule, so calling this twice with
833
- * the same map updates that rule in place instead of duplicating it.
834
- *
835
- * Known race: no ETag / optimistic-concurrency check — concurrent calls for
836
- * the same scope can both read-then-write and duplicate a rule.
837
- *
838
- * When more than one existing rule matches the same sugar key(s), only
839
- * rules being absorbed into the newly built rule (i.e. no other match
840
- * claims the same key) are removed. Two rules that duplicate the same key
841
- * (e.g. two hand-authored `denyAddresses` rules for this chain scope) are
842
- * left as-is rather than one being silently deleted — this call updates the
843
- * lexicographically-smallest-`ruleId` match in place and leaves the rest
844
- * untouched. A caller repeating this call will not converge on a single
845
- * rule; the duplicate has to be removed by hand.
846
- *
847
- * @param params.scope - Which policy layer to update — see {@link resolvePolicyScope}.
848
- * @param params.chain - The chain the rules apply to.
849
- * @param params.chainIds - The chain ids the rules apply to; omit for a wildcard rule that matches every chain id of `chain`.
850
- * @param params.rules - The desired rules, as a {@link PolicyRules} sugar map.
851
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
852
- * @returns The policy layer as it stands after the batch is applied.
853
- * @throws When `rules` produces no recognized keys, or via {@link resolvePolicyScope}'s scope-resolution errors.
854
- * @notInstrumented
855
- */
856
- const createPolicy = async ({ chain, chainIds, rules, scope }, client = getDefaultClient()) => {
857
- const normalizedChainIds = chainIds ?? [];
858
- const resolvedScope = resolvePolicyScope({ scope }, client);
859
- const existingRulesInScope = ((await getResolvedPolicyLayer({ resolvedScope }, client)).layerContent.rules ?? []).filter((existingRule) => existingRule.chain === chain && sameChainIds({
860
- existing: existingRule.chainIds,
861
- requested: normalizedChainIds
862
- }));
863
- const expandedRules = expandPolicyRules({
864
- chain,
865
- chainIds: normalizedChainIds,
866
- rules: fillOmittedRuleValues({
867
- existingRulesInScope,
868
- rules
869
- })
870
- });
871
- if (expandedRules.length === 0) throw new InvalidParamError("createPolicy: rules must include at least one recognized policy key");
872
- const consumedRuleIds = /* @__PURE__ */ new Set();
873
- const operations = [];
874
- for (const builtRule of expandedRules) operations.push(...buildOperationsForRule({
875
- builtRule,
876
- consumedRuleIds,
877
- existingRulesInScope,
878
- rules
879
- }));
880
- return applyPolicyLayerBatch({
881
- operations,
882
- resolvedScope
883
- }, client);
884
- };
885
-
886
- //#endregion
887
- //#region src/modules/waas/createWaasOfflineRecoveryShares/createWaasOfflineRecoveryShares.ts
888
- /**
889
- * Mints an offline-recovery share set for a WaaS wallet account.
890
- *
891
- * This mints a second, independent 2-of-2 share set: the client's share is
892
- * uploaded to Google Drive, and the server's share is delivered to the
893
- * developer's webhook. Dynamic never retains its half, so recovery works even
894
- * if Dynamic is fully offline.
895
- *
896
- * @param params.walletAccount - The WaaS wallet account to create offline-recovery shares for.
897
- * @param [params.password] - Optional password to encrypt the client share.
898
- * @param [params.cloudProviderAccessToken] - Optional consumer-supplied Drive-scoped access token; used directly instead of the stored OAuth token (avoids a second Google consent). Useful for external-auth setups.
899
- * @param [params.mfaToken] - Optional MFA token proving step-up verification, when required for this action.
900
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
901
- * @returns A promise that resolves when the offline-recovery share set has been minted.
902
- * @notInstrumented
903
- */
904
- const createWaasOfflineRecoveryShares = async ({ cloudProviderAccessToken, mfaToken, password, walletAccount }, client = getDefaultClient()) => {
905
- return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).createOfflineRecoveryShares({
906
- cloudProviderAccessToken,
907
- mfaToken,
908
- password,
909
- walletAccount
910
- });
911
- };
912
-
913
- //#endregion
914
- //#region src/modules/waas/isWalletCreationRequirement/isWalletCreationRequirement.ts
915
- /**
916
- * Type guard to check if an item is a WalletCreationRequirement object.
917
- * Chain values are strings, so we can distinguish by checking if it's an object with a 'chain' property.
918
- *
919
- * @param item - The item to check, either a WalletCreationRequirement or Chain string
920
- * @returns True if the item is a WalletCreationRequirement object
921
- * @notInstrumented
922
- */
923
- const isWalletCreationRequirement = (item) => typeof item === "object" && item !== null && "chain" in item;
924
-
925
- //#endregion
926
- //#region src/modules/waas/normalizeWalletRequirements/normalizeWalletRequirements.ts
927
- const DEFAULT_BITCOIN_ADDRESS_TYPE = "native_segwit";
928
- /**
929
- * Normalizes wallet creation input from either legacy Chain[] format
930
- * or new WalletCreationRequirement[] format to WalletCreationRequirement[].
931
- *
932
- * For BTC chains without explicit bitcoinConfig, defaults to native_segwit.
933
- *
934
- * @param params.input - Either an array of Chain strings or WalletCreationRequirement objects
935
- * @param params.defaultBitcoinConfig - Optional default bitcoin config to use for BTC chains when converting from legacy format
936
- * @returns Array of WalletCreationRequirement objects
937
- * @notInstrumented
938
- */
939
- const normalizeWalletRequirements = ({ defaultBitcoinConfig, input }) => {
940
- if (input.length === 0) return [];
941
- const [firstItem] = input;
942
- if (isWalletCreationRequirement(firstItem)) return input.map((requirement) => {
943
- if (requirement.chain === "BTC" && !requirement.bitcoinConfig) return {
944
- ...requirement,
945
- bitcoinConfig: { addressType: DEFAULT_BITCOIN_ADDRESS_TYPE }
946
- };
947
- return requirement;
948
- });
949
- return input.map((chain) => {
950
- const requirement = { chain };
951
- if (chain === "BTC") requirement.bitcoinConfig = defaultBitcoinConfig ?? { addressType: DEFAULT_BITCOIN_ADDRESS_TYPE };
952
- return requirement;
953
- });
954
- };
955
-
956
- //#endregion
957
- //#region src/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.ts
958
- /**
959
- * Creates wallet accounts for the specified chains.
960
- *
961
- * This function creates wallet accounts for the specified chains.
962
- * If the same chain is passed multiple times, just as many wallet accounts will be created
963
- * for that chain.
964
- *
965
- * @example
966
- * ```ts
967
- * // Legacy format - will create wallet accounts for EVM and SOL, BTC defaults to native_segwit
968
- * await createWaasWalletAccounts({ chains: ['EVM', 'SOL', 'BTC'] });
969
- *
970
- * // New format with chain-specific config
971
- * await createWaasWalletAccounts({
972
- * chains: [
973
- * { chain: 'BTC', bitcoinConfig: { addressType: 'taproot' } },
974
- * { chain: 'EVM' },
975
- * ]
976
- * });
977
- *
978
- * // Create both BTC address types
979
- * await createWaasWalletAccounts({
980
- * chains: [
981
- * { chain: 'BTC', bitcoinConfig: { addressType: 'native_segwit' } },
982
- * { chain: 'BTC', bitcoinConfig: { addressType: 'taproot' } },
983
- * ]
984
- * });
985
- * ```
986
- *
987
- * @param params.chains - The chains to create wallet accounts for.
988
- * @param params.password - The optional password to use for the wallet accounts.
989
- * @param params.thresholdSignatureScheme - The threshold signature scheme to use for the wallet accounts. (Default: TWO_OF_TWO)
990
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
991
- * @returns A promise that resolves when all wallet accounts are created.
992
- * @notInstrumented
993
- */
994
- const createWaasWalletAccounts = async ({ chains, password, thresholdSignatureScheme }, client = getDefaultClient()) => {
995
- const normalizedRequirements = normalizeWalletRequirements({ input: chains });
996
- const supportedChains = [
997
- "ALEO",
998
- "BTC",
999
- "EVM",
1000
- "SOL",
1001
- "SUI",
1002
- "TON",
1003
- "TRON"
1004
- ];
1005
- const filteredRequirements = normalizedRequirements.filter((requirement) => supportedChains.includes(requirement.chain));
1006
- if (filteredRequirements.length === 0) return;
1007
- const walletProviderMap = /* @__PURE__ */ new Map();
1008
- for (const requirement of filteredRequirements) {
1009
- const walletProviderKey = formatWalletProviderKey({
1010
- chain: requirement.chain,
1011
- displayName: DYNAMIC_WAAS_METADATA.displayName,
1012
- walletProviderType: WalletProviderEnum.EmbeddedWallet
1013
- });
1014
- if (!walletProviderMap.has(walletProviderKey)) {
1015
- const walletProvider = getWalletProviderByKey({ walletProviderKey }, client);
1016
- if (!walletProvider) throw new NoWalletProviderFoundError({ walletProviderKey });
1017
- if (!isWaasWalletProvider(walletProvider)) throw new NotWaasWalletProviderError({ walletProviderKey });
1018
- walletProviderMap.set(walletProviderKey, walletProvider);
1019
- }
1020
- }
1021
- await Promise.all(filteredRequirements.map((requirement) => {
1022
- const walletProviderKey = formatWalletProviderKey({
1023
- chain: requirement.chain,
1024
- displayName: DYNAMIC_WAAS_METADATA.displayName,
1025
- walletProviderType: WalletProviderEnum.EmbeddedWallet
1026
- });
1027
- const walletProvider = walletProviderMap.get(walletProviderKey);
1028
- if (!walletProvider || !isWaasWalletProvider(walletProvider)) return Promise.resolve();
1029
- return walletProvider.createWalletAccount({
1030
- bitcoinConfig: requirement.bitcoinConfig,
1031
- password,
1032
- thresholdSignatureScheme
1033
- });
1034
- }));
1035
- await __refreshAuth_wrapped(client);
1036
- };
1037
-
1038
- //#endregion
1039
- //#region src/modules/waas/businessAccounts/createWalletForBusinessAccount/createWalletForBusinessAccount.ts
1040
- /**
1041
- * Creates a WaaS wallet account owned directly by a business account, in one
1042
- * step — the server seats the wallet's signer row against the business account
1043
- * as it is minted, so no separate link call is needed.
1044
- *
1045
- * @example
1046
- * ```ts
1047
- * const wallet = await createWalletForBusinessAccount({
1048
- * businessAccountId: 'ba-1',
1049
- * chain: 'EVM',
1050
- * });
1051
- * ```
1052
- *
1053
- * @param params.businessAccountId - The business account that will own the wallet.
1054
- * @param params.chain - The chain to create the wallet account for.
1055
- * @param [params.password] - Optional password used to encrypt the user share.
1056
- * @param [params.thresholdSignatureScheme] - The threshold signature scheme to use. (Default: TWO_OF_TWO)
1057
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1058
- * @returns The created wallet account.
1059
- * @notInstrumented
1060
- */
1061
- const createWalletForBusinessAccount = async ({ businessAccountId, chain, password, thresholdSignatureScheme }, client = getDefaultClient()) => {
1062
- const wallet = await getWaasWalletProviderByChain({ chain }, client).createWalletAccount({
1063
- businessAccountId,
1064
- password,
1065
- thresholdSignatureScheme
1066
- });
1067
- await __refreshAuth_wrapped(client);
1068
- return wallet;
1069
- };
1070
-
1071
- //#endregion
1072
- //#region src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.ts
1073
- /**
1074
- * Delegates cryptographic key shares for a WaaS wallet account.
1075
- *
1076
- * This function allows the delegation of key management responsibilities,
1077
- * enabling distributed key management for enhanced security.
1078
- *
1079
- * @param params.walletAccount - The WaaS wallet account to delegate shares for.
1080
- * @param [params.password] - Optional password for key share operations.
1081
- * @param [params.initialSignerRules] - Optional policy rules used to seed the delegated signer's policy layer at delegation time.
1082
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1083
- * @returns A promise that resolves when the key delegation is complete.
1084
- * @notInstrumented
1085
- */
1086
- const delegateWaasKeyShares = async ({ initialSignerRules, password, walletAccount }, client = getDefaultClient()) => {
1087
- await getWaasWalletProviderFromWalletAccount({ walletAccount }, client).delegateKeyShares({
1088
- initialSignerRules,
1089
- password,
1090
- walletAccount
1091
- });
1092
- await __refreshAuth_wrapped(client);
1093
- };
1094
-
1095
- //#endregion
1096
- //#region src/modules/waas/policies/findMatchedRuleKind/findMatchedRuleKind.ts
1097
- const COUPLED_RULE_KINDS = new Set(["allowAddresses", "maxAmountPerTransaction"]);
1098
- const isBlocked = ({ claimedKinds, populatedKeys }) => populatedKeys.some((key) => claimedKinds.has(key) || COUPLED_RULE_KINDS.has(key) && [...COUPLED_RULE_KINDS].some((coupledKey) => claimedKinds.has(coupledKey)));
1099
- /**
1100
- * Finds the first {@link RULE_KINDS} entry that recognizes `entry` as its
1101
- * kind without colliding with an already-claimed key. Must check every key
1102
- * `readRule` would populate, not just this kind's own key — allowAddresses'
1103
- * `readRule` also populates `maxAmountPerTransaction` when the rule carries
1104
- * a merged cap, so accepting it while that key is already claimed would
1105
- * overwrite an earlier standalone cap.
1106
- * @notInstrumented
1107
- */
1108
- const findMatchedRuleKind = ({ claimedKinds, entry }) => {
1109
- for (const key of RULE_KIND_KEYS) {
1110
- const readResult = RULE_KINDS[key].readRule(entry);
1111
- if (readResult === void 0) continue;
1112
- if (!isBlocked({
1113
- claimedKinds,
1114
- populatedKeys: Object.keys(readResult)
1115
- })) return {
1116
- kind: key,
1117
- readResult
1118
- };
1119
- }
1120
- };
1121
-
1122
- //#endregion
1123
- //#region src/modules/waas/policies/isPolicyRuleDeletionMarker/isPolicyRuleDeletionMarker.ts
1124
- /** The exact key set of a deletion marker — checked as a closed shape, not by presence alone. */
1125
- const DELETION_MARKER_KEYS = new Set([
1126
- "ruleId",
1127
- "deletedByType",
1128
- "deletedById"
1129
- ]);
1130
- /**
1131
- * Recognizes a policy-Layer deletion marker — the enclave's stand-in for a
1132
- * rule it couldn't drop outright, kept so the removal stays attributable.
1133
- * Matches on the entry's exact key set, not field presence, since the read
1134
- * response types every entry as a live rule.
1135
- *
1136
- * @param entry - The raw policy-Layer rule entry to check.
1137
- * @returns Whether `entry` is a deletion marker rather than a live rule.
1138
- * @notInstrumented
1139
- */
1140
- const isPolicyRuleDeletionMarker = (entry) => {
1141
- const candidate = entry;
1142
- return typeof candidate.ruleId === "string" && typeof candidate.deletedByType === "string" && typeof candidate.deletedById === "string" && Object.keys(entry).every((key) => DELETION_MARKER_KEYS.has(key));
1143
- };
1144
-
1145
- //#endregion
1146
- //#region src/modules/waas/policies/desugarPolicyRules/desugarPolicyRules.ts
1147
- /**
1148
- * Reverses {@link expandPolicyRules} using {@link findMatchedRuleKind}'s
1149
- * same rule-kind table, skipping deletion markers. A kind claims at most
1150
- * one rule; extra matches, out-of-vocabulary fields, and per-rule
1151
- * `modifiableBySigner` grants (no sugar representation) all go to
1152
- * `unmapped` instead of being dropped.
1153
- *
1154
- * @param params.entries - The policy-Layer's rule entries, as returned in `layerContent.rules`.
1155
- * @returns The recognized rules as a {@link PolicyRules} map, plus whatever wasn't recognized.
1156
- * @notInstrumented
1157
- */
1158
- const desugarPolicyRules = ({ entries }) => {
1159
- const rules = {};
1160
- const unmapped = [];
1161
- const claimedKinds = /* @__PURE__ */ new Set();
1162
- for (const entry of entries) {
1163
- if (isPolicyRuleDeletionMarker(entry)) continue;
1164
- if (entry.modifiableBySigner === true) {
1165
- unmapped.push(entry);
1166
- continue;
1167
- }
1168
- const matched = findMatchedRuleKind({
1169
- claimedKinds,
1170
- entry
1171
- });
1172
- if (matched === void 0) {
1173
- unmapped.push(entry);
1174
- continue;
1175
- }
1176
- const { kind, readResult } = matched;
1177
- Object.assign(rules, readResult);
1178
- for (const key of Object.keys(readResult)) claimedKinds.add(key);
1179
- if (entry.name !== DEFAULT_POLICY_RULE_NAMES[kind]) rules.names = {
1180
- ...rules.names,
1181
- [kind]: entry.name
1182
- };
1183
- }
1184
- return {
1185
- rules,
1186
- unmapped
1187
- };
1188
- };
1189
-
1190
- //#endregion
1191
- //#region src/modules/waas/exportWaasClientKeyshares/exportWaasClientKeyshares.ts
1192
- /**
1193
- * Exports the client-side key shares for a WaaS wallet account.
1194
- *
1195
- * This function retrieves the cryptographic key shares that are stored
1196
- * on the client side for backup or migration purposes.
1197
- *
1198
- * @param params.walletAccount - The WaaS wallet account to export shares from.
1199
- * @param [params.password] - Optional password to encrypt the exported shares.
1200
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1201
- * @returns A promise that resolves to the exported key shares.
1202
- * @notInstrumented
1203
- */
1204
- const exportWaasClientKeyshares = async ({ password, walletAccount }, client = getDefaultClient()) => {
1205
- return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).exportClientKeyshares({
1206
- password,
1207
- walletAccount
1208
- });
1209
- };
1210
-
1211
- //#endregion
1212
- //#region src/modules/waas/exportWaasPrivateKey/exportWaasPrivateKey.ts
1213
- /**
1214
- * Exports the private key for a WaaS wallet account with secure display.
1215
- *
1216
- * This function reveals the private key for a WaaS wallet and displays it
1217
- * securely within an iframe dynamically inserted into the specified HTML container element.
1218
- *
1219
- * @param params.walletAccount - The WaaS wallet account to export the private key from.
1220
- * @param params.displayContainer - The HTML element where the iframe will be injected.
1221
- * @param [params.password] - Optional password to decrypt the private key.
1222
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1223
- * @returns A promise that resolves when the private key export is complete.
1224
- * @notInstrumented
1225
- */
1226
- const exportWaasPrivateKey = async ({ displayContainer, password, walletAccount }, client = getDefaultClient()) => {
1227
- return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).exportPrivateKey({
1228
- displayContainer,
1229
- password,
1230
- walletAccount
1231
- });
1232
- };
1233
-
1234
- //#endregion
1235
- //#region src/modules/waas/policies/getAccountPolicyLayer/getAccountPolicyLayer.ts
1236
- /**
1237
- * Fetches a business account's active policy rules (the account-Layer).
1238
- * BA owner/admin only. Calls the SDK API directly (no MPC step), so a
1239
- * rejection surfaces as a thrown error.
1240
- *
1241
- * @param params.businessAccountId - The business account to read policy rules for.
1242
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1243
- * @returns The account-Layer, including its current rules.
1244
- * @notInstrumented
1245
- */
1246
- const getAccountPolicyLayer = async ({ businessAccountId }, client = getDefaultClient()) => {
1247
- const core = getCore(client);
1248
- return createApiClient({}, client).getBusinessAccountPolicyLayer({
1249
- businessAccountId,
1250
- environmentId: core.environmentId
1251
- });
1252
- };
1253
-
1254
- //#endregion
1255
- //#region src/modules/waas/businessAccounts/getBusinessAccount/getBusinessAccount.ts
1256
- /**
1257
- * Retrieves a business account by ID, including its members, signers, and wallets.
1258
- *
1259
- * @param params.businessAccountId - The ID of the business account to retrieve.
1260
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1261
- * @returns The business account with its members, signers, and wallets.
1262
- * @notInstrumented
1263
- */
1264
- const getBusinessAccount = async ({ businessAccountId }, client = getDefaultClient()) => {
1265
- const core = getCore(client);
1266
- return await createApiClient({}, client).sdkGetBusinessAccountById({
1267
- businessAccountId,
1268
- environmentId: core.environmentId
1269
- });
1270
- };
1271
-
1272
- //#endregion
1273
- //#region src/modules/wallets/userHasEmbeddedWalletForChain/userHasEmbeddedWalletForChain.ts
1274
- /** @notInstrumented */
1275
- const userHasEmbeddedWalletForChain = ({ user, chain }) => {
1276
- return user.verifiedCredentials.some((vc) => vc.walletProvider === WalletProviderEnum.EmbeddedWallet && vc.chain && getChainFromVerifiedCredentialChain(vc.chain) === chain);
1277
- };
1278
-
1279
- //#endregion
1280
- //#region src/modules/waas/getChainsMissingWaasWalletAccounts/getChainsMissingWaasWalletAccounts.ts
1281
- /**
1282
- * Gets all chains missing a waas wallet account for the current user.
1283
- *
1284
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1285
- * @returns An array of all chains that have waas wallet accounts enabled
1286
- * but for which the current user does not yet have an embedded wallet account.
1287
- * @notInstrumented
1288
- */
1289
- const getChainsMissingWaasWalletAccounts = (client = getDefaultClient()) => {
1290
- const projectSettings = client.projectSettings;
1291
- assertDefined(projectSettings, "Project settings are not available");
1292
- const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;
1293
- const isWaasEnabled = isDynamicWaasEnabled(client);
1294
- const user = client.user;
1295
- if (!user || !isWaasEnabled) return [];
1296
- return (embeddedWalletSettings?.chainConfigurations?.filter((chain) => chain.enabled) ?? []).map((chain) => chain.name).filter((chain) => !userHasEmbeddedWalletForChain({
1297
- chain,
1298
- user
1299
- }));
1300
- };
1301
-
1302
- //#endregion
1303
- //#region src/modules/waas/policies/getPolicy/getPolicy.ts
1304
- /**
1305
- * Fetches a policy layer and reads its `chain`/`chainIds` scope back into
1306
- * the {@link PolicyRules} sugar map (see {@link desugarPolicyRules}). A
1307
- * layer can hold rules for more than one chain, so entries are narrowed to
1308
- * `chain`/`chainIds` first — the same scoping {@link createPolicy} uses —
1309
- * to keep the `getPolicy` → edit → `createPolicy` round-trip safe for
1310
- * multi-chain wallets. Calls the SDK API directly (no MPC step), so a
1311
- * rejection surfaces as a thrown error.
1312
- *
1313
- * @param params.scope - Which policy layer to read — see {@link resolvePolicyScope}.
1314
- * @param params.chain - The chain to read rules for.
1315
- * @param params.chainIds - The chain ids to read rules for; omit to read the wildcard rule matching every chain id of `chain`.
1316
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1317
- * @returns The recognized rules as a {@link PolicyRules} map, whatever wasn't recognized within `chain`/`chainIds`, and the layer's id and last-updated timestamp.
1318
- * @throws Via {@link resolvePolicyScope}'s scope-resolution errors.
1319
- * @notInstrumented
1320
- */
1321
- const getPolicy = async ({ chain, chainIds, scope }, client = getDefaultClient()) => {
1322
- const normalizedChainIds = chainIds ?? [];
1323
- const layer = await getResolvedPolicyLayer({ resolvedScope: resolvePolicyScope({ scope }, client) }, client);
1324
- const { rules, unmapped } = desugarPolicyRules({ entries: (layer.layerContent.rules ?? []).filter((entry) => entry.chain === chain && sameChainIds({
1325
- existing: entry.chainIds,
1326
- requested: normalizedChainIds
1327
- })) });
1328
- return {
1329
- layerId: layer.layerId,
1330
- rules,
1331
- unmapped,
1332
- updatedAt: layer.updatedAt
1333
- };
1334
- };
1335
-
1336
- //#endregion
1337
- //#region src/modules/waas/policies/getSignerPolicyLayer/getSignerPolicyLayer.ts
1338
- /**
1339
- * Fetches a signer's active policy rules (the signer-Layer) — the caller's
1340
- * own active share set by default, or another share set on the same wallet
1341
- * (e.g. a delegated share set) when `shareSetId` is given. Calls the SDK API
1342
- * directly (no MPC step), so a rejection surfaces as a thrown error.
1343
- *
1344
- * @param params.walletAccount - The wallet account whose signer-Layer to read.
1345
- * @param [params.shareSetId] - The share set to target; defaults to the caller's own.
1346
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1347
- * @returns The signer-Layer, including its current rules.
1348
- * @throws {ValueMustBeDefinedError} When `walletAccount` has no `verifiedCredentialId` (it isn't a verified wallet account yet).
1349
- * @throws {APIError} When the SDK API request fails, for example an unauthorized, not-found, or server error response.
1350
- * @notInstrumented
1351
- */
1352
- const getSignerPolicyLayer = async ({ shareSetId, walletAccount }, client = getDefaultClient()) => {
1353
- assertDefined(walletAccount.verifiedCredentialId, "getSignerPolicyLayer: cannot resolve a wallet id — use a verified wallet account");
1354
- const core = getCore(client);
1355
- return createApiClient({}, client).getWaasSignerSelfPolicyLayer({
1356
- environmentId: core.environmentId,
1357
- shareSetId,
1358
- walletId: walletAccount.verifiedCredentialId
1359
- });
1360
- };
1361
-
1362
- //#endregion
1363
- //#region src/modules/waas/getWalletAccountShareSets/getWalletAccountShareSets.ts
1364
- /**
1365
- * No network request. Share set ids rotate on refresh/reshare (stale ids are
1366
- * rejected server-side), so re-read rather than cache; non-WaaS accounts
1367
- * return `{ own: undefined, others: [] }` instead of throwing.
1368
- *
1369
- * @param params.walletAccount - The WaaS wallet account whose share sets to read.
1370
- * @returns The account's own share set (if any) and the wallet's other active share sets.
1371
- * @notInstrumented
1372
- */
1373
- const getWalletAccountShareSets = ({ walletAccount }) => {
1374
- const own = walletAccount.shareSetId ? {
1375
- shareSetId: walletAccount.shareSetId,
1376
- shareSetType: walletAccount.shareSetType
1377
- } : void 0;
1378
- return {
1379
- others: walletAccount.otherShareSets ?? [],
1380
- own
1381
- };
1382
- };
1383
-
1384
- //#endregion
1385
- //#region src/modules/waas/policies/getWalletPolicyLayer/getWalletPolicyLayer.ts
1386
- /**
1387
- * Fetches a wallet's active policy rules (the wallet-Layer). Calls the SDK
1388
- * API directly (no MPC step), so a rejection surfaces as a thrown error.
1389
- *
1390
- * @param params.walletAccount - The wallet account to read policy rules for.
1391
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1392
- * @returns The wallet-Layer, including its current rules.
1393
- * @throws {ValueMustBeDefinedError} When `walletAccount` has no `verifiedCredentialId` (it isn't a verified wallet account yet).
1394
- * @throws {APIError} When the SDK API request fails, for example an unauthorized, not-found, or server error response.
1395
- * @notInstrumented
1396
- */
1397
- const getWalletPolicyLayer = async ({ walletAccount }, client = getDefaultClient()) => {
1398
- assertDefined(walletAccount.verifiedCredentialId, "getWalletPolicyLayer: cannot resolve a wallet id — use a verified wallet account");
1399
- const core = getCore(client);
1400
- return createApiClient({}, client).getWaasWalletSelfPolicyLayer({
1401
- environmentId: core.environmentId,
1402
- walletId: walletAccount.verifiedCredentialId
1403
- });
1404
- };
1405
-
1406
- //#endregion
1407
- //#region src/modules/waas/getWalletRecoveryState/getWalletRecoveryState.ts
1408
- /**
1409
- * Retrieves the recovery state of a WaaS wallet account.
1410
- *
1411
- * @param params.walletAccount - The WaaS wallet account to get the recovery state for.
1412
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1413
- * @returns A promise that resolves with the wallet recovery state.
1414
- * @notInstrumented
1415
- */
1416
- const getWalletRecoveryState = async ({ walletAccount }, client = getDefaultClient()) => {
1417
- return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).getWalletRecoveryState({ walletAccount });
1418
- };
1419
-
1420
- //#endregion
1421
- //#region src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.ts
1422
- /**
1423
- * Checks if a WaaS wallet account has delegated access.
1424
- *
1425
- * @param params.walletAccount - The WaaS wallet account to check for delegated access.
1426
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1427
- * @returns True if the wallet account has delegated access, false otherwise.
1428
- * @notInstrumented
1429
- */
1430
- const hasDelegatedAccess = ({ walletAccount }, client = getDefaultClient()) => {
1431
- const verifiedCredential = getVerifiedCredentialForWalletAccount({ walletAccount }, client);
1432
- assertDefined(verifiedCredential, "Verified credential not found for Waas wallet account");
1433
- const hasDelegatedKeyShare = verifiedCredential.walletProperties?.keyShares?.some((keyShare) => keyShare.backupLocation === "delegated");
1434
- const hasDelegatedShareSet = verifiedCredential.walletProperties?.otherShareSets?.some((shareSet) => shareSet.shareSetType === WaasWalletShareSetType$1.Delegated);
1435
- return Boolean(hasDelegatedKeyShare || hasDelegatedShareSet);
1436
- };
1437
-
1438
- //#endregion
1439
- //#region src/modules/waas/importWaasPrivateKey/importWaasPrivateKey.ts
1440
- /**
1441
- * Imports an existing private key to create a new WaaS wallet account.
1442
- *
1443
- * This function allows users to import their existing private key into
1444
- * Dynamic's WaaS infrastructure for secure management.
1445
- *
1446
- * @param params.chain - The chain for the imported wallet.
1447
- * @param params.privateKey - The private key to import.
1448
- * @param [params.thresholdSignatureScheme] - Optional threshold signature scheme configuration. Default is TWO_OF_TWO.
1449
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1450
- * @returns A promise that resolves when the private key is successfully imported.
1451
- * @notInstrumented
1452
- */
1453
- const importWaasPrivateKey = async ({ chain, privateKey, thresholdSignatureScheme }, client = getDefaultClient()) => {
1454
- return getWaasWalletProviderByChain({ chain }, client).importPrivateKey({
1455
- privateKey,
1456
- thresholdSignatureScheme
1457
- });
1458
- };
1459
-
1460
- //#endregion
1461
- //#region src/modules/waas/isPasswordRequiredForWaasWallets/isPasswordRequiredForWaasWallets.ts
1462
- /**
1463
- * Checks if the user Waas wallets are password protected.
1464
- *
1465
- * If the user's Waas wallets are password protected, it means that user's will have to be prompted for a
1466
- * password for the first wallet action that happens on each session.
1467
- * The password is also required for creating any new Waas wallets.
1468
- *
1469
- * @param client - The Dynamic client instance. Only required when using multiple Dynamic clients.
1470
- * @returns True if the user has any password protected Waas wallets, false otherwise
1471
- * @notInstrumented
1472
- */
1473
- const isPasswordRequiredForWaasWallets = (client = getDefaultClient()) => {
1474
- const { user } = client;
1475
- assertDefined(user, "User is not authenticated");
1476
- return user.verifiedCredentials.some((credential) => credential.walletProperties?.keyShares?.some((keyShare) => keyShare.passwordEncrypted));
1477
- };
1478
-
1479
- //#endregion
1480
- //#region src/modules/waas/businessAccounts/listBusinessAccounts/listBusinessAccounts.ts
1481
- /**
1482
- * Lists the business accounts the current user is a member of, scoped to the
1483
- * active project environment. Optionally filter by `externalRefs`.
1484
- *
1485
- * @param [params] - Optional filters.
1486
- * @param [params.externalRefs] - Return only accounts whose externalRef is in this list.
1487
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1488
- * @returns A paginated list of business accounts.
1489
- * @notInstrumented
1490
- */
1491
- const listBusinessAccounts = async (params, client = getDefaultClient()) => {
1492
- const core = getCore(client);
1493
- return await createApiClient({}, client).sdkListBusinessAccounts({
1494
- environmentId: core.environmentId,
1495
- externalRef: params?.externalRefs
1496
- });
1497
- };
1498
-
1499
- //#endregion
1500
- //#region src/modules/waas/refreshWaasWalletAccountShares/refreshWaasWalletAccountShares.ts
1501
- /**
1502
- * Refreshes the cryptographic key shares for a WaaS wallet account.
1503
- *
1504
- * This function generates new key shares for the wallet while maintaining
1505
- * the same threshold signature scheme.
1506
- *
1507
- * @param params.walletAccount - The WaaS wallet account to refresh shares for.
1508
- * @param [params.password] - Optional password for key share operations.
1509
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1510
- * @returns A promise that resolves when the key shares are refreshed.
1511
- * @notInstrumented
1512
- */
1513
- const refreshWaasWalletAccountShares = async ({ walletAccount, password }, client = getDefaultClient()) => {
1514
- return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).refreshWalletAccountShares({
1515
- password,
1516
- walletAccount
1517
- });
1518
- };
1519
-
1520
- //#endregion
1521
- //#region src/modules/waas/policies/removeAccountPolicyRule/removeAccountPolicyRule.ts
1522
- /**
1523
- * Removes a single rule from a business account's account-Layer. BA
1524
- * owner/admin only. Calls the SDK API directly (no MPC step), so a
1525
- * rejection surfaces as a thrown error.
1526
- *
1527
- * @param params.businessAccountId - The business account to remove the rule from.
1528
- * @param params.ruleId - The id of the rule to remove.
1529
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1530
- * @returns The account-Layer as it stands after the rule is removed.
1531
- * @notInstrumented
1532
- */
1533
- const removeAccountPolicyRule = async ({ businessAccountId, ruleId }, client = getDefaultClient()) => {
1534
- const core = getCore(client);
1535
- return createApiClient({}, client).updateBusinessAccountPolicyLayer({
1536
- businessAccountId,
1537
- environmentId: core.environmentId,
1538
- waasPolicyLayerUpdateRequest: {
1539
- op: WaasPolicyLayerUpdateRequestOpEnum.Remove,
1540
- ruleId
1541
- }
1542
- });
1543
- };
1544
-
1545
- //#endregion
1546
- //#region src/modules/waas/businessAccounts/removeBusinessAccountMember/removeBusinessAccountMember.ts
1547
- /**
1548
- * Removes a member from a business account. Any signer rows the member held on
1549
- * the account's wallets are torn down as part of the removal. The backend
1550
- * refuses to remove the account's last owner.
1551
- *
1552
- * @param params.businessAccountId - The business account to remove the member from.
1553
- * @param params.userId - The id of the user to remove.
1554
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1555
- * @returns The removed member.
1556
- *
1557
- * @example
1558
- * ```ts
1559
- * const detail = await getBusinessAccount({ businessAccountId });
1560
- * const member = detail.members[0];
1561
- * await removeBusinessAccountMember({
1562
- * businessAccountId,
1563
- * userId: member.userId,
1564
- * });
1565
- * ```
1566
- *
1567
- * @see addBusinessAccountMember
1568
- * @see getBusinessAccount
1569
- * @notInstrumented
1570
- */
1571
- const removeBusinessAccountMember = async ({ businessAccountId, userId }, client = getDefaultClient()) => {
1572
- const core = getCore(client);
1573
- const { member } = await createApiClient({ elevatedAccessTokenScope: TokenScope.BusinessAccountmemberremove }, client).sdkRemoveBusinessAccountMember({
1574
- businessAccountId,
1575
- environmentId: core.environmentId,
1576
- userId
1577
- });
1578
- return member;
1579
- };
1580
-
1581
- //#endregion
1582
- //#region src/modules/waas/businessAccounts/removeBusinessAccountSigner/removeBusinessAccountSigner.ts
1583
- /**
1584
- * Removes a signer from a business-account wallet. This detaches the signer's
1585
- * share set from the wallet — it does not run an MPC ceremony — so the removed
1586
- * identity can no longer sign for that wallet. The backend refuses to remove
1587
- * the last remaining signer on a wallet.
1588
- *
1589
- * @param params.businessAccountId - The business account the wallet belongs to.
1590
- * @param params.walletId - The wallet the signer is attached to.
1591
- * @param params.signerId - The id of the signer to remove (`BusinessAccountSigner.id`).
1592
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1593
- * @returns The removed signer.
1594
- *
1595
- * @example
1596
- * ```ts
1597
- * const detail = await getBusinessAccount({ businessAccountId });
1598
- * const signer = detail.signers[0];
1599
- * await removeBusinessAccountSigner({
1600
- * businessAccountId,
1601
- * walletId: signer.walletId,
1602
- * signerId: signer.id,
1603
- * });
1604
- * ```
1605
- *
1606
- * @see addBusinessAccountSigner
1607
- * @see getBusinessAccount
1608
- * @notInstrumented
1609
- */
1610
- const removeBusinessAccountSigner = async ({ businessAccountId, walletId, signerId }, client = getDefaultClient()) => {
1611
- const core = getCore(client);
1612
- const { signer } = await createApiClient({ elevatedAccessTokenScope: TokenScope.BusinessAccountsignerremove }, client).sdkRemoveBusinessAccountSigner({
1613
- businessAccountId,
1614
- environmentId: core.environmentId,
1615
- signerId,
1616
- walletId
1617
- });
1618
- return signer;
1619
- };
1620
-
1621
- //#endregion
1622
- //#region src/modules/waas/businessAccounts/removeBusinessAccountWallet/removeBusinessAccountWallet.ts
1623
- /**
1624
- * Removes a wallet from a business account (owner-/admin-only). The wallet and
1625
- * all its associated signer rows are detached from the account. The backend
1626
- * refuses to remove the last wallet on a business account.
1627
- *
1628
- * @param params.businessAccountId - The business account the wallet belongs to.
1629
- * @param params.walletId - The wallet to remove (`BusinessAccountWallet.id`).
1630
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1631
- * @returns The updated business account detail.
1632
- *
1633
- * @example
1634
- * ```ts
1635
- * const detail = await getBusinessAccount({ businessAccountId });
1636
- * await removeBusinessAccountWallet({
1637
- * businessAccountId,
1638
- * walletId: detail.wallets[0].id,
1639
- * });
1640
- * ```
1641
- *
1642
- * @see addWalletToBusinessAccount
1643
- * @see getBusinessAccount
1644
- * @notInstrumented
1645
- */
1646
- const removeBusinessAccountWallet = async ({ businessAccountId, walletId }, client = getDefaultClient()) => {
1647
- const core = getCore(client);
1648
- const detail = await createApiClient({ elevatedAccessTokenScope: TokenScope.BusinessAccountwalletremove }, client).sdkRemoveBusinessAccountWallet({
1649
- businessAccountId,
1650
- environmentId: core.environmentId,
1651
- walletId
1652
- });
1653
- await __refreshAuth_wrapped(client);
1654
- return detail;
1655
- };
1656
-
1657
- //#endregion
1658
- //#region src/modules/waas/policies/buildOperationForExistingRule/buildOperationForExistingRule.ts
1659
- /**
1660
- * Builds the operation to remove or rebuild `existingRule` when the
1661
- * caller's requested keys touch it — outright removal when every key it
1662
- * covers is being removed, or an upsert of the rule rebuilt from its
1663
- * remaining keys when only some are. Returns undefined when none of the
1664
- * requested keys touch this rule, when it's outside the sugar vocabulary,
1665
- * or when it can't be identified without a `ruleId`.
1666
- *
1667
- * @param params.chain - The chain the rule to remove/rebuild applies to.
1668
- * @param params.chainIds - The chain ids the rule to remove/rebuild applies to.
1669
- * @param params.existingRule - The existing layer rule to check.
1670
- * @param params.rules - The sugar keys to remove.
1671
- * @returns The operation for this rule, or undefined when it isn't touched.
1672
- * @notInstrumented
1673
- */
1674
- const buildOperationForExistingRule = ({ chain, chainIds, existingRule, rules }) => {
1675
- if (existingRule.ruleId === void 0) return;
1676
- const covered = readCoveredRule(existingRule);
1677
- if (covered === void 0) return;
1678
- const remainingKeys = covered.keys.filter((key) => !rules.includes(key));
1679
- if (remainingKeys.length === covered.keys.length) return;
1680
- if (remainingKeys.length === 0) return {
1681
- op: WaasPolicyLayerRuleOperationOpEnum.Remove,
1682
- ruleId: existingRule.ruleId
1683
- };
1684
- const remainingRules = {};
1685
- for (const key of remainingKeys) Object.assign(remainingRules, { [key]: covered.values[key] });
1686
- const [rebuiltRule] = expandPolicyRules({
1687
- chain,
1688
- chainIds,
1689
- rules: remainingRules
1690
- });
1691
- if (rebuiltRule === void 0) return;
1692
- const keepsName = readCoveredRule(rebuiltRule)?.kind === covered.kind;
1693
- return {
1694
- op: WaasPolicyLayerRuleOperationOpEnum.Upsert,
1695
- rule: {
1696
- ...rebuiltRule,
1697
- name: keepsName ? existingRule.name ?? rebuiltRule.name : rebuiltRule.name,
1698
- ruleId: existingRule.ruleId
1699
- }
1700
- };
1701
- };
1702
-
1703
- //#endregion
1704
- //#region src/modules/waas/policies/removePolicyRules/removePolicyRules.ts
1705
- /**
1706
- * Removes the rules behind one or more {@link PolicyRules} keys from a
1707
- * policy layer, in one atomic `batch` PATCH. For every existing rule the
1708
- * given keys touch, either removes it outright or — when it also covers a
1709
- * key the caller didn't ask to remove (e.g. an
1710
- * `allowAddresses`+`maxAmountPerTransaction` rule with only the cap
1711
- * removed) — rebuilds it from the remaining keys so that restriction
1712
- * survives.
1713
- *
1714
- * @param params.scope - Which policy layer to update — see {@link resolvePolicyScope}.
1715
- * @param params.chain - The chain the rules to remove apply to.
1716
- * @param params.chainIds - The chain ids the rules to remove apply to; omit to target the wildcard rule that matches every chain id of `chain`.
1717
- * @param params.rules - The sugar keys to remove.
1718
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1719
- * @returns The policy layer as it stands after the batch is applied.
1720
- * @throws When none of the given keys match an existing rule for this chain scope, or via {@link resolvePolicyScope}'s scope-resolution errors.
1721
- * @notInstrumented
1722
- */
1723
- const removePolicyRules = async ({ chain, chainIds, rules, scope }, client = getDefaultClient()) => {
1724
- const normalizedChainIds = chainIds ?? [];
1725
- const resolvedScope = resolvePolicyScope({ scope }, client);
1726
- const operations = ((await getResolvedPolicyLayer({ resolvedScope }, client)).layerContent.rules ?? []).filter((existingRule) => existingRule.chain === chain && sameChainIds({
1727
- existing: existingRule.chainIds,
1728
- requested: normalizedChainIds
1729
- })).map((existingRule) => buildOperationForExistingRule({
1730
- chain,
1731
- chainIds: normalizedChainIds,
1732
- existingRule,
1733
- rules
1734
- })).filter((operation) => operation !== void 0);
1735
- if (operations.length === 0) throw new InvalidParamError("removePolicyRules: none of the given rule keys matched an existing rule for this scope");
1736
- return applyPolicyLayerBatch({
1737
- operations,
1738
- resolvedScope
1739
- }, client);
1740
- };
1741
-
1742
- //#endregion
1743
- //#region src/modules/waas/policies/removeSignerPolicyRule/removeSignerPolicyRule.ts
1744
- /**
1745
- * Removes a single rule from a signer's policy layer. Calls the SDK API
1746
- * directly (no MPC step), so a rejection surfaces as a thrown error.
1747
- *
1748
- * @param params.walletAccount - The wallet account whose signer-Layer to update.
1749
- * @param params.ruleId - The id of the rule to remove.
1750
- * @param [params.shareSetId] - The share set to target; defaults to the caller's own. Only the wallet's own owner may target another share set.
1751
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1752
- * @returns The signer-Layer as it stands after the rule is removed.
1753
- * @throws {ValueMustBeDefinedError} When `walletAccount` has no `verifiedCredentialId` (it isn't a verified wallet account yet).
1754
- * @throws {APIError} When the SDK API request fails, for example an unauthorized, not-found, or server error response.
1755
- * @notInstrumented
1756
- */
1757
- const removeSignerPolicyRule = async ({ ruleId, shareSetId, walletAccount }, client = getDefaultClient()) => {
1758
- assertDefined(walletAccount.verifiedCredentialId, "removeSignerPolicyRule: cannot resolve a wallet id — use a verified wallet account");
1759
- const core = getCore(client);
1760
- return createApiClient({}, client).updateWaasSignerSelfPolicyLayer({
1761
- environmentId: core.environmentId,
1762
- waasSignerPolicyLayerUpdateRequest: {
1763
- op: WaasSignerPolicyLayerUpdateRequestOpEnum.Remove,
1764
- ruleId,
1765
- shareSetId
1766
- },
1767
- walletId: walletAccount.verifiedCredentialId
1768
- });
1769
- };
1770
-
1771
- //#endregion
1772
- //#region src/modules/waas/policies/removeWalletPolicyRule/removeWalletPolicyRule.ts
1773
- /**
1774
- * Removes a single rule from a wallet's policy layer. Calls the SDK API
1775
- * directly (no MPC step), so a rejection surfaces as a thrown error.
1776
- *
1777
- * @param params.walletAccount - The wallet account to remove the rule from.
1778
- * @param params.ruleId - The id of the rule to remove.
1779
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1780
- * @returns The wallet-Layer as it stands after the rule is removed.
1781
- * @throws {ValueMustBeDefinedError} When `walletAccount` has no `verifiedCredentialId` (it isn't a verified wallet account yet).
1782
- * @throws {APIError} When the SDK API request fails, for example an unauthorized, not-found, or server error response.
1783
- * @notInstrumented
1784
- */
1785
- const removeWalletPolicyRule = async ({ ruleId, walletAccount }, client = getDefaultClient()) => {
1786
- assertDefined(walletAccount.verifiedCredentialId, "removeWalletPolicyRule: cannot resolve a wallet id — use a verified wallet account");
1787
- const core = getCore(client);
1788
- return createApiClient({}, client).updateWaasWalletSelfPolicyLayer({
1789
- environmentId: core.environmentId,
1790
- waasPolicyLayerUpdateRequest: {
1791
- op: WaasPolicyLayerUpdateRequestOpEnum.Remove,
1792
- ruleId
1793
- },
1794
- walletId: walletAccount.verifiedCredentialId
1795
- });
1796
- };
1797
-
1798
- //#endregion
1799
- //#region src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.ts
1800
- /**
1801
- * Revokes the delegation of a WaaS wallet account.
1802
- *
1803
- * @param params.walletAccount - The WaaS wallet account to revoke delegation for.
1804
- * @param [params.password] - Optional password for delegation operations.
1805
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1806
- * @returns A promise that resolves when the delegation is revoked.
1807
- * @notInstrumented
1808
- */
1809
- const revokeWaasDelegation = async ({ password, walletAccount }, client = getDefaultClient()) => {
1810
- await getWaasWalletProviderFromWalletAccount({ walletAccount }, client).revokeDelegation({
1811
- password,
1812
- walletAccount
1813
- });
1814
- await __refreshAuth_wrapped(client);
1815
- };
1816
-
1817
- //#endregion
1818
- //#region src/modules/waas/setWaasWalletAccountPassword/setWaasWalletAccountPassword.ts
1819
- /**
1820
- * Sets a password for a WaaS wallet account.
1821
- *
1822
- * @param params.walletAccount - The WaaS wallet account to set the password for.
1823
- * @param params.password - The password to set for the wallet.
1824
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1825
- * @returns A promise that resolves when the password is successfully set.
1826
- * @notInstrumented
1827
- */
1828
- const setWaasWalletAccountPassword = async ({ password, walletAccount }, client = getDefaultClient()) => {
1829
- return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).setWaasWalletAccountPassword({
1830
- password,
1831
- walletAccount
1832
- });
1833
- };
1834
-
1835
- //#endregion
1836
- //#region src/modules/wallets/userHasExternalWallet/userHasExternalWallet.ts
1837
- /** @notInstrumented */
1838
- const userHasExternalWallet = (user) => {
1839
- return user?.verifiedCredentials.some((vc) => vc.format === JwtVerifiedCredentialFormatEnum.Blockchain && vc.walletProvider !== WalletProviderEnum.EmbeddedWallet);
1840
- };
1841
-
1842
- //#endregion
1843
- //#region src/modules/waas/shouldAutoCreateWalletForChain/shouldAutoCreateWalletForChain.ts
1844
- /**
1845
- * Checks if a WaaS wallet should be automatically created for the specified blockchain.
1846
- *
1847
- * This function determines whether the current user configuration and project
1848
- * settings require automatic wallet creation for the given chain, considering
1849
- * whether the user already has an embedded wallet for the enabled chains or an external wallet.
1850
- *
1851
- * @param params.chain - The blockchain network to check.
1852
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1853
- * @returns True if a wallet should be auto-created for the chain, false otherwise.
1854
- * @notInstrumented
1855
- */
1856
- const shouldAutoCreateWalletForChain = ({ chain }, client = getDefaultClient()) => {
1857
- assertDefined(client.projectSettings, "Project settings are not available");
1858
- const embeddedWalletSettings = client.projectSettings.sdk.embeddedWallets;
1859
- if (!embeddedWalletSettings?.automaticEmbeddedWalletCreation || !client.user) return false;
1860
- const automaticEmbeddedWalletCreationForExternalEnabled = embeddedWalletSettings?.automaticEmbeddedWalletCreationForExternal;
1861
- if (!(!userHasExternalWallet(client.user) || automaticEmbeddedWalletCreationForExternalEnabled)) return false;
1862
- return getChainsMissingWaasWalletAccounts(client).includes(chain);
1863
- };
1864
-
1865
- //#endregion
1866
- //#region src/modules/waas/signSerializedTransaction/signSerializedTransaction.ts
1867
- /**
1868
- * No gas estimation, balance check, or broadcast — unlike `transferAmount`.
1869
- * Useful for exercising WaaS policy enforcement in isolation.
1870
- *
1871
- * @param params.walletAccount - The wallet account to sign with.
1872
- * @param params.serializedTransaction - The raw serialized transaction (e.g. viem's `serializeTransaction`).
1873
- * @param [params.chainId] - The chain id, if required by the target chain's signer.
1874
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1875
- * @returns The raw signature.
1876
- * @notInstrumented
1877
- */
1878
- const signSerializedTransaction = async ({ chainId, serializedTransaction, walletAccount }, client = getDefaultClient()) => {
1879
- return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).signSerializedTransaction({
1880
- chainId,
1881
- serializedTransaction,
1882
- walletAccount
1883
- });
1884
- };
1885
-
1886
- //#endregion
1887
- //#region src/modules/waas/businessAccounts/transferBusinessAccountOwnership/transferBusinessAccountOwnership.ts
1888
- /**
1889
- * Transfers ownership of a business account to another member. Owner-only: the
1890
- * `newOwnerUserId` must already be a member, is promoted to owner, and the
1891
- * current owner is atomically demoted to admin.
1892
- *
1893
- * @param params.businessAccountId - The business account whose ownership moves.
1894
- * @param params.newOwnerUserId - The member to promote to owner.
1895
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1896
- * @returns The updated business account detail.
1897
- *
1898
- * @example
1899
- * ```ts
1900
- * const detail = await getBusinessAccount({ businessAccountId });
1901
- * const target = detail.members.find((m) => m.role === 'admin');
1902
- * await transferBusinessAccountOwnership({
1903
- * businessAccountId,
1904
- * newOwnerUserId: target.userId,
1905
- * });
1906
- * ```
1907
- *
1908
- * @see getBusinessAccount
1909
- * @notInstrumented
1910
- */
1911
- const transferBusinessAccountOwnership = async ({ businessAccountId, newOwnerUserId }, client = getDefaultClient()) => {
1912
- const core = getCore(client);
1913
- const detail = await createApiClient({ elevatedAccessTokenScope: TokenScope.BusinessAccounttransferOwnership }, client).sdkTransferBusinessAccountOwnership({
1914
- businessAccountId,
1915
- environmentId: core.environmentId,
1916
- transferBusinessAccountOwnershipSdkRequest: { newOwnerUserId }
1917
- });
1918
- await __logoutWithReason_wrapped({ reason: "business-account-ownership-transferred" }, client);
1919
- return detail;
1920
- };
1921
-
1922
- //#endregion
1923
- //#region src/modules/waas/unlockWallet/unlockWallet.ts
1924
- /**
1925
- * Unlocks a WaaS wallet account.
1926
- *
1927
- * @param params.walletAccount - The WaaS wallet account to unlock.
1928
- * @param params.password - The password to unlock the wallet.
1929
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1930
- * @returns A promise that resolves with the wallet information.
1931
- * @notInstrumented
1932
- */
1933
- const unlockWallet = async ({ password, walletAccount }, client = getDefaultClient()) => {
1934
- return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).unlockWallet({
1935
- password,
1936
- walletAccount
1937
- });
1938
- };
1939
-
1940
- //#endregion
1941
- //#region src/modules/waas/businessAccounts/updateBusinessAccount/updateBusinessAccount.ts
1942
- /**
1943
- * Renames a business account (owner-/admin-only). Calls the SDK API directly
1944
- * (no MPC step), so a rejection surfaces as a thrown error.
1945
- *
1946
- * @param params.businessAccountId - The business account to rename.
1947
- * @param params.name - The new name.
1948
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1949
- * @returns The updated business account.
1950
- *
1951
- * @example
1952
- * ```ts
1953
- * await updateBusinessAccount({ businessAccountId, name: 'Acme Inc' });
1954
- * ```
1955
- *
1956
- * @see getBusinessAccount
1957
- * @notInstrumented
1958
- */
1959
- const updateBusinessAccount = async ({ businessAccountId, name: name$1 }, client = getDefaultClient()) => {
1960
- const core = getCore(client);
1961
- return await createApiClient({}, client).sdkUpdateBusinessAccount({
1962
- businessAccountId,
1963
- environmentId: core.environmentId,
1964
- updateBusinessAccountSdkRequest: { name: name$1 }
1965
- });
1966
- };
1967
-
1968
- //#endregion
1969
- //#region src/modules/waas/businessAccounts/updateBusinessAccountMemberRole/updateBusinessAccountMemberRole.ts
1970
- const ROLE_TO_API = {
1971
- admin: AssignableBusinessAccountMemberRole.Admin,
1972
- viewer: AssignableBusinessAccountMemberRole.Viewer
1973
- };
1974
- /**
1975
- * Changes an existing member's role between `admin` and `viewer` (owner-/admin-only).
1976
- * Owner is not assignable here — use `transferBusinessAccountOwnership` for that.
1977
- *
1978
- * @param params.businessAccountId - The business account the member belongs to.
1979
- * @param params.userId - The member whose role changes.
1980
- * @param params.role - The new role (`admin` or `viewer`).
1981
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1982
- * @returns The updated business account member.
1983
- *
1984
- * @example
1985
- * ```ts
1986
- * await updateBusinessAccountMemberRole({
1987
- * businessAccountId,
1988
- * userId: member.userId,
1989
- * role: 'admin',
1990
- * });
1991
- * ```
1992
- *
1993
- * @see transferBusinessAccountOwnership
1994
- * @see addBusinessAccountMember
1995
- * @notInstrumented
1996
- */
1997
- const updateBusinessAccountMemberRole = async ({ businessAccountId, userId, role }, client = getDefaultClient()) => {
1998
- const core = getCore(client);
1999
- return await createApiClient({ elevatedAccessTokenScope: TokenScope.BusinessAccountmemberroleupdate }, client).sdkUpdateBusinessAccountMemberRole({
2000
- businessAccountId,
2001
- environmentId: core.environmentId,
2002
- updateBusinessAccountMemberRoleSdkRequest: { role: ROLE_TO_API[role] },
2003
- userId
2004
- });
2005
- };
2006
-
2007
- //#endregion
2008
- //#region src/modules/waas/updateWaasPassword/updateWaasPassword.ts
2009
- /**
2010
- * Updates the password for a WaaS wallet account.
2011
- *
2012
- * This function changes the password used to encrypt and protect the
2013
- * cryptographic key shares for the specified wallet account.
2014
- *
2015
- * @param params.walletAccount - The WaaS wallet account to update the password for.
2016
- * @param params.currentPassword - The current password for the wallet.
2017
- * @param params.newPassword - The new password to set for the wallet.
2018
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
2019
- * @returns A promise that resolves when the password is successfully updated.
2020
- * @notInstrumented
2021
- */
2022
- const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount }, client = getDefaultClient()) => {
2023
- return getWaasWalletProviderFromWalletAccount({ walletAccount }, client).updatePassword({
2024
- currentPassword,
2025
- newPassword,
2026
- walletAccount
2027
- });
2028
- };
2029
-
2030
- //#endregion
2031
- //#region src/modules/waas/policies/upsertAccountPolicyRule/upsertAccountPolicyRule.ts
2032
- /**
2033
- * Creates or updates a single rule on a business account's account-Layer
2034
- * (rules applied to every wallet in the account). Build `rule` with
2035
- * {@link buildAllowPolicyRule} / {@link buildDenyPolicyRule}. Omit
2036
- * `rule.ruleId` to create a new rule (the enclave mints one for you); pass
2037
- * an existing `ruleId` to update it in place. BA owner/admin only. Calls
2038
- * the SDK API directly (no MPC step), so a rejection surfaces as a thrown
2039
- * error.
2040
- *
2041
- * @param params.businessAccountId - The business account to apply the rule to.
2042
- * @param params.rule - The rule to create or update.
2043
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
2044
- * @returns The account-Layer as it stands after the rule is applied.
2045
- * @notInstrumented
2046
- */
2047
- const upsertAccountPolicyRule = async ({ businessAccountId, rule }, client = getDefaultClient()) => {
2048
- const core = getCore(client);
2049
- return createApiClient({}, client).updateBusinessAccountPolicyLayer({
2050
- businessAccountId,
2051
- environmentId: core.environmentId,
2052
- waasPolicyLayerUpdateRequest: {
2053
- op: WaasPolicyLayerUpdateRequestOpEnum.Upsert,
2054
- rule
2055
- }
2056
- });
2057
- };
2058
-
2059
- //#endregion
2060
- //#region src/modules/waas/policies/upsertSignerPolicyRule/upsertSignerPolicyRule.ts
2061
- /**
2062
- * Creates or updates a single rule on a signer's policy layer. Build `rule`
2063
- * with {@link buildAllowPolicyRule} / {@link buildDenyPolicyRule}. Omit
2064
- * `rule.ruleId` to create a new rule (the enclave mints one for you); pass an
2065
- * existing `ruleId` to update it in place. Calls the SDK API directly (no MPC
2066
- * step), so a rejection surfaces as a thrown error.
2067
- *
2068
- * @param params.walletAccount - The wallet account whose signer-Layer to update.
2069
- * @param params.rule - The rule to create or update.
2070
- * @param [params.shareSetId] - The share set to target; defaults to the caller's own. Only the wallet's own owner may target another share set.
2071
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
2072
- * @returns The signer-Layer as it stands after the rule is applied.
2073
- * @throws {ValueMustBeDefinedError} When `walletAccount` has no `verifiedCredentialId` (it isn't a verified wallet account yet).
2074
- * @throws {APIError} When the SDK API request fails, for example an unauthorized, not-found, or server error response.
2075
- * @notInstrumented
2076
- */
2077
- const upsertSignerPolicyRule = async ({ rule, shareSetId, walletAccount }, client = getDefaultClient()) => {
2078
- assertDefined(walletAccount.verifiedCredentialId, "upsertSignerPolicyRule: cannot resolve a wallet id — use a verified wallet account");
2079
- const core = getCore(client);
2080
- return createApiClient({}, client).updateWaasSignerSelfPolicyLayer({
2081
- environmentId: core.environmentId,
2082
- waasSignerPolicyLayerUpdateRequest: {
2083
- op: WaasSignerPolicyLayerUpdateRequestOpEnum.Upsert,
2084
- rule,
2085
- shareSetId
2086
- },
2087
- walletId: walletAccount.verifiedCredentialId
2088
- });
2089
- };
2090
-
2091
- //#endregion
2092
- //#region src/modules/waas/policies/upsertWalletPolicyRule/upsertWalletPolicyRule.ts
2093
- /**
2094
- * Creates or updates a single rule on a wallet's policy layer. Build `rule`
2095
- * with {@link buildAllowPolicyRule} / {@link buildDenyPolicyRule}. Omit
2096
- * `rule.ruleId` to create a new rule (the enclave mints one for you); pass an
2097
- * existing `ruleId` to update it in place. Calls the SDK API directly (no MPC
2098
- * step), so a rejection surfaces as a thrown error.
2099
- *
2100
- * @param params.walletAccount - The wallet account to apply the rule to.
2101
- * @param params.rule - The rule to create or update.
2102
- * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
2103
- * @returns The wallet-Layer as it stands after the rule is applied.
2104
- * @throws {ValueMustBeDefinedError} When `walletAccount` has no `verifiedCredentialId` (it isn't a verified wallet account yet).
2105
- * @throws {APIError} When the SDK API request fails, for example an unauthorized, not-found, or server error response.
2106
- * @notInstrumented
2107
- */
2108
- const upsertWalletPolicyRule = async ({ rule, walletAccount }, client = getDefaultClient()) => {
2109
- assertDefined(walletAccount.verifiedCredentialId, "upsertWalletPolicyRule: cannot resolve a wallet id — use a verified wallet account");
2110
- const core = getCore(client);
2111
- return createApiClient({}, client).updateWaasWalletSelfPolicyLayer({
2112
- environmentId: core.environmentId,
2113
- waasPolicyLayerUpdateRequest: {
2114
- op: WaasPolicyLayerUpdateRequestOpEnum.Upsert,
2115
- rule
2116
- },
2117
- walletId: walletAccount.verifiedCredentialId
2118
- });
2119
- };
2120
-
2121
- //#endregion
2122
- //#region src/exports/waas.ts
2123
- assertPackageVersion(name, version);
2124
-
2125
- //#endregion
2126
- export { NotWaasWalletProviderError, TransactionBroadcastError, WaasWalletShareSetType, addBusinessAccountMember, addBusinessAccountSigner, addWalletToBusinessAccount, backupWaasKeySharesToGoogleDrive, buildAllowPolicyRule, buildDenyPolicyRule, createBusinessAccount, createPolicy, createWaasOfflineRecoveryShares, createWaasWalletAccounts, createWalletForBusinessAccount, delegateWaasKeyShares, desugarPolicyRules, expandPolicyRules, exportWaasClientKeyshares, exportWaasPrivateKey, getAccountPolicyLayer, getBusinessAccount, getChainsMissingWaasWalletAccounts, getPolicy, getSignerPolicyLayer, getWalletAccountShareSets, getWalletPolicyLayer, getWalletRecoveryState, hasDelegatedAccess, importWaasPrivateKey, isDynamicWaasEnabled, isPasswordRequiredForWaasWallets, isWaasWalletAccount, isWalletCreationRequirement, listBusinessAccounts, migrateFromFireblocks, normalizeWalletRequirements, refreshWaasWalletAccountShares, removeAccountPolicyRule, removeBusinessAccountMember, removeBusinessAccountSigner, removeBusinessAccountWallet, removePolicyRules, removeSignerPolicyRule, removeWalletPolicyRule, resolvePolicyScope, revokeWaasDelegation, setWaasWalletAccountPassword, shouldAutoCreateWalletForChain, signSerializedTransaction, transferBusinessAccountOwnership, unlockWallet, updateBusinessAccount, updateBusinessAccountMemberRole, updateWaasPassword, upsertAccountPolicyRule, upsertSignerPolicyRule, upsertWalletPolicyRule };
2127
- //# sourceMappingURL=waas.esm.js.map
6
+ export { NotWaasWalletProviderError, TransactionBroadcastError, WaasChainEnum, WaasWalletShareSetType, addBusinessAccountMember, addBusinessAccountSigner, addWalletToBusinessAccount, backupWaasKeySharesToGoogleDrive, buildAllowPolicyRule, buildDenyPolicyRule, createBusinessAccount, createPolicy, createWaasOfflineRecoveryShares, createWaasWalletAccounts, createWalletForBusinessAccount, delegateWaasKeyShares, desugarPolicyRules, expandPolicyRules, exportWaasClientKeyshares, exportWaasPrivateKey, getAccountPolicyLayer, getBusinessAccount, getChainsMissingWaasWalletAccounts, getPolicy, getSignerPolicyLayer, getWalletAccountShareSets, getWalletPolicyLayer, getWalletRecoveryState, hasDelegatedAccess, importWaasPrivateKey, isDynamicWaasEnabled, isPasswordRequiredForWaasWallets, isWaasWalletAccount, isWalletCreationRequirement, listBusinessAccounts, migrateFromFireblocks, normalizeWalletRequirements, refreshWaasWalletAccountShares, removeAccountPolicyRule, removeBusinessAccountMember, removeBusinessAccountSigner, removeBusinessAccountWallet, removePolicyRules, removeSignerPolicyRule, removeWalletPolicyRule, resolvePolicyScope, revokeWaasDelegation, setWaasWalletAccountPassword, shouldAutoCreateWalletForChain, signSerializedTransaction, transferBusinessAccountOwnership, unlockWallet, updateBusinessAccount, updateBusinessAccountMemberRole, updateWaasPassword, upsertAccountPolicyRule, upsertSignerPolicyRule, upsertWalletPolicyRule };