@zubari/sdk 0.5.8 → 0.5.9

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.
@@ -1,5 +1,5 @@
1
- export { Z as ZubariWallet } from '../contracts-ITj7CkiV.mjs';
2
- export { C as ChainBalance, M as MultiChainAddresses, S as SUPPORTED_CHAINS, b as WalletManager, W as WalletManagerConfig, a as WalletState } from '../WalletManager-i2BBu6uz.mjs';
1
+ export { Z as ZubariWallet } from '../contracts-BWEndqf6.mjs';
2
+ export { C as ChainBalance, M as MultiChainAddresses, S as SUPPORTED_CHAINS, b as WalletManager, W as WalletManagerConfig, a as WalletState } from '../WalletManager-DOjsIbb1.mjs';
3
3
  import '../index-c90msmwW.mjs';
4
4
  import 'node_modules/viem/_types/actions/siwe/verifySiweMessage';
5
5
  import 'node_modules/viem/_types/utils/ccip';
@@ -1,5 +1,5 @@
1
- export { Z as ZubariWallet } from '../contracts-BHI5gorb.js';
2
- export { C as ChainBalance, M as MultiChainAddresses, S as SUPPORTED_CHAINS, b as WalletManager, W as WalletManagerConfig, a as WalletState } from '../WalletManager-Csfokchy.js';
1
+ export { Z as ZubariWallet } from '../contracts-DtN5ys2L.js';
2
+ export { C as ChainBalance, M as MultiChainAddresses, S as SUPPORTED_CHAINS, b as WalletManager, W as WalletManagerConfig, a as WalletState } from '../WalletManager-n5KdhSRd.js';
3
3
  import '../index-c90msmwW.js';
4
4
  import 'node_modules/viem/_types/actions/siwe/verifySiweMessage';
5
5
  import 'node_modules/viem/_types/utils/ccip';
@@ -2011,7 +2011,8 @@ var WalletManager = class _WalletManager {
2011
2011
  apiUrl: config.apiUrl || process.env.NEXT_PUBLIC_API_URL || "https://ckgwifsxka.us-east-2.awsapprunner.com",
2012
2012
  accessToken: config.accessToken,
2013
2013
  chainRpcUrls: config.chainRpcUrls || {},
2014
- tronApiKey: config.tronApiKey
2014
+ tronApiKey: config.tronApiKey,
2015
+ tonApiKey: config.tonApiKey
2015
2016
  };
2016
2017
  this.storage = this.config.storage;
2017
2018
  this.wdkService = getZubariWdkService({
@@ -2626,6 +2627,30 @@ var WalletManager = class _WalletManager {
2626
2627
  console.warn("Failed to fetch Solana USDT balance:", error);
2627
2628
  }
2628
2629
  }
2630
+ if (balance === "0" && this.config.apiUrl && this.config.accessToken) {
2631
+ try {
2632
+ const fallbackResponse = await fetch(`${this.config.apiUrl}/api/wallets/wdk/balance`, {
2633
+ method: "POST",
2634
+ headers: {
2635
+ "Content-Type": "application/json",
2636
+ "Authorization": `Bearer ${this.config.accessToken}`
2637
+ },
2638
+ body: JSON.stringify({
2639
+ chain: "solana",
2640
+ address,
2641
+ network: this.config.network
2642
+ })
2643
+ });
2644
+ if (fallbackResponse.ok) {
2645
+ const fallbackData = await fallbackResponse.json();
2646
+ if (fallbackData.success && fallbackData.balance && fallbackData.balance !== "0") {
2647
+ balance = fallbackData.balance;
2648
+ }
2649
+ }
2650
+ } catch (fallbackError) {
2651
+ console.warn("Solana backend fallback failed:", fallbackError);
2652
+ }
2653
+ }
2629
2654
  } else if (chain === "tron") {
2630
2655
  const tronConfig = getNetworkConfig("tron", this.config.network !== "mainnet");
2631
2656
  const baseUrl = tronConfig.rpcUrl;
@@ -2665,8 +2690,12 @@ var WalletManager = class _WalletManager {
2665
2690
  const isTestnet = this.config.network !== "mainnet";
2666
2691
  const baseUrl = isTestnet ? "https://testnet.toncenter.com/api/v2" : "https://toncenter.com/api/v2";
2667
2692
  try {
2693
+ const tonHeaders = { "Accept": "application/json" };
2694
+ if (this.config.tonApiKey) {
2695
+ tonHeaders["X-API-Key"] = this.config.tonApiKey;
2696
+ }
2668
2697
  const response = await fetch(`${baseUrl}/getAddressBalance?address=${address}`, {
2669
- headers: { "Accept": "application/json" }
2698
+ headers: tonHeaders
2670
2699
  });
2671
2700
  if (response.ok) {
2672
2701
  const data = await response.json();
@@ -2716,9 +2745,13 @@ var WalletManager = class _WalletManager {
2716
2745
  }
2717
2746
  } else if (chain === "spark") {
2718
2747
  try {
2748
+ const sparkHeaders = { "Content-Type": "application/json" };
2749
+ if (this.config.accessToken) {
2750
+ sparkHeaders["Authorization"] = `Bearer ${this.config.accessToken}`;
2751
+ }
2719
2752
  const response = await fetch(`${this.config.apiUrl}/api/wallets/wdk/balance`, {
2720
2753
  method: "POST",
2721
- headers: { "Content-Type": "application/json" },
2754
+ headers: sparkHeaders,
2722
2755
  body: JSON.stringify({
2723
2756
  chain: "spark",
2724
2757
  address,