@dynamic-labs-sdk/client 0.16.2 → 0.17.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 (57) hide show
  1. package/dist/{InvalidParamError-BweYAZrY.cjs.js → InvalidParamError-BEdsjVbd.cjs.js} +8 -3
  2. package/dist/{InvalidParamError-BweYAZrY.cjs.js.map → InvalidParamError-BEdsjVbd.cjs.js.map} +1 -1
  3. package/dist/{InvalidParamError-DRf5Y5Aj.esm.js → InvalidParamError-BOaqPPZm.esm.js} +8 -3
  4. package/dist/{InvalidParamError-DRf5Y5Aj.esm.js.map → InvalidParamError-BOaqPPZm.esm.js.map} +1 -1
  5. package/dist/{NotWaasWalletAccountError-Cf966VSY.cjs.js → NotWaasWalletAccountError-BKKGLJ42.cjs.js} +3 -3
  6. package/dist/{NotWaasWalletAccountError-Cf966VSY.cjs.js.map → NotWaasWalletAccountError-BKKGLJ42.cjs.js.map} +1 -1
  7. package/dist/{NotWaasWalletAccountError-D_AuJFHM.esm.js → NotWaasWalletAccountError-ufVXCrE-.esm.js} +3 -3
  8. package/dist/{NotWaasWalletAccountError-D_AuJFHM.esm.js.map → NotWaasWalletAccountError-ufVXCrE-.esm.js.map} +1 -1
  9. package/dist/core.cjs.js +5 -5
  10. package/dist/core.esm.js +5 -5
  11. package/dist/errors/InvalidRealtimePublishError.d.ts +9 -0
  12. package/dist/errors/InvalidRealtimePublishError.d.ts.map +1 -0
  13. package/dist/errors/RealtimeNotConnectedError.d.ts +5 -0
  14. package/dist/errors/RealtimeNotConnectedError.d.ts.map +1 -0
  15. package/dist/exports/index.d.ts +3 -2
  16. package/dist/exports/index.d.ts.map +1 -1
  17. package/dist/{getNetworkProviderFromNetworkId-PYVbXW2g.esm.js → getNetworkProviderFromNetworkId-DVN5JSY7.esm.js} +3 -3
  18. package/dist/{getNetworkProviderFromNetworkId-PYVbXW2g.esm.js.map → getNetworkProviderFromNetworkId-DVN5JSY7.esm.js.map} +1 -1
  19. package/dist/{getNetworkProviderFromNetworkId-D1oubSr_.cjs.js → getNetworkProviderFromNetworkId-DrcEb1cG.cjs.js} +3 -3
  20. package/dist/{getNetworkProviderFromNetworkId-D1oubSr_.cjs.js.map → getNetworkProviderFromNetworkId-DrcEb1cG.cjs.js.map} +1 -1
  21. package/dist/{getSignedSessionId-CA2ARcr3.esm.js → getSignedSessionId-7rWCtIKo.esm.js} +3 -3
  22. package/dist/{getSignedSessionId-CA2ARcr3.esm.js.map → getSignedSessionId-7rWCtIKo.esm.js.map} +1 -1
  23. package/dist/{getSignedSessionId-DrTDCzhj.cjs.js → getSignedSessionId-Be6w7Iq4.cjs.js} +3 -3
  24. package/dist/{getSignedSessionId-DrTDCzhj.cjs.js.map → getSignedSessionId-Be6w7Iq4.cjs.js.map} +1 -1
  25. package/dist/{getVerifiedCredentialForWalletAccount-CnEQvQrG.cjs.js → getVerifiedCredentialForWalletAccount-COqb-7N_.cjs.js} +2 -2
  26. package/dist/{getVerifiedCredentialForWalletAccount-CnEQvQrG.cjs.js.map → getVerifiedCredentialForWalletAccount-COqb-7N_.cjs.js.map} +1 -1
  27. package/dist/{getVerifiedCredentialForWalletAccount-Cc7DjHds.esm.js → getVerifiedCredentialForWalletAccount-CwP354ZX.esm.js} +2 -2
  28. package/dist/{getVerifiedCredentialForWalletAccount-Cc7DjHds.esm.js.map → getVerifiedCredentialForWalletAccount-CwP354ZX.esm.js.map} +1 -1
  29. package/dist/index.cjs.js +42 -13
  30. package/dist/index.cjs.js.map +1 -1
  31. package/dist/index.esm.js +42 -14
  32. package/dist/index.esm.js.map +1 -1
  33. package/dist/{isMfaRequiredForAction-Buji2Pg6.esm.js → isMfaRequiredForAction-C0ZXRkHC.esm.js} +2 -2
  34. package/dist/{isMfaRequiredForAction-Buji2Pg6.esm.js.map → isMfaRequiredForAction-C0ZXRkHC.esm.js.map} +1 -1
  35. package/dist/{isMfaRequiredForAction-LvTNM74t.cjs.js → isMfaRequiredForAction-DNP71xZ7.cjs.js} +2 -2
  36. package/dist/{isMfaRequiredForAction-LvTNM74t.cjs.js.map → isMfaRequiredForAction-DNP71xZ7.cjs.js.map} +1 -1
  37. package/dist/modules/balances/getBalances/getBalances.d.ts +35 -0
  38. package/dist/modules/balances/getBalances/getBalances.d.ts.map +1 -0
  39. package/dist/modules/balances/getBalances/index.d.ts +3 -0
  40. package/dist/modules/balances/getBalances/index.d.ts.map +1 -0
  41. package/dist/modules/deviceRegistration/isDeviceRegistrationRequired/isDeviceRegistrationRequired.d.ts +5 -3
  42. package/dist/modules/deviceRegistration/isDeviceRegistrationRequired/isDeviceRegistrationRequired.d.ts.map +1 -1
  43. package/dist/modules/wallets/constants.d.ts.map +1 -1
  44. package/dist/services/realtime/createRealtimeChannelSchema/createRealtimeChannelSchema.d.ts +13 -0
  45. package/dist/services/realtime/createRealtimeChannelSchema/createRealtimeChannelSchema.d.ts.map +1 -0
  46. package/dist/services/realtime/createRealtimeChannelSchema/index.d.ts +2 -0
  47. package/dist/services/realtime/createRealtimeChannelSchema/index.d.ts.map +1 -0
  48. package/dist/services/realtime/index.d.ts +2 -0
  49. package/dist/services/realtime/index.d.ts.map +1 -0
  50. package/dist/services/realtime/realtime.types.d.ts +63 -0
  51. package/dist/services/realtime/realtime.types.d.ts.map +1 -0
  52. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  53. package/dist/waas.cjs.js +3 -3
  54. package/dist/waas.esm.js +3 -3
  55. package/dist/waasCore.cjs.js +3 -3
  56. package/dist/waasCore.esm.js +3 -3
  57. package/package.json +3 -3
package/dist/index.cjs.js CHANGED
@@ -1,8 +1,8 @@
1
- const require_InvalidParamError = require('./InvalidParamError-BweYAZrY.cjs.js');
2
- const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-D1oubSr_.cjs.js');
3
- const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-CnEQvQrG.cjs.js');
4
- const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-Cf966VSY.cjs.js');
5
- const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-LvTNM74t.cjs.js');
1
+ const require_InvalidParamError = require('./InvalidParamError-BEdsjVbd.cjs.js');
2
+ const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-DrcEb1cG.cjs.js');
3
+ const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-COqb-7N_.cjs.js');
4
+ const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-BKKGLJ42.cjs.js');
5
+ const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-DNP71xZ7.cjs.js');
6
6
  let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
7
7
  let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
8
8
  let zod_mini = require("zod/mini");
@@ -1751,6 +1751,37 @@ const unlinkSocialAccount = async ({ verifiedCredentialId }, client = require_In
1751
1751
  return response;
1752
1752
  };
1753
1753
 
1754
+ //#endregion
1755
+ //#region src/modules/balances/getBalances/getBalances.ts
1756
+ /**
1757
+ * Retrieves the token balances for a wallet account.
1758
+ *
1759
+ * This function fetches the balances of the tokens for the specified wallet account.
1760
+ *
1761
+ * @param params.walletAccount - The wallet account to get the balances for.
1762
+ * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
1763
+ * @returns A promise that resolves to an array of token balances.
1764
+ */
1765
+ const getBalances = async ({ walletAccount, networkId, includePrices, includeNative, filterSpamTokens, whitelistedContracts, forceRefresh }, client = require_InvalidParamError.getDefaultClient()) => {
1766
+ const core = require_InvalidParamError.getCore(client);
1767
+ const apiClient = require_InvalidParamError.createApiClient({}, client);
1768
+ if (!networkId) {
1769
+ const activeNetworkId = await require_getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({ walletAccount }, client).getActiveNetworkId();
1770
+ networkId = Number(activeNetworkId.networkId);
1771
+ }
1772
+ return await apiClient.getAccountBalances({
1773
+ accountAddress: walletAccount.address,
1774
+ chainName: walletAccount.chain,
1775
+ environmentId: core.environmentId,
1776
+ filterSpamTokens,
1777
+ forceRefresh,
1778
+ includeNative,
1779
+ includePrices,
1780
+ networkId,
1781
+ whitelistedContracts
1782
+ });
1783
+ };
1784
+
1754
1785
  //#endregion
1755
1786
  //#region src/modules/balances/getMultichainBalances/getMultichainBalances.ts
1756
1787
  /**
@@ -1878,7 +1909,7 @@ const createCheckoutTransaction = async (params, client = require_InvalidParamEr
1878
1909
  const core = require_InvalidParamError.getCore(client);
1879
1910
  const apiClient = require_InvalidParamError.createApiClient({}, client);
1880
1911
  const checkouts = await getCheckouts(client);
1881
- const checkoutId = params.checkoutId ?? checkouts?.[0]?.id;
1912
+ const checkoutId = params.checkoutId || checkouts?.[0]?.id;
1882
1913
  require_InvalidParamError.assertDefined(checkoutId, "No checkout found. Please make sure you have a Checkout setup in the Dashboard.");
1883
1914
  const result = await apiClient.createCheckoutTransaction({
1884
1915
  checkoutId,
@@ -2088,18 +2119,15 @@ const getRegisteredDevices = async (client = require_InvalidParamError.getDefaul
2088
2119
  //#endregion
2089
2120
  //#region src/modules/deviceRegistration/isDeviceRegistrationRequired/isDeviceRegistrationRequired.ts
2090
2121
  /**
2091
- * Checks if device registration is required for the current user.
2122
+ * Checks if device registration is required for the given user.
2092
2123
  *
2093
- * This function determines if the current user has the deviceRegistration
2124
+ * This function determines if the user has the deviceRegistration
2094
2125
  * scope, indicating that device registration is required.
2095
2126
  *
2127
+ * @param user - The user to check.
2096
2128
  * @returns True if device registration is required, false otherwise.
2097
2129
  */
2098
- const isDeviceRegistrationRequired = (client = require_InvalidParamError.getDefaultClient()) => {
2099
- const user = client.user;
2100
- require_InvalidParamError.assertDefined(user, "User not logged in");
2101
- return Boolean(user.scope?.includes("device:register"));
2102
- };
2130
+ const isDeviceRegistrationRequired = (user) => Boolean(user.scope?.includes("device:register"));
2103
2131
 
2104
2132
  //#endregion
2105
2133
  //#region src/modules/deviceRegistration/revokeAllRegisteredDevices/revokeAllRegisteredDevices.ts
@@ -5166,6 +5194,7 @@ exports.getActiveNetworkId = getActiveNetworkId;
5166
5194
  exports.getAvailableWalletProvidersData = getAvailableWalletProvidersData;
5167
5195
  exports.getBalance = getBalance;
5168
5196
  exports.getBalanceForAddress = getBalanceForAddress;
5197
+ exports.getBalances = getBalances;
5169
5198
  exports.getCheckoutTransaction = getCheckoutTransaction;
5170
5199
  exports.getCheckoutTransactionQuote = getCheckoutTransactionQuote;
5171
5200
  exports.getCoinbaseBuyUrl = getCoinbaseBuyUrl;