@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.
@@ -92,6 +92,8 @@ interface WalletManagerConfig {
92
92
  chainRpcUrls?: Partial<Record<NetworkType, string>>;
93
93
  /** TronGrid API key to avoid rate limiting */
94
94
  tronApiKey?: string;
95
+ /** TON Center API key to avoid 429 rate limiting */
96
+ tonApiKey?: string;
95
97
  }
96
98
  /**
97
99
  * WalletManager - Handles BIP-39 seed generation, address derivation, and secure storage
@@ -92,6 +92,8 @@ interface WalletManagerConfig {
92
92
  chainRpcUrls?: Partial<Record<NetworkType, string>>;
93
93
  /** TronGrid API key to avoid rate limiting */
94
94
  tronApiKey?: string;
95
+ /** TON Center API key to avoid 429 rate limiting */
96
+ tonApiKey?: string;
95
97
  }
96
98
  /**
97
99
  * WalletManager - Handles BIP-39 seed generation, address derivation, and secure storage
@@ -1,5 +1,5 @@
1
1
  import { Z as ZubariWalletConfig, b as NetworkType, A as Account, c as NetworkBalance, e as SendParams, T as TxResult } from './index-c90msmwW.mjs';
2
- import './WalletManager-i2BBu6uz.mjs';
2
+ import './WalletManager-DOjsIbb1.mjs';
3
3
 
4
4
  /**
5
5
  * ZubariWallet - Multi-chain self-custodial wallet
@@ -1,5 +1,5 @@
1
1
  import { Z as ZubariWalletConfig, b as NetworkType, A as Account, c as NetworkBalance, e as SendParams, T as TxResult } from './index-c90msmwW.js';
2
- import './WalletManager-Csfokchy.js';
2
+ import './WalletManager-n5KdhSRd.js';
3
3
 
4
4
  /**
5
5
  * ZubariWallet - Multi-chain self-custodial wallet
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as CURRENCY_ADDRESSES, l as ContractAddresses, D as DEFAULT_CONTRACTS, F as FeeWalletConfig, M as MAINNET_FEE_WALLETS, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, S as SupportedFeeChain, T as TESTNET_FEE_WALLETS, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, k as getAllFeeWallets, g as getContractAddresses, d as getCurrentContractAddresses, i as getCurrentCurrencyAddresses, h as getCurrentFeeWallet, f as getCurrentFeeWallets, e as getDefaultSubscriptionAddress, j as getFeeWallet } from './contracts-ITj7CkiV.mjs';
2
- export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, b as WalletManager, W as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-i2BBu6uz.mjs';
1
+ export { C as CURRENCY_ADDRESSES, l as ContractAddresses, D as DEFAULT_CONTRACTS, F as FeeWalletConfig, M as MAINNET_FEE_WALLETS, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, S as SupportedFeeChain, T as TESTNET_FEE_WALLETS, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, k as getAllFeeWallets, g as getContractAddresses, d as getCurrentContractAddresses, i as getCurrentCurrencyAddresses, h as getCurrentFeeWallet, f as getCurrentFeeWallets, e as getDefaultSubscriptionAddress, j as getFeeWallet } from './contracts-BWEndqf6.mjs';
2
+ export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, b as WalletManager, W as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-DOjsIbb1.mjs';
3
3
  export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.mjs';
4
4
  export { a as ZubariMarketProtocol, Z as ZubariNFTProtocol, d as ZubariPayoutsProtocol, c as ZubariSubscriptionProtocol, b as ZubariTipsProtocol } from './PayoutsProtocol-DKEQhwYH.mjs';
5
5
  export { A as Account, B as BuyParams, h as CreateVoucherParams, E as EarningsBreakdown, L as LazyMintVoucher, k as Listing, j as ListingParams, i as NFT, f as NFTAttribute, N as NFTCurrency, g as NFTMetadata, c as NetworkBalance, b as NetworkType, R as RevenueSplit, e as SendParams, a as Subscription, S as SubscriptionPlan, q as SwapParams, p as SwapQuote, o as Tip, l as TipData, m as TipResult, n as TipStats, d as TokenBalance, T as TxResult, W as WatermarkingData, s as ZubariError, r as ZubariErrorCode, Z as ZubariWalletConfig } from './index-c90msmwW.mjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as CURRENCY_ADDRESSES, l as ContractAddresses, D as DEFAULT_CONTRACTS, F as FeeWalletConfig, M as MAINNET_FEE_WALLETS, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, S as SupportedFeeChain, T as TESTNET_FEE_WALLETS, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, k as getAllFeeWallets, g as getContractAddresses, d as getCurrentContractAddresses, i as getCurrentCurrencyAddresses, h as getCurrentFeeWallet, f as getCurrentFeeWallets, e as getDefaultSubscriptionAddress, j as getFeeWallet } from './contracts-BHI5gorb.js';
2
- export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, b as WalletManager, W as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-Csfokchy.js';
1
+ export { C as CURRENCY_ADDRESSES, l as ContractAddresses, D as DEFAULT_CONTRACTS, F as FeeWalletConfig, M as MAINNET_FEE_WALLETS, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, S as SupportedFeeChain, T as TESTNET_FEE_WALLETS, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, k as getAllFeeWallets, g as getContractAddresses, d as getCurrentContractAddresses, i as getCurrentCurrencyAddresses, h as getCurrentFeeWallet, f as getCurrentFeeWallets, e as getDefaultSubscriptionAddress, j as getFeeWallet } from './contracts-DtN5ys2L.js';
2
+ export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, b as WalletManager, W as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-n5KdhSRd.js';
3
3
  export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.js';
4
4
  export { a as ZubariMarketProtocol, Z as ZubariNFTProtocol, d as ZubariPayoutsProtocol, c as ZubariSubscriptionProtocol, b as ZubariTipsProtocol } from './PayoutsProtocol-DAa-9A5C.js';
5
5
  export { A as Account, B as BuyParams, h as CreateVoucherParams, E as EarningsBreakdown, L as LazyMintVoucher, k as Listing, j as ListingParams, i as NFT, f as NFTAttribute, N as NFTCurrency, g as NFTMetadata, c as NetworkBalance, b as NetworkType, R as RevenueSplit, e as SendParams, a as Subscription, S as SubscriptionPlan, q as SwapParams, p as SwapQuote, o as Tip, l as TipData, m as TipResult, n as TipStats, d as TokenBalance, T as TxResult, W as WatermarkingData, s as ZubariError, r as ZubariErrorCode, Z as ZubariWalletConfig } from './index-c90msmwW.js';
package/dist/index.js CHANGED
@@ -2224,7 +2224,8 @@ var WalletManager = class _WalletManager {
2224
2224
  apiUrl: config.apiUrl || process.env.NEXT_PUBLIC_API_URL || "https://ckgwifsxka.us-east-2.awsapprunner.com",
2225
2225
  accessToken: config.accessToken,
2226
2226
  chainRpcUrls: config.chainRpcUrls || {},
2227
- tronApiKey: config.tronApiKey
2227
+ tronApiKey: config.tronApiKey,
2228
+ tonApiKey: config.tonApiKey
2228
2229
  };
2229
2230
  this.storage = this.config.storage;
2230
2231
  this.wdkService = getZubariWdkService({
@@ -2839,6 +2840,30 @@ var WalletManager = class _WalletManager {
2839
2840
  console.warn("Failed to fetch Solana USDT balance:", error);
2840
2841
  }
2841
2842
  }
2843
+ if (balance === "0" && this.config.apiUrl && this.config.accessToken) {
2844
+ try {
2845
+ const fallbackResponse = await fetch(`${this.config.apiUrl}/api/wallets/wdk/balance`, {
2846
+ method: "POST",
2847
+ headers: {
2848
+ "Content-Type": "application/json",
2849
+ "Authorization": `Bearer ${this.config.accessToken}`
2850
+ },
2851
+ body: JSON.stringify({
2852
+ chain: "solana",
2853
+ address,
2854
+ network: this.config.network
2855
+ })
2856
+ });
2857
+ if (fallbackResponse.ok) {
2858
+ const fallbackData = await fallbackResponse.json();
2859
+ if (fallbackData.success && fallbackData.balance && fallbackData.balance !== "0") {
2860
+ balance = fallbackData.balance;
2861
+ }
2862
+ }
2863
+ } catch (fallbackError) {
2864
+ console.warn("Solana backend fallback failed:", fallbackError);
2865
+ }
2866
+ }
2842
2867
  } else if (chain === "tron") {
2843
2868
  const tronConfig = getNetworkConfig("tron", this.config.network !== "mainnet");
2844
2869
  const baseUrl = tronConfig.rpcUrl;
@@ -2878,8 +2903,12 @@ var WalletManager = class _WalletManager {
2878
2903
  const isTestnet2 = this.config.network !== "mainnet";
2879
2904
  const baseUrl = isTestnet2 ? "https://testnet.toncenter.com/api/v2" : "https://toncenter.com/api/v2";
2880
2905
  try {
2906
+ const tonHeaders = { "Accept": "application/json" };
2907
+ if (this.config.tonApiKey) {
2908
+ tonHeaders["X-API-Key"] = this.config.tonApiKey;
2909
+ }
2881
2910
  const response = await fetch(`${baseUrl}/getAddressBalance?address=${address}`, {
2882
- headers: { "Accept": "application/json" }
2911
+ headers: tonHeaders
2883
2912
  });
2884
2913
  if (response.ok) {
2885
2914
  const data = await response.json();
@@ -2929,9 +2958,13 @@ var WalletManager = class _WalletManager {
2929
2958
  }
2930
2959
  } else if (chain === "spark") {
2931
2960
  try {
2961
+ const sparkHeaders = { "Content-Type": "application/json" };
2962
+ if (this.config.accessToken) {
2963
+ sparkHeaders["Authorization"] = `Bearer ${this.config.accessToken}`;
2964
+ }
2932
2965
  const response = await fetch(`${this.config.apiUrl}/api/wallets/wdk/balance`, {
2933
2966
  method: "POST",
2934
- headers: { "Content-Type": "application/json" },
2967
+ headers: sparkHeaders,
2935
2968
  body: JSON.stringify({
2936
2969
  chain: "spark",
2937
2970
  address,