@zubari/sdk 0.1.11 → 0.1.13

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.
@@ -5949,27 +5949,20 @@ declare class WalletManager {
5949
5949
  * Uses the unified WDK service which:
5950
5950
  * - In browser: Calls the backend API (which has Tether WDK)
5951
5951
  * - In Node.js: Uses native WDK
5952
- * - Falls back to browser-compatible derivation if needed
5953
- */
5954
- static deriveAddressForChainAsync(seed: string, chain: NetworkType, network?: 'mainnet' | 'testnet', apiUrl?: string): Promise<string>;
5955
- /**
5956
- * Format address for non-WDK chains (fallback)
5957
5952
  *
5958
- * Note: This fallback produces PLACEHOLDER addresses derived from the seed.
5959
- * For real blockchain interaction, use the WDK API via deriveAddressForChainAsync().
5960
- * These addresses should NOT be used for receiving funds without verification.
5953
+ * No fallback to placeholder addresses - WDK API is required for real addresses.
5961
5954
  */
5962
- private static formatAddressForChain;
5955
+ static deriveAddressForChainAsync(seed: string, chain: NetworkType, network?: 'mainnet' | 'testnet', apiUrl?: string): Promise<string>;
5963
5956
  /**
5964
- * Derive address for a specific chain (sync version for backwards compatibility)
5965
- * Uses ethers for basic derivation, use deriveAddressForChainAsync for WDK
5957
+ * Derive address for a specific chain (sync version)
5958
+ * Only supports Ethereum - for other chains use deriveAddressForChainAsync with WDK API
5966
5959
  *
5967
- * Note: For non-Ethereum chains, this produces placeholder addresses that are
5968
- * deterministic but not cryptographically valid. Use WDK API for real addresses.
5960
+ * @throws Error for non-Ethereum chains - use WDK API instead
5969
5961
  */
5970
5962
  static deriveAddressForChain(seed: string, chain: NetworkType): string;
5971
5963
  /**
5972
5964
  * Derive addresses for all enabled chains (sync version)
5965
+ * Only derives Ethereum address synchronously - use deriveAllAddressesAsync for all chains
5973
5966
  */
5974
5967
  deriveAllAddresses(): Partial<MultiChainAddresses>;
5975
5968
  /**
@@ -5990,15 +5983,16 @@ declare class WalletManager {
5990
5983
  private loadAddressesFromStorage;
5991
5984
  /**
5992
5985
  * Derive addresses for all enabled chains using Tether WDK
5993
- * The unified WDK service handles all fallback strategies automatically:
5994
- * - Browser: API backend -> Browser derivation
5995
- * - Node.js: Native WDK -> API backend -> Browser derivation
5996
5986
  *
5997
- * First tries to load from storage to avoid losing real WDK-derived addresses.
5987
+ * Uses the WDK API backend for real cryptographically valid addresses.
5988
+ * First tries to load from storage to avoid losing previously derived addresses.
5989
+ *
5990
+ * @throws Error if WDK API is unavailable and no cached addresses exist
5998
5991
  */
5999
5992
  deriveAllAddressesAsync(): Promise<Partial<MultiChainAddresses>>;
6000
5993
  /**
6001
5994
  * Get address for a specific chain
5995
+ * Returns cached address or null - use deriveAllAddressesAsync to derive addresses
6002
5996
  */
6003
5997
  getAddressForChain(chain: NetworkType): string | null;
6004
5998
  /**
@@ -5949,27 +5949,20 @@ declare class WalletManager {
5949
5949
  * Uses the unified WDK service which:
5950
5950
  * - In browser: Calls the backend API (which has Tether WDK)
5951
5951
  * - In Node.js: Uses native WDK
5952
- * - Falls back to browser-compatible derivation if needed
5953
- */
5954
- static deriveAddressForChainAsync(seed: string, chain: NetworkType, network?: 'mainnet' | 'testnet', apiUrl?: string): Promise<string>;
5955
- /**
5956
- * Format address for non-WDK chains (fallback)
5957
5952
  *
5958
- * Note: This fallback produces PLACEHOLDER addresses derived from the seed.
5959
- * For real blockchain interaction, use the WDK API via deriveAddressForChainAsync().
5960
- * These addresses should NOT be used for receiving funds without verification.
5953
+ * No fallback to placeholder addresses - WDK API is required for real addresses.
5961
5954
  */
5962
- private static formatAddressForChain;
5955
+ static deriveAddressForChainAsync(seed: string, chain: NetworkType, network?: 'mainnet' | 'testnet', apiUrl?: string): Promise<string>;
5963
5956
  /**
5964
- * Derive address for a specific chain (sync version for backwards compatibility)
5965
- * Uses ethers for basic derivation, use deriveAddressForChainAsync for WDK
5957
+ * Derive address for a specific chain (sync version)
5958
+ * Only supports Ethereum - for other chains use deriveAddressForChainAsync with WDK API
5966
5959
  *
5967
- * Note: For non-Ethereum chains, this produces placeholder addresses that are
5968
- * deterministic but not cryptographically valid. Use WDK API for real addresses.
5960
+ * @throws Error for non-Ethereum chains - use WDK API instead
5969
5961
  */
5970
5962
  static deriveAddressForChain(seed: string, chain: NetworkType): string;
5971
5963
  /**
5972
5964
  * Derive addresses for all enabled chains (sync version)
5965
+ * Only derives Ethereum address synchronously - use deriveAllAddressesAsync for all chains
5973
5966
  */
5974
5967
  deriveAllAddresses(): Partial<MultiChainAddresses>;
5975
5968
  /**
@@ -5990,15 +5983,16 @@ declare class WalletManager {
5990
5983
  private loadAddressesFromStorage;
5991
5984
  /**
5992
5985
  * Derive addresses for all enabled chains using Tether WDK
5993
- * The unified WDK service handles all fallback strategies automatically:
5994
- * - Browser: API backend -> Browser derivation
5995
- * - Node.js: Native WDK -> API backend -> Browser derivation
5996
5986
  *
5997
- * First tries to load from storage to avoid losing real WDK-derived addresses.
5987
+ * Uses the WDK API backend for real cryptographically valid addresses.
5988
+ * First tries to load from storage to avoid losing previously derived addresses.
5989
+ *
5990
+ * @throws Error if WDK API is unavailable and no cached addresses exist
5998
5991
  */
5999
5992
  deriveAllAddressesAsync(): Promise<Partial<MultiChainAddresses>>;
6000
5993
  /**
6001
5994
  * Get address for a specific chain
5995
+ * Returns cached address or null - use deriveAllAddressesAsync to derive addresses
6002
5996
  */
6003
5997
  getAddressForChain(chain: NetworkType): string | null;
6004
5998
  /**
@@ -1,5 +1,5 @@
1
1
  import { Z as ZubariWalletConfig, N as NetworkType, A as Account, a as NetworkBalance, S as SendParams, b as TxResult } from './index-DhluuR9H.mjs';
2
- import './WalletManager--UOBwXJp.mjs';
2
+ import './WalletManager-DWLhos10.mjs';
3
3
 
4
4
  interface ContractAddresses {
5
5
  registry: string;
@@ -1,5 +1,5 @@
1
1
  import { Z as ZubariWalletConfig, N as NetworkType, A as Account, a as NetworkBalance, S as SendParams, b as TxResult } from './index-DhluuR9H.js';
2
- import './WalletManager-DVq_PUZK.js';
2
+ import './WalletManager-DLN81Bpl.js';
3
3
 
4
4
  interface ContractAddresses {
5
5
  registry: string;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- export { P as PLATFORM_CONFIG, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-B19bUJSk.mjs';
2
- export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, W as WalletManager, b as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager--UOBwXJp.mjs';
1
+ export { P as PLATFORM_CONFIG, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-BmBHZP3D.mjs';
2
+ export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, W as WalletManager, b as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-DWLhos10.mjs';
3
3
  export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.mjs';
4
4
  export { ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol } from './protocols/index.mjs';
5
5
  export { BrowserAddressDerivation, ChainAddress, ChainBalance, FeeEstimate, FeeRates, MultiChainAddresses, SupportedChain, SwapService, TransactionHistoryItem, TransactionParams, TransactionResult, TransactionService, TransactionServiceConfig, WdkApiClient, ZubariWdkService, ZubariWdkServiceConfig, createTransactionService, createZubariWdkService, getTransactionService, getWdkApiClient, getZubariWdkService, isBrowser } from './services/index.mjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { P as PLATFORM_CONFIG, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-r6aRsMfN.js';
2
- export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, W as WalletManager, b as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-DVq_PUZK.js';
1
+ export { P as PLATFORM_CONFIG, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-C47lb49r.js';
2
+ export { D as DERIVATION_PATHS, N as NETWORKS, T as TESTNET_NETWORKS, W as WalletManager, b as WalletManagerConfig, a as WalletState, g as getNetworkConfig } from './WalletManager-DLN81Bpl.js';
3
3
  export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.js';
4
4
  export { ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol } from './protocols/index.js';
5
5
  export { BrowserAddressDerivation, ChainAddress, ChainBalance, FeeEstimate, FeeRates, MultiChainAddresses, SupportedChain, SwapService, TransactionHistoryItem, TransactionParams, TransactionResult, TransactionService, TransactionServiceConfig, WdkApiClient, ZubariWdkService, ZubariWdkServiceConfig, createTransactionService, createZubariWdkService, getTransactionService, getWdkApiClient, getZubariWdkService, isBrowser } from './services/index.js';
package/dist/index.js CHANGED
@@ -4,11 +4,11 @@ var ethers = require('ethers');
4
4
  var viem = require('viem');
5
5
  var chains = require('viem/chains');
6
6
  var bip39 = require('@scure/bip39');
7
- var english = require('@scure/bip39/wordlists/english');
7
+ var english_js = require('@scure/bip39/wordlists/english.js');
8
8
  var bip32 = require('@scure/bip32');
9
9
  var base = require('@scure/base');
10
- var sha256 = require('@noble/hashes/sha256');
11
- var ripemd160 = require('@noble/hashes/ripemd160');
10
+ var sha256_js = require('@noble/hashes/sha256.js');
11
+ var ripemd160_js = require('@noble/hashes/ripemd160.js');
12
12
  var react = require('react');
13
13
 
14
14
  var __defProp = Object.defineProperty;
@@ -891,7 +891,7 @@ function deriveBitcoinAddress(seed, network = "testnet") {
891
891
  if (!child.publicKey) {
892
892
  throw new Error("Failed to derive public key");
893
893
  }
894
- const pubKeyHash = ripemd160.ripemd160(sha256.sha256(child.publicKey));
894
+ const pubKeyHash = ripemd160_js.ripemd160(sha256_js.sha256(child.publicKey));
895
895
  const witnessVersion = 0;
896
896
  const words = base.bech32.toWords(pubKeyHash);
897
897
  words.unshift(witnessVersion);
@@ -932,7 +932,7 @@ async function deriveTonAddress(seed) {
932
932
  const publicKey = keypair.publicKey;
933
933
  const workchain = 0;
934
934
  const flags = 17;
935
- const hash = sha256.sha256(publicKey);
935
+ const hash = sha256_js.sha256(publicKey);
936
936
  const addressData = new Uint8Array(34);
937
937
  addressData[0] = flags;
938
938
  addressData[1] = workchain;
@@ -969,7 +969,7 @@ function deriveTronAddress(seed) {
969
969
  for (let i = 0; i < 20; i++) {
970
970
  addressBytes[i + 1] = parseInt(ethAddressHex.slice(i * 2, i * 2 + 2), 16);
971
971
  }
972
- const tronBase58check = base.base58check(sha256.sha256);
972
+ const tronBase58check = base.base58check(sha256_js.sha256);
973
973
  return tronBase58check.encode(addressBytes);
974
974
  } catch (error) {
975
975
  console.error("TRON address derivation failed:", error);
@@ -984,7 +984,7 @@ function deriveSparkAddress(seed, network = "testnet") {
984
984
  if (!child.publicKey) {
985
985
  throw new Error("Failed to derive public key");
986
986
  }
987
- const pubKeyHash = ripemd160.ripemd160(sha256.sha256(child.publicKey));
987
+ const pubKeyHash = ripemd160_js.ripemd160(sha256_js.sha256(child.publicKey));
988
988
  const witnessVersion = 0;
989
989
  const words = base.bech32.toWords(pubKeyHash);
990
990
  words.unshift(witnessVersion);
@@ -1042,10 +1042,10 @@ async function deriveAllAddresses(seed, network = "testnet") {
1042
1042
  return addresses;
1043
1043
  }
1044
1044
  function isValidSeed(seed) {
1045
- return bip39.validateMnemonic(seed, english.wordlist);
1045
+ return bip39.validateMnemonic(seed, english_js.wordlist);
1046
1046
  }
1047
1047
  function generateSeedPhrase() {
1048
- return bip39.generateMnemonic(english.wordlist);
1048
+ return bip39.generateMnemonic(english_js.wordlist);
1049
1049
  }
1050
1050
 
1051
1051
  // src/services/ZubariWdkService.ts
@@ -1166,7 +1166,10 @@ var ZubariWdkService = class {
1166
1166
  return isValidSeed(seed);
1167
1167
  }
1168
1168
  /**
1169
- * Derive address for a specific chain
1169
+ * Derive address for a specific chain using WDK API
1170
+ *
1171
+ * For Ethereum, falls back to local derivation if API fails.
1172
+ * For other chains, WDK API is required - no placeholder fallback.
1170
1173
  */
1171
1174
  async deriveAddress(seed, chain) {
1172
1175
  await this.initialize();
@@ -1182,6 +1185,9 @@ var ZubariWdkService = class {
1182
1185
  }
1183
1186
  } catch (error) {
1184
1187
  console.warn(`API address derivation failed for ${chain}:`, error);
1188
+ if (chain === "ethereum") {
1189
+ return this.deriveBrowserAddress(seed, chain);
1190
+ }
1185
1191
  }
1186
1192
  if (this.useNativeWdk && this.nativeWdkService) {
1187
1193
  try {
@@ -1192,10 +1198,18 @@ var ZubariWdkService = class {
1192
1198
  console.warn(`Native WDK address derivation failed for ${chain}:`, error);
1193
1199
  }
1194
1200
  }
1195
- return this.deriveBrowserAddress(seed, chain);
1201
+ if (chain === "ethereum") {
1202
+ return this.deriveBrowserAddress(seed, chain);
1203
+ }
1204
+ throw new Error(
1205
+ `WDK API required for ${chain} address derivation. Ensure the backend is running.`
1206
+ );
1196
1207
  }
1197
1208
  /**
1198
- * Derive addresses for all supported chains
1209
+ * Derive addresses for all supported chains using WDK API
1210
+ *
1211
+ * Uses the backend WDK API for real cryptographically valid addresses.
1212
+ * No placeholder fallback - WDK API is required for multi-chain addresses.
1199
1213
  */
1200
1214
  async deriveAllAddresses(seed) {
1201
1215
  await this.initialize();
@@ -1223,7 +1237,9 @@ var ZubariWdkService = class {
1223
1237
  console.warn("Native WDK multi-chain derivation failed:", error);
1224
1238
  }
1225
1239
  }
1226
- return this.deriveAllBrowserAddresses(seed);
1240
+ throw new Error(
1241
+ "WDK API required for multi-chain address derivation. Ensure the backend is running."
1242
+ );
1227
1243
  }
1228
1244
  /**
1229
1245
  * Get balances for all chains
@@ -1708,106 +1724,51 @@ var WalletManager = class _WalletManager {
1708
1724
  * Uses the unified WDK service which:
1709
1725
  * - In browser: Calls the backend API (which has Tether WDK)
1710
1726
  * - In Node.js: Uses native WDK
1711
- * - Falls back to browser-compatible derivation if needed
1712
- */
1713
- static async deriveAddressForChainAsync(seed, chain, network = "testnet", apiUrl) {
1714
- try {
1715
- const wdkService = getZubariWdkService({ network, apiUrl });
1716
- const result = await wdkService.deriveAddress(seed, chain);
1717
- return result.address;
1718
- } catch (error) {
1719
- console.warn(`WDK service failed for ${chain}, using local derivation:`, error);
1720
- }
1721
- return _WalletManager.deriveAddressForChain(seed, chain);
1722
- }
1723
- /**
1724
- * Format address for non-WDK chains (fallback)
1725
1727
  *
1726
- * Note: This fallback produces PLACEHOLDER addresses derived from the seed.
1727
- * For real blockchain interaction, use the WDK API via deriveAddressForChainAsync().
1728
- * These addresses should NOT be used for receiving funds without verification.
1728
+ * No fallback to placeholder addresses - WDK API is required for real addresses.
1729
1729
  */
1730
- static formatAddressForChain(address, chain) {
1730
+ static async deriveAddressForChainAsync(seed, chain, network = "testnet", apiUrl) {
1731
1731
  if (chain === "ethereum") {
1732
- return address;
1733
- }
1734
- const addressBytes = address.toLowerCase().replace("0x", "");
1735
- switch (chain) {
1736
- case "bitcoin": {
1737
- const btcChars = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
1738
- let btcAddr = "tb1q";
1739
- for (let i = 0; i < 38; i++) {
1740
- const idx = parseInt(addressBytes.charAt(i % 40) || "0", 16) % btcChars.length;
1741
- btcAddr += btcChars[idx];
1742
- }
1743
- return btcAddr;
1744
- }
1745
- case "ton": {
1746
- const base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
1747
- let tonAddr = "EQ";
1748
- for (let i = 0; i < 46; i++) {
1749
- const idx = parseInt(addressBytes.charAt(i % 40) || "0", 16) * 4 % base64Chars.length;
1750
- tonAddr += base64Chars[idx];
1751
- }
1752
- return tonAddr;
1753
- }
1754
- case "tron": {
1755
- const base58Chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
1756
- let tronAddr = "T";
1757
- for (let i = 0; i < 33; i++) {
1758
- const idx = parseInt(addressBytes.charAt(i % 40) || "0", 16) * 3 % base58Chars.length;
1759
- tronAddr += base58Chars[idx];
1760
- }
1761
- return tronAddr;
1762
- }
1763
- case "solana": {
1764
- const base58Chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
1765
- let solAddr = "";
1766
- for (let i = 0; i < 44; i++) {
1767
- const idx = parseInt(addressBytes.charAt(i % 40) || "0", 16) * 3 % base58Chars.length;
1768
- solAddr += base58Chars[idx];
1769
- }
1770
- return solAddr;
1771
- }
1772
- case "spark": {
1773
- const bech32Chars = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
1774
- let sparkAddr = "sp1q";
1775
- for (let i = 0; i < 58; i++) {
1776
- const idx = parseInt(addressBytes.charAt(i % 40) || "0", 16) % bech32Chars.length;
1777
- sparkAddr += bech32Chars[idx];
1778
- }
1779
- return sparkAddr;
1732
+ try {
1733
+ const wdkService2 = getZubariWdkService({ network, apiUrl });
1734
+ const result2 = await wdkService2.deriveAddress(seed, chain);
1735
+ return result2.address;
1736
+ } catch (error) {
1737
+ console.warn("WDK service failed for Ethereum, using local derivation:", error);
1738
+ return _WalletManager.deriveAddressForChain(seed, "ethereum");
1780
1739
  }
1781
- default:
1782
- return address;
1783
1740
  }
1741
+ const wdkService = getZubariWdkService({ network, apiUrl });
1742
+ const result = await wdkService.deriveAddress(seed, chain);
1743
+ return result.address;
1784
1744
  }
1785
1745
  /**
1786
- * Derive address for a specific chain (sync version for backwards compatibility)
1787
- * Uses ethers for basic derivation, use deriveAddressForChainAsync for WDK
1746
+ * Derive address for a specific chain (sync version)
1747
+ * Only supports Ethereum - for other chains use deriveAddressForChainAsync with WDK API
1788
1748
  *
1789
- * Note: For non-Ethereum chains, this produces placeholder addresses that are
1790
- * deterministic but not cryptographically valid. Use WDK API for real addresses.
1749
+ * @throws Error for non-Ethereum chains - use WDK API instead
1791
1750
  */
1792
1751
  static deriveAddressForChain(seed, chain) {
1793
- const ethPath = DERIVATION_PATHS["ethereum"];
1794
- const ethNode = ethers.HDNodeWallet.fromPhrase(seed, void 0, `${ethPath}/0`);
1795
1752
  if (chain === "ethereum") {
1753
+ const ethPath = DERIVATION_PATHS["ethereum"];
1754
+ const ethNode = ethers.HDNodeWallet.fromPhrase(seed, void 0, `${ethPath}/0`);
1796
1755
  return ethNode.address;
1797
1756
  }
1798
- return _WalletManager.formatAddressForChain(ethNode.address, chain);
1757
+ throw new Error(
1758
+ `Sync derivation not supported for ${chain}. Use deriveAddressForChainAsync() with WDK API.`
1759
+ );
1799
1760
  }
1800
1761
  /**
1801
1762
  * Derive addresses for all enabled chains (sync version)
1763
+ * Only derives Ethereum address synchronously - use deriveAllAddressesAsync for all chains
1802
1764
  */
1803
1765
  deriveAllAddresses() {
1804
1766
  if (!this.currentSeed) {
1805
1767
  throw new Error("Wallet is locked");
1806
1768
  }
1807
- const addresses = {};
1808
- for (const chain of this.config.enabledChains) {
1809
- addresses[chain] = _WalletManager.deriveAddressForChain(this.currentSeed, chain);
1810
- }
1769
+ const addresses = {
1770
+ ethereum: _WalletManager.deriveAddressForChain(this.currentSeed, "ethereum")
1771
+ };
1811
1772
  this.derivedAddresses = addresses;
1812
1773
  return addresses;
1813
1774
  }
@@ -1868,11 +1829,11 @@ var WalletManager = class _WalletManager {
1868
1829
  }
1869
1830
  /**
1870
1831
  * Derive addresses for all enabled chains using Tether WDK
1871
- * The unified WDK service handles all fallback strategies automatically:
1872
- * - Browser: API backend -> Browser derivation
1873
- * - Node.js: Native WDK -> API backend -> Browser derivation
1874
1832
  *
1875
- * First tries to load from storage to avoid losing real WDK-derived addresses.
1833
+ * Uses the WDK API backend for real cryptographically valid addresses.
1834
+ * First tries to load from storage to avoid losing previously derived addresses.
1835
+ *
1836
+ * @throws Error if WDK API is unavailable and no cached addresses exist
1876
1837
  */
1877
1838
  async deriveAllAddressesAsync() {
1878
1839
  if (!this.currentSeed) {
@@ -1889,26 +1850,21 @@ var WalletManager = class _WalletManager {
1889
1850
  console.log("Stored addresses do not match current seed, re-deriving...");
1890
1851
  }
1891
1852
  }
1892
- try {
1893
- return await this.deriveAllAddressesWithWdk();
1894
- } catch (error) {
1895
- console.error("All derivation strategies failed:", error);
1896
- const ethAddress = _WalletManager.deriveAddress(this.currentSeed);
1897
- this.derivedAddresses = { ethereum: ethAddress };
1898
- return this.derivedAddresses;
1899
- }
1853
+ return await this.deriveAllAddressesWithWdk();
1900
1854
  }
1901
1855
  /**
1902
1856
  * Get address for a specific chain
1857
+ * Returns cached address or null - use deriveAllAddressesAsync to derive addresses
1903
1858
  */
1904
1859
  getAddressForChain(chain) {
1905
- if (!this.currentSeed) {
1906
- return this.derivedAddresses[chain] || null;
1860
+ if (this.derivedAddresses[chain]) {
1861
+ return this.derivedAddresses[chain];
1907
1862
  }
1908
- if (!this.derivedAddresses[chain]) {
1863
+ if (chain === "ethereum" && this.currentSeed) {
1909
1864
  this.derivedAddresses[chain] = _WalletManager.deriveAddressForChain(this.currentSeed, chain);
1865
+ return this.derivedAddresses[chain];
1910
1866
  }
1911
- return this.derivedAddresses[chain] || null;
1867
+ return null;
1912
1868
  }
1913
1869
  /**
1914
1870
  * Get all derived addresses