@zubari/sdk 0.5.8 → 0.5.10

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
@@ -841,7 +841,9 @@ function parseChainError(chain, errorMessage) {
841
841
  function isBrowser() {
842
842
  return typeof window !== "undefined" && typeof window.document !== "undefined";
843
843
  }
844
- var dynamicImport = new Function("specifier", "return import(specifier)");
844
+ async function dynamicImport(specifier) {
845
+ return import(specifier);
846
+ }
845
847
  async function canUseNativeWdk() {
846
848
  if (isBrowser()) {
847
849
  return false;
@@ -2224,7 +2226,8 @@ var WalletManager = class _WalletManager {
2224
2226
  apiUrl: config.apiUrl || process.env.NEXT_PUBLIC_API_URL || "https://ckgwifsxka.us-east-2.awsapprunner.com",
2225
2227
  accessToken: config.accessToken,
2226
2228
  chainRpcUrls: config.chainRpcUrls || {},
2227
- tronApiKey: config.tronApiKey
2229
+ tronApiKey: config.tronApiKey,
2230
+ tonApiKey: config.tonApiKey
2228
2231
  };
2229
2232
  this.storage = this.config.storage;
2230
2233
  this.wdkService = getZubariWdkService({
@@ -2839,6 +2842,30 @@ var WalletManager = class _WalletManager {
2839
2842
  console.warn("Failed to fetch Solana USDT balance:", error);
2840
2843
  }
2841
2844
  }
2845
+ if (balance === "0" && this.config.apiUrl && this.config.accessToken) {
2846
+ try {
2847
+ const fallbackResponse = await fetch(`${this.config.apiUrl}/api/wallets/wdk/balance`, {
2848
+ method: "POST",
2849
+ headers: {
2850
+ "Content-Type": "application/json",
2851
+ "Authorization": `Bearer ${this.config.accessToken}`
2852
+ },
2853
+ body: JSON.stringify({
2854
+ chain: "solana",
2855
+ address,
2856
+ network: this.config.network
2857
+ })
2858
+ });
2859
+ if (fallbackResponse.ok) {
2860
+ const fallbackData = await fallbackResponse.json();
2861
+ if (fallbackData.success && fallbackData.balance && fallbackData.balance !== "0") {
2862
+ balance = fallbackData.balance;
2863
+ }
2864
+ }
2865
+ } catch (fallbackError) {
2866
+ console.warn("Solana backend fallback failed:", fallbackError);
2867
+ }
2868
+ }
2842
2869
  } else if (chain === "tron") {
2843
2870
  const tronConfig = getNetworkConfig("tron", this.config.network !== "mainnet");
2844
2871
  const baseUrl = tronConfig.rpcUrl;
@@ -2878,8 +2905,12 @@ var WalletManager = class _WalletManager {
2878
2905
  const isTestnet2 = this.config.network !== "mainnet";
2879
2906
  const baseUrl = isTestnet2 ? "https://testnet.toncenter.com/api/v2" : "https://toncenter.com/api/v2";
2880
2907
  try {
2908
+ const tonHeaders = { "Accept": "application/json" };
2909
+ if (this.config.tonApiKey) {
2910
+ tonHeaders["X-API-Key"] = this.config.tonApiKey;
2911
+ }
2881
2912
  const response = await fetch(`${baseUrl}/getAddressBalance?address=${address}`, {
2882
- headers: { "Accept": "application/json" }
2913
+ headers: tonHeaders
2883
2914
  });
2884
2915
  if (response.ok) {
2885
2916
  const data = await response.json();
@@ -2929,9 +2960,13 @@ var WalletManager = class _WalletManager {
2929
2960
  }
2930
2961
  } else if (chain === "spark") {
2931
2962
  try {
2963
+ const sparkHeaders = { "Content-Type": "application/json" };
2964
+ if (this.config.accessToken) {
2965
+ sparkHeaders["Authorization"] = `Bearer ${this.config.accessToken}`;
2966
+ }
2932
2967
  const response = await fetch(`${this.config.apiUrl}/api/wallets/wdk/balance`, {
2933
2968
  method: "POST",
2934
- headers: { "Content-Type": "application/json" },
2969
+ headers: sparkHeaders,
2935
2970
  body: JSON.stringify({
2936
2971
  chain: "spark",
2937
2972
  address,
@@ -7594,7 +7629,9 @@ async function getPriceForChain2(chain) {
7594
7629
  const prices = await fetchPrices2();
7595
7630
  return prices[chain] || 0;
7596
7631
  }
7597
- var dynamicImport2 = new Function("specifier", "return import(specifier)");
7632
+ async function dynamicImport2(specifier) {
7633
+ return import(specifier);
7634
+ }
7598
7635
  async function loadWdkModules() {
7599
7636
  if (wdkLoaded) return;
7600
7637
  if (wdkLoadError) throw wdkLoadError;