@dynamic-labs-sdk/client 0.1.0-alpha.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +302 -0
- package/InvalidParamError.cjs.js +2 -2
- package/InvalidParamError.esm.js +1 -1
- package/NotWaasWalletAccountError.cjs.js +7 -7
- package/NotWaasWalletAccountError.esm.js +2 -2
- package/constants.cjs.js +493 -9
- package/constants.cjs2.js +15 -0
- package/constants.esm.js +468 -7
- package/constants.esm2.js +11 -0
- package/core.cjs.js +96 -41
- package/core.esm.js +47 -10
- package/filterDuplicates.cjs.js +8 -0
- package/filterDuplicates.esm.js +6 -0
- package/getNetworkProviderFromNetworkId.cjs.js +178 -20
- package/getNetworkProviderFromNetworkId.esm.js +150 -3
- package/getSignedSessionId.cjs.js +7 -7
- package/getSignedSessionId.esm.js +2 -2
- package/getVerifiedCredentialForWalletAccount.cjs.js +515 -0
- package/getVerifiedCredentialForWalletAccount.esm.js +491 -0
- package/index.cjs.js +1231 -470
- package/index.esm.js +1028 -280
- package/isMfaRequiredForAction.cjs.js +15 -8
- package/isMfaRequiredForAction.esm.js +8 -2
- package/package.json +4 -4
- package/src/client/core/createCore/createCore.d.ts.map +1 -1
- package/src/client/core/createCore/getInitialState.d.ts.map +1 -1
- package/src/client/core/types/DynamicCore.d.ts +8 -0
- package/src/client/core/types/DynamicCore.d.ts.map +1 -1
- package/src/client/createDynamicClient/createDynamicClient.d.ts.map +1 -1
- package/src/client/types/DynamicClientConfig.d.ts +6 -1
- package/src/client/types/DynamicClientConfig.d.ts.map +1 -1
- package/src/constants.d.ts +1 -0
- package/src/constants.d.ts.map +1 -1
- package/src/errors/APIError/APIError.d.ts.map +1 -1
- package/src/errors/InvalidWalletProviderKeyError.d.ts +5 -0
- package/src/errors/InvalidWalletProviderKeyError.d.ts.map +1 -0
- package/src/errors/MissingUserVerificationError.d.ts +12 -0
- package/src/errors/MissingUserVerificationError.d.ts.map +1 -0
- package/src/errors/NoSmartWalletAccountSignerFoundError.d.ts +5 -0
- package/src/errors/NoSmartWalletAccountSignerFoundError.d.ts.map +1 -0
- package/src/errors/WalletAccountNotSelectedError.d.ts.map +1 -1
- package/src/exports/core.d.ts +102 -2
- package/src/exports/core.d.ts.map +1 -1
- package/src/exports/index.d.ts +25 -7
- package/src/exports/index.d.ts.map +1 -1
- package/src/exports/waas.d.ts +2 -0
- package/src/exports/waas.d.ts.map +1 -1
- package/src/modules/apiClient/createApiClient.d.ts.map +1 -1
- package/src/modules/auth/createVisit/createVisit.d.ts.map +1 -1
- package/src/modules/auth/logout/logout.d.ts.map +1 -1
- package/src/modules/auth/passkeys/getPasskeyAuthenticationOptions/getPasskeyAuthenticationOptions.d.ts +4 -1
- package/src/modules/auth/passkeys/getPasskeyAuthenticationOptions/getPasskeyAuthenticationOptions.d.ts.map +1 -1
- package/src/modules/auth/passkeys/getPasskeyAuthenticationSignInOptions/getPasskeyAuthenticationSignInOptions.d.ts +4 -1
- package/src/modules/auth/passkeys/getPasskeyAuthenticationSignInOptions/getPasskeyAuthenticationSignInOptions.d.ts.map +1 -1
- package/src/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts +4 -1
- package/src/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts.map +1 -1
- package/src/modules/auth/social/getUserSocialAccounts/getUserSocialAccounts.d.ts +9 -0
- package/src/modules/auth/social/getUserSocialAccounts/getUserSocialAccounts.d.ts.map +1 -0
- package/src/modules/auth/social/getUserSocialAccounts/index.d.ts +2 -0
- package/src/modules/auth/social/getUserSocialAccounts/index.d.ts.map +1 -0
- package/src/modules/auth/social/oauth/{signInWithSocialRedirect/signInWithSocialRedirect.d.ts → authenticateWithSocial/authenticateWithSocial.d.ts} +5 -3
- package/src/modules/auth/social/oauth/authenticateWithSocial/authenticateWithSocial.d.ts.map +1 -0
- package/src/modules/auth/social/oauth/authenticateWithSocial/buildOAuthUrl/addOAuthUrlParams/addOAuthUrlParams.d.ts.map +1 -0
- package/src/modules/auth/social/oauth/authenticateWithSocial/buildOAuthUrl/addOAuthUrlParams/index.d.ts.map +1 -0
- package/src/modules/auth/social/oauth/authenticateWithSocial/buildOAuthUrl/buildOAuthUrl.d.ts.map +1 -0
- package/src/modules/auth/social/oauth/authenticateWithSocial/buildOAuthUrl/getOAuthBaseUrl/getOAuthBaseUrl.d.ts.map +1 -0
- package/src/modules/auth/social/oauth/authenticateWithSocial/buildOAuthUrl/getOAuthBaseUrl/index.d.ts.map +1 -0
- package/src/modules/auth/social/oauth/{signInWithSocialRedirect → authenticateWithSocial}/buildOAuthUrl/index.d.ts.map +1 -1
- package/src/modules/auth/social/oauth/authenticateWithSocial/index.d.ts +2 -0
- package/src/modules/auth/social/oauth/{signInWithSocialRedirect → authenticateWithSocial}/index.d.ts.map +1 -1
- package/src/modules/auth/social/oauth/{completeSocialRedirectSignIn/completeSocialRedirectSignIn.d.ts → completeSocialAuthentication/completeSocialAuthentication.d.ts} +3 -3
- package/src/modules/auth/social/oauth/completeSocialAuthentication/completeSocialAuthentication.d.ts.map +1 -0
- package/src/modules/auth/social/oauth/completeSocialAuthentication/index.d.ts +2 -0
- package/src/modules/auth/social/oauth/{completeSocialRedirectSignIn → completeSocialAuthentication}/index.d.ts.map +1 -1
- package/src/modules/auth/social/oauth/redirectStateStorageSchema/index.d.ts +1 -1
- package/src/modules/auth/social/oauth/redirectStateStorageSchema/index.d.ts.map +1 -1
- package/src/modules/auth/social/oauth/redirectStateStorageSchema/redirectStateStorageSchema.d.ts +1 -1
- package/src/modules/auth/social/oauth/redirectStateStorageSchema/redirectStateStorageSchema.d.ts.map +1 -1
- package/src/modules/auth/social/oauth/unlinkSocialAccount/index.d.ts +2 -0
- package/src/modules/auth/social/oauth/unlinkSocialAccount/index.d.ts.map +1 -0
- package/src/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts +14 -0
- package/src/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts.map +1 -0
- package/src/modules/auth/social/removeDynamicOauthParamsFromUrl/index.d.ts +2 -0
- package/src/modules/auth/social/removeDynamicOauthParamsFromUrl/index.d.ts.map +1 -0
- package/src/modules/auth/social/removeDynamicOauthParamsFromUrl/removeDynamicOauthParamsFromUrl.d.ts +2 -0
- package/src/modules/auth/social/removeDynamicOauthParamsFromUrl/removeDynamicOauthParamsFromUrl.d.ts.map +1 -0
- package/src/modules/auth/social/social.types.d.ts +9 -0
- package/src/modules/auth/social/social.types.d.ts.map +1 -1
- package/src/modules/auth/updateAuthFromVerifyResponse/checkAndRaiseWalletAccountsChangedEvent/checkAndRaiseWalletAccountsChangedEvent.d.ts.map +1 -1
- package/src/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.d.ts.map +1 -1
- package/src/modules/balances/getMultichainBalances/getMultichainBalances.d.ts +1 -2
- package/src/modules/balances/getMultichainBalances/getMultichainBalances.d.ts.map +1 -1
- package/src/modules/balances/getMultichainBalances/index.d.ts +1 -1
- package/src/modules/balances/getMultichainBalances/index.d.ts.map +1 -1
- package/src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/addCoinbaseOnrampOrderEventListener.d.ts +18 -0
- package/src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/addCoinbaseOnrampOrderEventListener.d.ts.map +1 -0
- package/src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/index.d.ts +2 -0
- package/src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/index.d.ts.map +1 -0
- package/src/modules/funding/coinbase/coinbase.types.d.ts +269 -0
- package/src/modules/funding/coinbase/coinbase.types.d.ts.map +1 -0
- package/src/modules/funding/coinbase/createCoinbaseOnrampOrder/createCoinbaseOnrampOrder.d.ts +11 -0
- package/src/modules/funding/coinbase/createCoinbaseOnrampOrder/createCoinbaseOnrampOrder.d.ts.map +1 -0
- package/src/modules/funding/coinbase/createCoinbaseOnrampOrder/index.d.ts +2 -0
- package/src/modules/funding/coinbase/createCoinbaseOnrampOrder/index.d.ts.map +1 -0
- package/src/modules/funding/coinbase/getCoinbaseBuyUrl/getCoinbaseBuyUrl.d.ts +10 -0
- package/src/modules/funding/coinbase/getCoinbaseBuyUrl/getCoinbaseBuyUrl.d.ts.map +1 -0
- package/src/modules/funding/coinbase/getCoinbaseBuyUrl/index.d.ts +2 -0
- package/src/modules/funding/coinbase/getCoinbaseBuyUrl/index.d.ts.map +1 -0
- package/src/modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder/getMissingVerificationForCoinbaseOnrampOrder.d.ts +23 -0
- package/src/modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder/getMissingVerificationForCoinbaseOnrampOrder.d.ts.map +1 -0
- package/src/modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder/index.d.ts +2 -0
- package/src/modules/funding/coinbase/getMissingVerificationForCoinbaseOnrampOrder/index.d.ts.map +1 -0
- package/src/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/index.d.ts +2 -0
- package/src/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/index.d.ts.map +1 -0
- package/src/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/validateUserCredentialsForCoinbaseOnrampOrder.d.ts +4 -0
- package/src/modules/funding/coinbase/utils/validateUserCredentialsForCoinbaseOnrampOrder/validateUserCredentialsForCoinbaseOnrampOrder.d.ts.map +1 -0
- package/src/modules/funding/cryptoDotCom/createCryptoDotComPayment/createCryptoDotComPayment.d.ts +10 -0
- package/src/modules/funding/cryptoDotCom/createCryptoDotComPayment/createCryptoDotComPayment.d.ts.map +1 -0
- package/src/modules/funding/cryptoDotCom/createCryptoDotComPayment/index.d.ts +2 -0
- package/src/modules/funding/cryptoDotCom/createCryptoDotComPayment/index.d.ts.map +1 -0
- package/src/modules/funding/cryptoDotCom/cryptoDotCom.types.d.ts +8 -0
- package/src/modules/funding/cryptoDotCom/cryptoDotCom.types.d.ts.map +1 -0
- package/src/modules/initializeClient/consts.d.ts +5 -0
- package/src/modules/initializeClient/consts.d.ts.map +1 -0
- package/src/modules/initializeClient/initializeClient.d.ts.map +1 -1
- package/src/modules/initializeClient/waitForProjectSettings/index.d.ts +2 -0
- package/src/modules/initializeClient/waitForProjectSettings/index.d.ts.map +1 -0
- package/src/modules/initializeClient/waitForProjectSettings/waitForProjectSettings.d.ts +3 -0
- package/src/modules/initializeClient/waitForProjectSettings/waitForProjectSettings.d.ts.map +1 -0
- package/src/modules/mfa/authenticatePasskeyMFA/authenticatePasskeyMFA.d.ts +2 -1
- package/src/modules/mfa/authenticatePasskeyMFA/authenticatePasskeyMFA.d.ts.map +1 -1
- package/src/modules/otp/verifyOTP/verifyOTP.d.ts +3 -2
- package/src/modules/otp/verifyOTP/verifyOTP.d.ts.map +1 -1
- package/src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts.map +1 -1
- package/src/modules/projectSettings/fetchProjectSettings/projectSettingsExpirationScheme.d.ts +1 -1
- package/src/modules/projectSettings/fetchProjectSettings/projectSettingsExpirationScheme.d.ts.map +1 -1
- package/src/modules/storageSync/hydrateStateWithStorage/hydrateStateWithStorage.d.ts.map +1 -1
- package/src/modules/storageSync/schema.d.ts +15 -2
- package/src/modules/storageSync/schema.d.ts.map +1 -1
- package/src/modules/storageSync/syncStateWithStorage/syncStateWithStorage.d.ts.map +1 -1
- package/src/modules/user/deleteUser/deleteUser.d.ts +11 -0
- package/src/modules/user/deleteUser/deleteUser.d.ts.map +1 -0
- package/src/modules/user/deleteUser/index.d.ts +2 -0
- package/src/modules/user/deleteUser/index.d.ts.map +1 -0
- package/src/modules/waas/constants.d.ts +2 -2
- package/src/modules/waas/constants.d.ts.map +1 -1
- package/src/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/src/modules/waas/createWaasWalletAccounts/createWaasWalletAccounts.d.ts.map +1 -1
- package/src/modules/waas/delegateWaasKeyShares/delegateWaasKeyShares.d.ts.map +1 -1
- package/src/modules/waas/getWaasWalletProviderByChain/getWaasWalletProviderByChain.d.ts.map +1 -1
- package/src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.d.ts +14 -0
- package/src/modules/waas/hasDelegatedAccess/hasDelegatedAccess.d.ts.map +1 -0
- package/src/modules/waas/hasDelegatedAccess/index.d.ts +2 -0
- package/src/modules/waas/hasDelegatedAccess/index.d.ts.map +1 -0
- package/src/modules/waas/isWaasWalletAccount/isWaasWalletAccount.d.ts.map +1 -1
- package/src/modules/waas/isWaasWalletProvider/isWaasWalletProvider.d.ts.map +1 -1
- package/src/modules/waas/revokeWaasDelegation/index.d.ts +2 -0
- package/src/modules/waas/revokeWaasDelegation/index.d.ts.map +1 -0
- package/src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.d.ts +16 -0
- package/src/modules/waas/revokeWaasDelegation/revokeWaasDelegation.d.ts.map +1 -0
- package/src/modules/waas/waas.types.d.ts +4 -0
- package/src/modules/waas/waas.types.d.ts.map +1 -1
- package/src/modules/wallets/connectWithWalletProvider/connectWithWalletProvider.d.ts +4 -3
- package/src/modules/wallets/connectWithWalletProvider/connectWithWalletProvider.d.ts.map +1 -1
- package/src/modules/wallets/constants.d.ts.map +1 -1
- package/src/modules/wallets/getAvailableWalletProvidersData/getAvailableWalletProvidersData.d.ts +2 -6
- package/src/modules/wallets/getAvailableWalletProvidersData/getAvailableWalletProvidersData.d.ts.map +1 -1
- package/src/modules/wallets/getOwnerWalletAccountForSmartWalletAccount/getOwnerWalletAccountForSmartWalletAccount.d.ts +7 -0
- package/src/modules/wallets/getOwnerWalletAccountForSmartWalletAccount/getOwnerWalletAccountForSmartWalletAccount.d.ts.map +1 -0
- package/src/modules/wallets/getOwnerWalletAccountForSmartWalletAccount/index.d.ts +2 -0
- package/src/modules/wallets/getOwnerWalletAccountForSmartWalletAccount/index.d.ts.map +1 -0
- package/src/modules/wallets/getWalletAccountAddressByType/getWalletAccountAddressByType.d.ts +8 -0
- package/src/modules/wallets/getWalletAccountAddressByType/getWalletAccountAddressByType.d.ts.map +1 -0
- package/src/modules/wallets/getWalletAccountAddressByType/index.d.ts +2 -0
- package/src/modules/wallets/getWalletAccountAddressByType/index.d.ts.map +1 -0
- package/src/modules/wallets/getWalletAccounts/getWalletAccounts.d.ts.map +1 -1
- package/src/modules/wallets/getWalletAccounts/getWalletAccountsFromState/getWalletAccountsFromState.d.ts +9 -1
- package/src/modules/wallets/getWalletAccounts/getWalletAccountsFromState/getWalletAccountsFromState.d.ts.map +1 -1
- package/src/modules/wallets/getWalletProviderDataByKey/getWalletProviderDataByKey.d.ts +14 -0
- package/src/modules/wallets/getWalletProviderDataByKey/getWalletProviderDataByKey.d.ts.map +1 -0
- package/src/modules/wallets/getWalletProviderDataByKey/index.d.ts +2 -0
- package/src/modules/wallets/getWalletProviderDataByKey/index.d.ts.map +1 -0
- package/src/modules/wallets/isWalletAccountVerified/index.d.ts +2 -0
- package/src/modules/wallets/isWalletAccountVerified/index.d.ts.map +1 -0
- package/src/modules/wallets/isWalletAccountVerified/isWalletAccountVerified.d.ts +13 -0
- package/src/modules/wallets/isWalletAccountVerified/isWalletAccountVerified.d.ts.map +1 -0
- package/src/modules/wallets/networks/getNetworkDataForNetworkId/getNetworkDataForNetworkId.d.ts +10 -0
- package/src/modules/wallets/networks/getNetworkDataForNetworkId/getNetworkDataForNetworkId.d.ts.map +1 -0
- package/src/modules/wallets/networks/getNetworkDataForNetworkId/index.d.ts +2 -0
- package/src/modules/wallets/networks/getNetworkDataForNetworkId/index.d.ts.map +1 -0
- package/src/modules/wallets/networks/getTransactionHistory/getTransactionHistory.d.ts +26 -0
- package/src/modules/wallets/networks/getTransactionHistory/getTransactionHistory.d.ts.map +1 -0
- package/src/modules/wallets/networks/getTransactionHistory/index.d.ts +3 -0
- package/src/modules/wallets/networks/getTransactionHistory/index.d.ts.map +1 -0
- package/src/modules/wallets/networks/lastKnownNetworkRegistry/createLastKnownNetworkRegistry/createLastKnownNetworkRegistry.d.ts.map +1 -1
- package/src/modules/wallets/networks/lastKnownNetworkRegistry/createLastKnownNetworkRegistry/schema.d.ts +1 -1
- package/src/modules/wallets/networks/lastKnownNetworkRegistry/createLastKnownNetworkRegistry/schema.d.ts.map +1 -1
- package/src/modules/wallets/proveWalletAccountOwnership/proveWalletAccountOwnership.d.ts +1 -1
- package/src/modules/wallets/proveWalletAccountOwnership/proveWalletAccountOwnership.d.ts.map +1 -1
- package/src/modules/wallets/removeWalletAccount/removeWalletAccount.d.ts.map +1 -1
- package/src/modules/wallets/unverifiedWalletAccounts/removeUnverifiedWalletAccount/removeUnverifiedWalletAccount.d.ts.map +1 -1
- package/src/modules/wallets/unverifiedWalletAccounts/schema.d.ts +5 -0
- package/src/modules/wallets/unverifiedWalletAccounts/schema.d.ts.map +1 -1
- package/src/modules/wallets/unverifiedWalletAccounts/setUnverifiedWalletAccounts/setUnverifiedWalletAccounts.d.ts +2 -0
- package/src/modules/wallets/unverifiedWalletAccounts/setUnverifiedWalletAccounts/setUnverifiedWalletAccounts.d.ts.map +1 -1
- package/src/modules/wallets/utils/convertUnverifiedWalletAccountToWalletAccount/convertUnverifiedWalletAccountToWalletAccount.d.ts +5 -1
- package/src/modules/wallets/utils/convertUnverifiedWalletAccountToWalletAccount/convertUnverifiedWalletAccountToWalletAccount.d.ts.map +1 -1
- package/src/modules/wallets/utils/convertVerifiedCredentialToWalletAccount/convertVerifiedCredentialToWalletAccount.d.ts +6 -1
- package/src/modules/wallets/utils/convertVerifiedCredentialToWalletAccount/convertVerifiedCredentialToWalletAccount.d.ts.map +1 -1
- package/src/modules/wallets/utils/formatSignInMessage/formatSignInMessage.d.ts +9 -7
- package/src/modules/wallets/utils/formatSignInMessage/formatSignInMessage.d.ts.map +1 -1
- package/src/modules/wallets/utils/formatWalletAccountId/formatWalletAccountId.d.ts +9 -0
- package/src/modules/wallets/utils/formatWalletAccountId/formatWalletAccountId.d.ts.map +1 -0
- package/src/modules/wallets/utils/formatWalletAccountId/index.d.ts +2 -0
- package/src/modules/wallets/utils/formatWalletAccountId/index.d.ts.map +1 -0
- package/src/modules/wallets/utils/formatWalletProviderKey/formatWalletProviderKey.d.ts +17 -2
- package/src/modules/wallets/utils/formatWalletProviderKey/formatWalletProviderKey.d.ts.map +1 -1
- package/src/modules/wallets/utils/getAddressesWithTypesFromConnectionResult/getAddressesWithTypesFromConnectionResult.d.ts +4 -0
- package/src/modules/wallets/utils/getAddressesWithTypesFromConnectionResult/getAddressesWithTypesFromConnectionResult.d.ts.map +1 -0
- package/src/modules/wallets/utils/getAddressesWithTypesFromConnectionResult/index.d.ts +2 -0
- package/src/modules/wallets/utils/getAddressesWithTypesFromConnectionResult/index.d.ts.map +1 -0
- package/src/modules/wallets/utils/getChainIdForAccountVerification/getChainIdForAccountVerification.d.ts.map +1 -1
- package/src/modules/wallets/utils/getInjectedProviderFromWindow/getInjectedProviderFromWindow.d.ts +2 -0
- package/src/modules/wallets/utils/getInjectedProviderFromWindow/getInjectedProviderFromWindow.d.ts.map +1 -0
- package/src/modules/wallets/utils/getInjectedProviderFromWindow/index.d.ts +2 -0
- package/src/modules/wallets/utils/getInjectedProviderFromWindow/index.d.ts.map +1 -0
- package/src/modules/wallets/utils/getSignInMessage/createSignInMessageStatement/createSignInMessageStatement.d.ts +3 -0
- package/src/modules/wallets/utils/getSignInMessage/createSignInMessageStatement/createSignInMessageStatement.d.ts.map +1 -0
- package/src/modules/wallets/utils/getSignInMessage/createSignInMessageStatement/index.d.ts +2 -0
- package/src/modules/wallets/utils/getSignInMessage/createSignInMessageStatement/index.d.ts.map +1 -0
- package/src/modules/wallets/utils/getSignInMessage/getSignInMessage.d.ts.map +1 -1
- package/src/modules/wallets/utils/getVerifiedCredentialForWalletAccount/getVerifiedCredentialForWalletAccount.d.ts +8 -0
- package/src/modules/wallets/utils/getVerifiedCredentialForWalletAccount/getVerifiedCredentialForWalletAccount.d.ts.map +1 -0
- package/src/modules/wallets/utils/getVerifiedCredentialForWalletAccount/index.d.ts +2 -0
- package/src/modules/wallets/utils/getVerifiedCredentialForWalletAccount/index.d.ts.map +1 -0
- package/src/modules/wallets/utils/normalizeWalletNameWithChain/index.d.ts +2 -0
- package/src/modules/wallets/utils/normalizeWalletNameWithChain/index.d.ts.map +1 -0
- package/src/modules/wallets/utils/normalizeWalletNameWithChain/normalizeWalletNameWithChain.d.ts +12 -0
- package/src/modules/wallets/utils/normalizeWalletNameWithChain/normalizeWalletNameWithChain.d.ts.map +1 -0
- package/src/modules/wallets/verifySignInMessage/index.d.ts +2 -0
- package/src/modules/wallets/verifySignInMessage/index.d.ts.map +1 -0
- package/src/modules/wallets/verifySignInMessage/verifySignInMessage.d.ts +22 -0
- package/src/modules/wallets/verifySignInMessage/verifySignInMessage.d.ts.map +1 -0
- package/src/modules/wallets/verifyWalletAccount/verifyWalletAccount.d.ts.map +1 -1
- package/src/modules/wallets/walletAccount/index.d.ts +1 -1
- package/src/modules/wallets/walletAccount/index.d.ts.map +1 -1
- package/src/modules/wallets/walletAccount/walletAccount.types.d.ts +8 -0
- package/src/modules/wallets/walletAccount/walletAccount.types.d.ts.map +1 -1
- package/src/modules/wallets/walletProvider/index.d.ts +1 -1
- package/src/modules/wallets/walletProvider/index.d.ts.map +1 -1
- package/src/modules/wallets/walletProvider/splitWalletProviderKey/index.d.ts +2 -0
- package/src/modules/wallets/walletProvider/splitWalletProviderKey/index.d.ts.map +1 -0
- package/src/modules/wallets/walletProvider/splitWalletProviderKey/splitWalletProviderKey.d.ts +9 -0
- package/src/modules/wallets/walletProvider/splitWalletProviderKey/splitWalletProviderKey.d.ts.map +1 -0
- package/src/modules/wallets/walletProvider/walletProvider.types.d.ts +24 -8
- package/src/modules/wallets/walletProvider/walletProvider.types.d.ts.map +1 -1
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/getWalletProviderKeyFromVerifiedCredential/getWalletProviderKeyFromVerifiedCredential.d.ts +10 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/getWalletProviderKeyFromVerifiedCredential/getWalletProviderKeyFromVerifiedCredential.d.ts.map +1 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/getWalletProviderKeyFromVerifiedCredential/index.d.ts +2 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/getWalletProviderKeyFromVerifiedCredential/index.d.ts.map +1 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/schema.d.ts +3 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/schema.d.ts.map +1 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/state.d.ts +16 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/state.d.ts.map +1 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/updateWalletProviderKeysForVerifiedCredentials/index.d.ts +2 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/updateWalletProviderKeysForVerifiedCredentials/index.d.ts.map +1 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/updateWalletProviderKeysForVerifiedCredentials/updateWalletProviderKeysForVerifiedCredentials.d.ts +7 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/updateWalletProviderKeysForVerifiedCredentials/updateWalletProviderKeysForVerifiedCredentials.d.ts.map +1 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/walletProviderKeyMap.types.d.ts +12 -0
- package/src/modules/wallets/walletProvider/walletProviderKeyMap/walletProviderKeyMap.types.d.ts.map +1 -0
- package/src/services/asyncTrack/asyncTrack.types.d.ts +5 -1
- package/src/services/asyncTrack/asyncTrack.types.d.ts.map +1 -1
- package/src/services/asyncTrack/createAsyncTrack.d.ts.map +1 -1
- package/src/services/storage/index.d.ts +1 -1
- package/src/services/storage/index.d.ts.map +1 -1
- package/src/utils/debouncedMutex/createDebouncedMutex/createDebouncedMutex.d.ts +3 -0
- package/src/utils/debouncedMutex/createDebouncedMutex/createDebouncedMutex.d.ts.map +1 -0
- package/src/utils/debouncedMutex/createDebouncedMutex/index.d.ts +2 -0
- package/src/utils/debouncedMutex/createDebouncedMutex/index.d.ts.map +1 -0
- package/src/utils/debouncedMutex/debouncedMutex.types.d.ts +39 -0
- package/src/utils/debouncedMutex/debouncedMutex.types.d.ts.map +1 -0
- package/src/utils/debouncedMutex/index.d.ts +2 -0
- package/src/utils/debouncedMutex/index.d.ts.map +1 -0
- package/waas.cjs.js +86 -38
- package/waas.esm.js +62 -16
- package/waasCore.cjs.js +21 -10
- package/waasCore.esm.js +15 -4
- package/getWalletProviderByKey.cjs.js +0 -74
- package/getWalletProviderByKey.esm.js +0 -69
- package/logout.cjs.js +0 -1086
- package/logout.esm.js +0 -1020
- package/src/modules/apiClient/utils/logoutOnUnauthorizedRequestMiddleware/index.d.ts +0 -2
- package/src/modules/apiClient/utils/logoutOnUnauthorizedRequestMiddleware/index.d.ts.map +0 -1
- package/src/modules/apiClient/utils/logoutOnUnauthorizedRequestMiddleware/logoutOnUnauthorizedRequestMiddleware.d.ts +0 -4
- package/src/modules/apiClient/utils/logoutOnUnauthorizedRequestMiddleware/logoutOnUnauthorizedRequestMiddleware.d.ts.map +0 -1
- package/src/modules/auth/social/oauth/completeSocialRedirectSignIn/completeSocialRedirectSignIn.d.ts.map +0 -1
- package/src/modules/auth/social/oauth/completeSocialRedirectSignIn/index.d.ts +0 -2
- package/src/modules/auth/social/oauth/signInWithSocialRedirect/buildOAuthUrl/addOAuthUrlParams/addOAuthUrlParams.d.ts.map +0 -1
- package/src/modules/auth/social/oauth/signInWithSocialRedirect/buildOAuthUrl/addOAuthUrlParams/index.d.ts.map +0 -1
- package/src/modules/auth/social/oauth/signInWithSocialRedirect/buildOAuthUrl/buildOAuthUrl.d.ts.map +0 -1
- package/src/modules/auth/social/oauth/signInWithSocialRedirect/buildOAuthUrl/getOAuthBaseUrl/getOAuthBaseUrl.d.ts.map +0 -1
- package/src/modules/auth/social/oauth/signInWithSocialRedirect/buildOAuthUrl/getOAuthBaseUrl/index.d.ts.map +0 -1
- package/src/modules/auth/social/oauth/signInWithSocialRedirect/index.d.ts +0 -2
- package/src/modules/auth/social/oauth/signInWithSocialRedirect/signInWithSocialRedirect.d.ts.map +0 -1
- package/src/modules/wallets/utils/createWalletAccountId/createWalletAccountId.d.ts +0 -3
- package/src/modules/wallets/utils/createWalletAccountId/createWalletAccountId.d.ts.map +0 -1
- package/src/modules/wallets/utils/createWalletAccountId/index.d.ts +0 -2
- package/src/modules/wallets/utils/createWalletAccountId/index.d.ts.map +0 -1
- /package/src/modules/auth/social/oauth/{signInWithSocialRedirect → authenticateWithSocial}/buildOAuthUrl/addOAuthUrlParams/addOAuthUrlParams.d.ts +0 -0
- /package/src/modules/auth/social/oauth/{signInWithSocialRedirect → authenticateWithSocial}/buildOAuthUrl/addOAuthUrlParams/index.d.ts +0 -0
- /package/src/modules/auth/social/oauth/{signInWithSocialRedirect → authenticateWithSocial}/buildOAuthUrl/buildOAuthUrl.d.ts +0 -0
- /package/src/modules/auth/social/oauth/{signInWithSocialRedirect → authenticateWithSocial}/buildOAuthUrl/getOAuthBaseUrl/getOAuthBaseUrl.d.ts +0 -0
- /package/src/modules/auth/social/oauth/{signInWithSocialRedirect → authenticateWithSocial}/buildOAuthUrl/getOAuthBaseUrl/index.d.ts +0 -0
- /package/src/modules/auth/social/oauth/{signInWithSocialRedirect → authenticateWithSocial}/buildOAuthUrl/index.d.ts +0 -0
|
@@ -2,7 +2,7 @@ import type { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
|
2
2
|
import type EventEmitter from 'eventemitter3';
|
|
3
3
|
import type { Chain } from '../../chain';
|
|
4
4
|
import type { NetworkData } from '../networks/networkProvider/networkProvider.types';
|
|
5
|
-
import type { WalletAccount } from '../walletAccount';
|
|
5
|
+
import type { WalletAccount, WalletAddressType } from '../walletAccount';
|
|
6
6
|
import type { WalletProviderEvents } from './events/walletProviderEvents.types';
|
|
7
7
|
export type WalletProviderMetadata = {
|
|
8
8
|
/**
|
|
@@ -36,6 +36,19 @@ export type WalletProviderData = {
|
|
|
36
36
|
* The metadata of the wallet provider like icon and display name
|
|
37
37
|
*/
|
|
38
38
|
metadata: WalletProviderMetadata;
|
|
39
|
+
/**
|
|
40
|
+
* The type of the wallet provider.
|
|
41
|
+
* This is used to identify the wallet provider type in the backend (browser extension, wallet connect, etc.)
|
|
42
|
+
*/
|
|
43
|
+
walletProviderType: WalletProviderEnum;
|
|
44
|
+
};
|
|
45
|
+
export type WalletProviderConnectAddress = {
|
|
46
|
+
address: string;
|
|
47
|
+
publicKey?: string;
|
|
48
|
+
type?: WalletAddressType;
|
|
49
|
+
};
|
|
50
|
+
export type WalletProviderConnectResult = {
|
|
51
|
+
addresses: WalletProviderConnectAddress[];
|
|
39
52
|
};
|
|
40
53
|
export type WalletProvider = WalletProviderData & {
|
|
41
54
|
/**
|
|
@@ -48,14 +61,21 @@ export type WalletProvider = WalletProviderData & {
|
|
|
48
61
|
* Connects the dapp to the wallet provider
|
|
49
62
|
* This is optional for some wallet providers like Dynamic Waas
|
|
50
63
|
*/
|
|
51
|
-
connect?: () => Promise<
|
|
52
|
-
addresses: string[];
|
|
53
|
-
}>;
|
|
64
|
+
connect?: () => Promise<WalletProviderConnectResult>;
|
|
54
65
|
/**
|
|
55
66
|
* Disconnects the dapp from the wallet provider.
|
|
56
67
|
* This is optional for some wallet providers like Dynamic Waas.
|
|
57
68
|
*/
|
|
58
69
|
disconnect?: () => Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Performs clean up for when a wallet account is removed.
|
|
72
|
+
*
|
|
73
|
+
* For example: WalletConnect needs to actually close the entire WC session and clean up
|
|
74
|
+
* the related wallet providers.
|
|
75
|
+
*/
|
|
76
|
+
disconnectWalletAccount?: (args: {
|
|
77
|
+
walletAccount: WalletAccount;
|
|
78
|
+
}) => Promise<void>;
|
|
59
79
|
/**
|
|
60
80
|
* Emitter of events that can be listened to for the wallet provider
|
|
61
81
|
*/
|
|
@@ -77,10 +97,6 @@ export type WalletProvider = WalletProviderData & {
|
|
|
77
97
|
getConnectedAddresses: () => Promise<{
|
|
78
98
|
addresses: string[];
|
|
79
99
|
}>;
|
|
80
|
-
/**
|
|
81
|
-
* Gets the wallet provider type
|
|
82
|
-
*/
|
|
83
|
-
getWalletProviderType: () => WalletProviderEnum;
|
|
84
100
|
/**
|
|
85
101
|
* Signs a message with the wallet account
|
|
86
102
|
* This is optional, as weirdly some providers don't support this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletProvider.types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/wallets/walletProvider/walletProvider.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAE9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"walletProvider.types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/modules/wallets/walletProvider/walletProvider.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAE9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAEhF,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IACb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,EAAE,sBAAsB,CAAC;IACjC;;;OAGG;IACH,kBAAkB,EAAE,kBAAkB,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,EAAE,4BAA4B,EAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG;IAChD;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,WAAW,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,2BAA2B,CAAC,CAAC;IACrD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC;;;;;OAKG;IACH,uBAAuB,CAAC,EAAE,CAAC,IAAI,EAAE;QAC/B,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,GAAG;QAC5C;;WAEG;QACH,eAAe,EAAE,CAAC,MAAM,oBAAoB,CAAC,EAAE,CAAC;KACjD,CAAC;IACF;;OAEG;IACH,kBAAkB,EAAE,MAAM,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzD;;OAEG;IACH,qBAAqB,EAAE,MAAM,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAC9D;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE,aAAa,CAAC;KAC/B,KAAK,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrC;;OAEG;IACH,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
import type { DynamicClient } from '../../../../../client/types';
|
|
3
|
+
type GetWalletProviderKeyFromVerifiedCredentialParams = {
|
|
4
|
+
verifiedCredential: JwtVerifiedCredential;
|
|
5
|
+
};
|
|
6
|
+
export declare const getWalletProviderKeyFromVerifiedCredential: ({ verifiedCredential }: GetWalletProviderKeyFromVerifiedCredentialParams, client: DynamicClient) => {
|
|
7
|
+
walletProviderKey: string;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=getWalletProviderKeyFromVerifiedCredential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getWalletProviderKeyFromVerifiedCredential.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/wallets/walletProvider/walletProviderKeyMap/getWalletProviderKeyFromVerifiedCredential/getWalletProviderKeyFromVerifiedCredential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAKjE,KAAK,gDAAgD,GAAG;IACtD,kBAAkB,EAAE,qBAAqB,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,0CAA0C,2BAC7B,gDAAgD,UAChE,aAAa;;CAiDtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/wallets/walletProvider/walletProviderKeyMap/getWalletProviderKeyFromVerifiedCredential/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0CAA0C,EAAE,MAAM,8CAA8C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/wallets/walletProvider/walletProviderKeyMap/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,eAAO,MAAM,0BAA0B,mEAAmC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { WalletProviderKeyMap } from './walletProviderKeyMap.types';
|
|
2
|
+
declare global {
|
|
3
|
+
interface DynamicCoreState {
|
|
4
|
+
/**
|
|
5
|
+
* Keeps records on which user's Wallet verified credential maps to which wallet provider key.
|
|
6
|
+
*
|
|
7
|
+
* Even though most wallet provider keys can be easily inferred from the verified credential's data alone
|
|
8
|
+
* (walletName + walletProvider), some kinds of wallet providers (such as Wallet Connect) need a special
|
|
9
|
+
* suffix added to their keys which will not be stored in the backend. Therefore this map is necessary for
|
|
10
|
+
* those wallet providers.
|
|
11
|
+
*/
|
|
12
|
+
walletProviderKeyMap: WalletProviderKeyMap;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/wallets/walletProvider/walletProviderKeyMap/state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,gBAAgB;QACxB;;;;;;;WAOG;QACH,oBAAoB,EAAE,oBAAoB,CAAC;KAC5C;CACF;AAED,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/wallets/walletProvider/walletProviderKeyMap/updateWalletProviderKeysForVerifiedCredentials/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8CAA8C,EAAE,MAAM,kDAAkD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DynamicClient } from '../../../../../client/types';
|
|
2
|
+
type updateWalletProviderKeysForVerifiedCredentialsParams = {
|
|
3
|
+
keysToUpdate: Record<string, string>;
|
|
4
|
+
};
|
|
5
|
+
export declare const updateWalletProviderKeysForVerifiedCredentials: ({ keysToUpdate }: updateWalletProviderKeysForVerifiedCredentialsParams, client: DynamicClient) => void;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=updateWalletProviderKeysForVerifiedCredentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateWalletProviderKeysForVerifiedCredentials.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/wallets/walletProvider/walletProviderKeyMap/updateWalletProviderKeysForVerifiedCredentials/updateWalletProviderKeysForVerifiedCredentials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,KAAK,oDAAoD,GAAG;IAC1D,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,CAAC;AAEF,eAAO,MAAM,8CAA8C,qBACvC,oDAAoD,UAC9D,aAAa,SAUtB,CAAC"}
|
package/src/modules/wallets/walletProvider/walletProviderKeyMap/walletProviderKeyMap.types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type * as z from 'zod/mini';
|
|
2
|
+
import type { walletProviderKeyMapSchema } from './schema';
|
|
3
|
+
/**
|
|
4
|
+
* Keeps records on which user's Wallet verified credential maps to which wallet provider key.
|
|
5
|
+
*
|
|
6
|
+
* Even though most wallet provider keys can be easily inferred from the verified credential's data alone
|
|
7
|
+
* (walletName + walletProvider), some kinds of wallet providers (such as Wallet Connect) need a special
|
|
8
|
+
* suffix added to their keys which will not be stored in the backend. Therefore this map is necessary for
|
|
9
|
+
* those wallet providers.
|
|
10
|
+
*/
|
|
11
|
+
export type WalletProviderKeyMap = z.infer<typeof walletProviderKeyMapSchema>;
|
|
12
|
+
//# sourceMappingURL=walletProviderKeyMap.types.d.ts.map
|
package/src/modules/wallets/walletProvider/walletProviderKeyMap/walletProviderKeyMap.types.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walletProviderKeyMap.types.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/client/src/modules/wallets/walletProvider/walletProviderKeyMap/walletProviderKeyMap.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,UAAU,CAAC;AAEnC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type EventEmitter } from 'eventemitter3';
|
|
2
2
|
export type AsyncProcessStatus = 'pending' | 'resolved' | 'failed';
|
|
3
|
+
export type AsyncProcessEntry<T = unknown> = {
|
|
4
|
+
promise: Promise<T>;
|
|
5
|
+
status: AsyncProcessStatus;
|
|
6
|
+
};
|
|
3
7
|
export type AsyncTrackEmitter = EventEmitter<{
|
|
4
8
|
/**
|
|
5
9
|
* Emitted when a specific async process fails.
|
|
@@ -20,7 +24,7 @@ export type AsyncTrack = {
|
|
|
20
24
|
/**
|
|
21
25
|
* Gets the map of all registered async processes.
|
|
22
26
|
*/
|
|
23
|
-
getTracker: () =>
|
|
27
|
+
getTracker: <T>(trackerKey: string) => AsyncProcessEntry<T>;
|
|
24
28
|
/**
|
|
25
29
|
* Tracks a specific async process.
|
|
26
30
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asyncTrack.types.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/services/asyncTrack/asyncTrack.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEnE,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;IAC3C;;;;OAIG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAE/C;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"asyncTrack.types.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/services/asyncTrack/asyncTrack.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEnE,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,OAAO,IAAI;IAC3C,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,MAAM,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;IAC3C;;;;OAIG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAE/C;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,UAAU,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,KAAK,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAE5D;;OAEG;IACH,KAAK,EAAE,CAAC,KAAK,EAAE;QACb;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;KAC3B,KAAK,IAAI,CAAC;IAEX;;;;;OAKG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC,GAAG,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,KAAK,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAsyncTrack.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/services/asyncTrack/createAsyncTrack.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,UAAU,EAEX,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,
|
|
1
|
+
{"version":3,"file":"createAsyncTrack.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/services/asyncTrack/createAsyncTrack.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,UAAU,EAEX,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,UAmEnC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createLocalStorageAdapter } from './createLocalStorageAdapter';
|
|
2
2
|
export { createStorage } from './createStorage';
|
|
3
3
|
export { createStorageKeySchema } from './createStorageKeySchema';
|
|
4
|
-
export type { Storage, StorageAdapter } from './storage.types';
|
|
4
|
+
export type { Storage, StorageAdapter, StorageKeySchema, } from './storage.types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/services/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/services/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EACV,OAAO,EACP,cAAc,EACd,gBAAgB,GACjB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDebouncedMutex.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/utils/debouncedMutex/createDebouncedMutex/createDebouncedMutex.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAyB9D,eAAO,MAAM,oBAAoB,QAAO,cA2EvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../packages/client/src/utils/debouncedMutex/createDebouncedMutex/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs an async callback for a given `lockKey` **one at a time**, while
|
|
3
|
+
* *debouncing* repeated calls:
|
|
4
|
+
*
|
|
5
|
+
* - If called again **before `debounceTime` elapses**, the pending call is
|
|
6
|
+
* cancelled and only the **latest** call will eventually run.
|
|
7
|
+
* - If a previous callback is **still running**, the new call waits until
|
|
8
|
+
* that run finishes, then executes (again only the latest call survives).
|
|
9
|
+
*
|
|
10
|
+
* This ensures:
|
|
11
|
+
* • No two callbacks with the same key run concurrently.
|
|
12
|
+
* • Rapid successive calls collapse into a single execution.
|
|
13
|
+
*
|
|
14
|
+
* Useful for throttling expensive operations (e.g. API requests, writes) in
|
|
15
|
+
* a concurrent environment without dropping the final intent.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} lockKey Unique key to serialize by.
|
|
18
|
+
* @param {Function} callback Async function to run once ready.
|
|
19
|
+
* @param {number} [debounceTime] Delay (ms) to wait before triggering callback; new calls during this delay replace the pending one.
|
|
20
|
+
* @param {Function} onError Callback to run if the callback throws an error.
|
|
21
|
+
* @returns A promise that resolves when the callback has finished executing.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const debouncedMutex = createDebouncedMutex();
|
|
25
|
+
*
|
|
26
|
+
* await debouncedMutex({
|
|
27
|
+
* lockKey: 'fetch-user-profile',
|
|
28
|
+
* debounceTime: 300,
|
|
29
|
+
* callback: async () => {
|
|
30
|
+
* await fetchUserProfile();
|
|
31
|
+
* }
|
|
32
|
+
* });
|
|
33
|
+
*/
|
|
34
|
+
export type DebouncedMutex = (params: {
|
|
35
|
+
callback: () => Promise<void>;
|
|
36
|
+
debounceTime?: number;
|
|
37
|
+
lockKey: string;
|
|
38
|
+
}) => Promise<void>;
|
|
39
|
+
//# sourceMappingURL=debouncedMutex.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debouncedMutex.types.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/utils/debouncedMutex/debouncedMutex.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE;IACpC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/client/src/utils/debouncedMutex/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC"}
|
package/waas.cjs.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var assertPackageVersion = require('@dynamic-labs-sdk/assert-package-version');
|
|
4
|
-
var logout = require('./logout.cjs.js');
|
|
5
|
-
var NotWaasWalletAccountError = require('./NotWaasWalletAccountError.cjs.js');
|
|
6
4
|
var constants = require('./constants.cjs.js');
|
|
7
|
-
var
|
|
5
|
+
var NotWaasWalletAccountError = require('./NotWaasWalletAccountError.cjs.js');
|
|
6
|
+
var getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount.cjs.js');
|
|
7
|
+
var constants$1 = require('./constants.cjs2.js');
|
|
8
8
|
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
9
|
+
var filterDuplicates = require('./filterDuplicates.cjs.js');
|
|
9
10
|
require('buffer');
|
|
10
|
-
require('zod/mini');
|
|
11
11
|
|
|
12
|
-
class NotWaasWalletProviderError extends
|
|
12
|
+
class NotWaasWalletProviderError extends constants.BaseError {
|
|
13
13
|
constructor({ walletProviderKey }){
|
|
14
14
|
super({
|
|
15
15
|
cause: null,
|
|
@@ -22,11 +22,11 @@ class NotWaasWalletProviderError extends logout.BaseError {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
const isWaasWalletProvider = (walletProvider)=>{
|
|
25
|
-
return walletProvider.key.includes(constants.DYNAMIC_WAAS_METADATA.
|
|
25
|
+
return walletProvider.key.includes(constants$1.DYNAMIC_WAAS_METADATA.normalizedWalletName);
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
|
|
29
|
-
const walletProvider =
|
|
29
|
+
const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({
|
|
30
30
|
walletAccount
|
|
31
31
|
}, client);
|
|
32
32
|
if (!isWaasWalletProvider(walletProvider)) {
|
|
@@ -47,7 +47,7 @@ const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
|
|
|
47
47
|
* @param [params.password] - Optional password to encrypt the backup.
|
|
48
48
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
49
49
|
* @returns A promise that resolves when the backup process is complete.
|
|
50
|
-
*/ const backupWaasKeySharesToGoogleDrive = async ({ password, walletAccount }, client =
|
|
50
|
+
*/ const backupWaasKeySharesToGoogleDrive = async ({ password, walletAccount }, client = constants.getDefaultClient())=>{
|
|
51
51
|
const provider = getWaasWalletProviderFromWalletAccount({
|
|
52
52
|
walletAccount
|
|
53
53
|
}, client);
|
|
@@ -57,11 +57,6 @@ const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
|
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
/**
|
|
61
|
-
* Filter duplicates from an array by equality.
|
|
62
|
-
* Uses a Set internally.
|
|
63
|
-
*/ const filterDuplicates = (array)=>Array.from(new Set(array));
|
|
64
|
-
|
|
65
60
|
/**
|
|
66
61
|
* Creates wallet accounts for the specified chains.
|
|
67
62
|
*
|
|
@@ -78,17 +73,29 @@ const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
|
|
|
78
73
|
* @param params.chains - The chains to create wallet accounts for.
|
|
79
74
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
80
75
|
* @returns A promise that resolves when all wallet accounts are created.
|
|
81
|
-
*/ const createWaasWalletAccounts = async ({ chains }, client =
|
|
82
|
-
|
|
76
|
+
*/ const createWaasWalletAccounts = async ({ chains }, client = constants.getDefaultClient())=>{
|
|
77
|
+
// we need this right now so we don't try to create wallet accounts for chains
|
|
78
|
+
// that we don't support Dynamid Waas yet in the JS SDK, like BTC
|
|
79
|
+
const supportedChains = [
|
|
80
|
+
'EVM',
|
|
81
|
+
'SOL',
|
|
82
|
+
'SUI'
|
|
83
|
+
];
|
|
84
|
+
const filteredSupportedChains = chains.filter((chain)=>supportedChains.includes(chain));
|
|
85
|
+
if (filteredSupportedChains.length === 0) {
|
|
83
86
|
return;
|
|
84
87
|
}
|
|
85
|
-
const walletProviderKeys =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
const walletProviderKeys = filteredSupportedChains.map((chain)=>getVerifiedCredentialForWalletAccount.formatWalletProviderKey({
|
|
89
|
+
chain,
|
|
90
|
+
displayName: constants$1.DYNAMIC_WAAS_METADATA.displayName,
|
|
91
|
+
walletProviderType: sdkApiCore.WalletProviderEnum.EmbeddedWallet
|
|
92
|
+
}));
|
|
93
|
+
const walletProviderEntries = filterDuplicates.filterDuplicates(walletProviderKeys).map((walletProviderKey)=>{
|
|
94
|
+
const walletProvider = getVerifiedCredentialForWalletAccount.getWalletProviderByKey({
|
|
88
95
|
walletProviderKey
|
|
89
96
|
}, client);
|
|
90
97
|
if (!walletProvider) {
|
|
91
|
-
throw new
|
|
98
|
+
throw new getVerifiedCredentialForWalletAccount.NoWalletProviderFoundError({
|
|
92
99
|
walletProviderKey
|
|
93
100
|
});
|
|
94
101
|
}
|
|
@@ -117,14 +124,15 @@ const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
|
|
|
117
124
|
* @param [params.password] - Optional password for key share operations.
|
|
118
125
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
119
126
|
* @returns A promise that resolves when the key delegation is complete.
|
|
120
|
-
*/ const delegateWaasKeyShares = async ({ password, walletAccount }, client =
|
|
127
|
+
*/ const delegateWaasKeyShares = async ({ password, walletAccount }, client = constants.getDefaultClient())=>{
|
|
121
128
|
const provider = getWaasWalletProviderFromWalletAccount({
|
|
122
129
|
walletAccount
|
|
123
130
|
}, client);
|
|
124
|
-
|
|
131
|
+
await provider.delegateKeyShares({
|
|
125
132
|
password,
|
|
126
133
|
walletAccount
|
|
127
134
|
});
|
|
135
|
+
await NotWaasWalletAccountError.refreshUser(client);
|
|
128
136
|
};
|
|
129
137
|
|
|
130
138
|
/**
|
|
@@ -137,7 +145,7 @@ const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
|
|
|
137
145
|
* @param [params.password] - Optional password to encrypt the exported shares.
|
|
138
146
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
139
147
|
* @returns A promise that resolves to the exported key shares.
|
|
140
|
-
*/ const exportWaasClientKeyshares = async ({ password, walletAccount }, client =
|
|
148
|
+
*/ const exportWaasClientKeyshares = async ({ password, walletAccount }, client = constants.getDefaultClient())=>{
|
|
141
149
|
const provider = getWaasWalletProviderFromWalletAccount({
|
|
142
150
|
walletAccount
|
|
143
151
|
}, client);
|
|
@@ -158,7 +166,7 @@ const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
|
|
|
158
166
|
* @param [params.password] - Optional password to decrypt the private key.
|
|
159
167
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
160
168
|
* @returns A promise that resolves when the private key export is complete.
|
|
161
|
-
*/ const exportWaasPrivateKey = async ({ displayContainer, password, walletAccount }, client =
|
|
169
|
+
*/ const exportWaasPrivateKey = async ({ displayContainer, password, walletAccount }, client = constants.getDefaultClient())=>{
|
|
162
170
|
const provider = getWaasWalletProviderFromWalletAccount({
|
|
163
171
|
walletAccount
|
|
164
172
|
}, client);
|
|
@@ -170,7 +178,7 @@ const getWaasWalletProviderFromWalletAccount = ({ walletAccount }, client)=>{
|
|
|
170
178
|
};
|
|
171
179
|
|
|
172
180
|
const userHasEmbeddedWalletForChain = ({ user, chain })=>{
|
|
173
|
-
const hasEmbeddedWalletForChain = user.verifiedCredentials.some((vc)=>vc.walletProvider === sdkApiCore.WalletProviderEnum.EmbeddedWallet && vc.chain &&
|
|
181
|
+
const hasEmbeddedWalletForChain = user.verifiedCredentials.some((vc)=>vc.walletProvider === sdkApiCore.WalletProviderEnum.EmbeddedWallet && vc.chain && constants.getChainFromVerifiedCredentialChain(vc.chain) === chain);
|
|
174
182
|
return hasEmbeddedWalletForChain;
|
|
175
183
|
};
|
|
176
184
|
|
|
@@ -182,9 +190,9 @@ const userHasEmbeddedWalletForChain = ({ user, chain })=>{
|
|
|
182
190
|
*
|
|
183
191
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
184
192
|
* @returns True if Dynamic WaaS is enabled, false otherwise.
|
|
185
|
-
*/ const isDynamicWaasEnabled = (client =
|
|
193
|
+
*/ const isDynamicWaasEnabled = (client = constants.getDefaultClient())=>{
|
|
186
194
|
const projectSettings = client.projectSettings;
|
|
187
|
-
|
|
195
|
+
constants.assertDefined(projectSettings, 'Project settings are not available');
|
|
188
196
|
const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;
|
|
189
197
|
const dynamicWaasIsEnabled = (embeddedWalletSettings == null ? void 0 : embeddedWalletSettings.defaultWalletVersion) === sdkApiCore.EmbeddedWalletVersionEnum.V3;
|
|
190
198
|
return dynamicWaasIsEnabled;
|
|
@@ -196,10 +204,10 @@ const userHasEmbeddedWalletForChain = ({ user, chain })=>{
|
|
|
196
204
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
197
205
|
* @returns An array of all chains that have waas wallet accounts enabled
|
|
198
206
|
* but for which the current user does not yet have an embedded wallet account.
|
|
199
|
-
*/ const getChainsMissingWaasWalletAccounts = (client =
|
|
207
|
+
*/ const getChainsMissingWaasWalletAccounts = (client = constants.getDefaultClient())=>{
|
|
200
208
|
var _embeddedWalletSettings_chainConfigurations;
|
|
201
209
|
const projectSettings = client.projectSettings;
|
|
202
|
-
|
|
210
|
+
constants.assertDefined(projectSettings, 'Project settings are not available');
|
|
203
211
|
const embeddedWalletSettings = projectSettings.sdk.embeddedWallets;
|
|
204
212
|
const isWaasEnabled = isDynamicWaasEnabled(client);
|
|
205
213
|
const user = client.user;
|
|
@@ -215,12 +223,32 @@ const userHasEmbeddedWalletForChain = ({ user, chain })=>{
|
|
|
215
223
|
}));
|
|
216
224
|
};
|
|
217
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Checks if a WaaS wallet account has delegated access.
|
|
228
|
+
*
|
|
229
|
+
* @param params.walletAccount - The WaaS wallet account to check for delegated access.
|
|
230
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
231
|
+
* @returns True if the wallet account has delegated access, false otherwise.
|
|
232
|
+
*/ const hasDelegatedAccess = ({ walletAccount }, client = constants.getDefaultClient())=>{
|
|
233
|
+
var _verifiedCredential_walletProperties_keyShares, _verifiedCredential_walletProperties;
|
|
234
|
+
const verifiedCredential = getVerifiedCredentialForWalletAccount.getVerifiedCredentialForWalletAccount({
|
|
235
|
+
walletAccount
|
|
236
|
+
}, client);
|
|
237
|
+
constants.assertDefined(verifiedCredential, 'Verified credential not found for Waas wallet account');
|
|
238
|
+
const hasDelegatedKeyShare = (_verifiedCredential_walletProperties = verifiedCredential.walletProperties) == null ? void 0 : (_verifiedCredential_walletProperties_keyShares = _verifiedCredential_walletProperties.keyShares) == null ? void 0 : _verifiedCredential_walletProperties_keyShares.some((keyShare)=>keyShare.backupLocation === 'delegated');
|
|
239
|
+
return !!hasDelegatedKeyShare;
|
|
240
|
+
};
|
|
241
|
+
|
|
218
242
|
const getWaasWalletProviderByChain = ({ chain }, client)=>{
|
|
219
|
-
const providers =
|
|
220
|
-
const waasProviderKey =
|
|
243
|
+
const providers = getVerifiedCredentialForWalletAccount.getWalletProviders(client);
|
|
244
|
+
const waasProviderKey = getVerifiedCredentialForWalletAccount.formatWalletProviderKey({
|
|
245
|
+
chain,
|
|
246
|
+
displayName: constants$1.DYNAMIC_WAAS_METADATA.displayName,
|
|
247
|
+
walletProviderType: sdkApiCore.WalletProviderEnum.EmbeddedWallet
|
|
248
|
+
});
|
|
221
249
|
const waasProvider = providers.find((provider)=>provider.key === waasProviderKey && provider.chain === chain);
|
|
222
250
|
if (!waasProvider || !isWaasWalletProvider(waasProvider)) {
|
|
223
|
-
throw new
|
|
251
|
+
throw new getVerifiedCredentialForWalletAccount.NoWalletProviderFoundError({
|
|
224
252
|
walletProviderKey: waasProviderKey
|
|
225
253
|
});
|
|
226
254
|
}
|
|
@@ -238,7 +266,7 @@ const getWaasWalletProviderByChain = ({ chain }, client)=>{
|
|
|
238
266
|
* @param [params.thresholdSignatureScheme] - Optional threshold signature scheme configuration. Default is TWO_OF_TWO.
|
|
239
267
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
240
268
|
* @returns A promise that resolves when the private key is successfully imported.
|
|
241
|
-
*/ const importWaasPrivateKey = async ({ chain, privateKey, thresholdSignatureScheme }, client =
|
|
269
|
+
*/ const importWaasPrivateKey = async ({ chain, privateKey, thresholdSignatureScheme }, client = constants.getDefaultClient())=>{
|
|
242
270
|
const provider = getWaasWalletProviderByChain({
|
|
243
271
|
chain
|
|
244
272
|
}, client);
|
|
@@ -255,7 +283,7 @@ const getWaasWalletProviderByChain = ({ chain }, client)=>{
|
|
|
255
283
|
* @param params.walletAccount - The wallet account to check.
|
|
256
284
|
* @returns True if the wallet account is a WaaS wallet account, false otherwise.
|
|
257
285
|
*/ const isWaasWalletAccount = ({ walletAccount })=>{
|
|
258
|
-
return walletAccount.walletProviderKey.includes(constants.DYNAMIC_WAAS_METADATA.
|
|
286
|
+
return walletAccount.walletProviderKey.includes(constants$1.DYNAMIC_WAAS_METADATA.normalizedWalletName);
|
|
259
287
|
};
|
|
260
288
|
|
|
261
289
|
/**
|
|
@@ -268,7 +296,7 @@ const getWaasWalletProviderByChain = ({ chain }, client)=>{
|
|
|
268
296
|
* @param [params.password] - Optional password for key share operations.
|
|
269
297
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
270
298
|
* @returns A promise that resolves when the key shares are refreshed.
|
|
271
|
-
*/ const refreshWaasWalletAccountShares = async ({ walletAccount, password }, client =
|
|
299
|
+
*/ const refreshWaasWalletAccountShares = async ({ walletAccount, password }, client = constants.getDefaultClient())=>{
|
|
272
300
|
const provider = getWaasWalletProviderFromWalletAccount({
|
|
273
301
|
walletAccount
|
|
274
302
|
}, client);
|
|
@@ -278,6 +306,24 @@ const getWaasWalletProviderByChain = ({ chain }, client)=>{
|
|
|
278
306
|
});
|
|
279
307
|
};
|
|
280
308
|
|
|
309
|
+
/**
|
|
310
|
+
* Revokes the delegation of a WaaS wallet account.
|
|
311
|
+
*
|
|
312
|
+
* @param params.walletAccount - The WaaS wallet account to revoke delegation for.
|
|
313
|
+
* @param [params.password] - Optional password for delegation operations.
|
|
314
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
315
|
+
* @returns A promise that resolves when the delegation is revoked.
|
|
316
|
+
*/ const revokeWaasDelegation = async ({ password, walletAccount }, client = constants.getDefaultClient())=>{
|
|
317
|
+
const provider = getWaasWalletProviderFromWalletAccount({
|
|
318
|
+
walletAccount
|
|
319
|
+
}, client);
|
|
320
|
+
await provider.revokeDelegation({
|
|
321
|
+
password,
|
|
322
|
+
walletAccount
|
|
323
|
+
});
|
|
324
|
+
await NotWaasWalletAccountError.refreshUser(client);
|
|
325
|
+
};
|
|
326
|
+
|
|
281
327
|
const userHasExternalWallet = (user)=>{
|
|
282
328
|
const hasExternalWallet = user == null ? void 0 : user.verifiedCredentials.some((vc)=>vc.format === sdkApiCore.JwtVerifiedCredentialFormatEnum.Blockchain && vc.walletProvider !== sdkApiCore.WalletProviderEnum.EmbeddedWallet);
|
|
283
329
|
return hasExternalWallet;
|
|
@@ -293,8 +339,8 @@ const userHasExternalWallet = (user)=>{
|
|
|
293
339
|
* @param params.chain - The blockchain network to check.
|
|
294
340
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
295
341
|
* @returns True if a wallet should be auto-created for the chain, false otherwise.
|
|
296
|
-
*/ const shouldAutoCreateWalletForChain = ({ chain }, client =
|
|
297
|
-
|
|
342
|
+
*/ const shouldAutoCreateWalletForChain = ({ chain }, client = constants.getDefaultClient())=>{
|
|
343
|
+
constants.assertDefined(client.projectSettings, 'Project settings are not available');
|
|
298
344
|
const embeddedWalletSettings = client.projectSettings.sdk.embeddedWallets;
|
|
299
345
|
const automaticEmbeddedWalletCreationEnabled = embeddedWalletSettings == null ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreation;
|
|
300
346
|
if (!automaticEmbeddedWalletCreationEnabled || !client.user) {
|
|
@@ -322,7 +368,7 @@ const userHasExternalWallet = (user)=>{
|
|
|
322
368
|
* @param params.newPassword - The new password to set for the wallet.
|
|
323
369
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
324
370
|
* @returns A promise that resolves when the password is successfully updated.
|
|
325
|
-
*/ const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount }, client =
|
|
371
|
+
*/ const updateWaasPassword = async ({ currentPassword, newPassword, walletAccount }, client = constants.getDefaultClient())=>{
|
|
326
372
|
const provider = getWaasWalletProviderFromWalletAccount({
|
|
327
373
|
walletAccount
|
|
328
374
|
}, client);
|
|
@@ -333,7 +379,7 @@ const userHasExternalWallet = (user)=>{
|
|
|
333
379
|
});
|
|
334
380
|
};
|
|
335
381
|
|
|
336
|
-
assertPackageVersion.assertPackageVersion(
|
|
382
|
+
assertPackageVersion.assertPackageVersion(constants.name, constants.version);
|
|
337
383
|
|
|
338
384
|
exports.NotWaasWalletProviderError = NotWaasWalletProviderError;
|
|
339
385
|
exports.backupWaasKeySharesToGoogleDrive = backupWaasKeySharesToGoogleDrive;
|
|
@@ -342,9 +388,11 @@ exports.delegateWaasKeyShares = delegateWaasKeyShares;
|
|
|
342
388
|
exports.exportWaasClientKeyshares = exportWaasClientKeyshares;
|
|
343
389
|
exports.exportWaasPrivateKey = exportWaasPrivateKey;
|
|
344
390
|
exports.getChainsMissingWaasWalletAccounts = getChainsMissingWaasWalletAccounts;
|
|
391
|
+
exports.hasDelegatedAccess = hasDelegatedAccess;
|
|
345
392
|
exports.importWaasPrivateKey = importWaasPrivateKey;
|
|
346
393
|
exports.isDynamicWaasEnabled = isDynamicWaasEnabled;
|
|
347
394
|
exports.isWaasWalletAccount = isWaasWalletAccount;
|
|
348
395
|
exports.refreshWaasWalletAccountShares = refreshWaasWalletAccountShares;
|
|
396
|
+
exports.revokeWaasDelegation = revokeWaasDelegation;
|
|
349
397
|
exports.shouldAutoCreateWalletForChain = shouldAutoCreateWalletForChain;
|
|
350
398
|
exports.updateWaasPassword = updateWaasPassword;
|