@zubari/sdk 0.1.11 → 0.1.12
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.
- package/dist/{WalletManager-DVq_PUZK.d.ts → WalletManager-DLN81Bpl.d.ts} +11 -17
- package/dist/{WalletManager--UOBwXJp.d.mts → WalletManager-DWLhos10.d.mts} +11 -17
- package/dist/{index-B19bUJSk.d.mts → index-BmBHZP3D.d.mts} +1 -1
- package/dist/{index-r6aRsMfN.d.ts → index-C47lb49r.d.ts} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +55 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -99
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +55 -99
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +55 -99
- package/dist/react/index.mjs.map +1 -1
- package/dist/services/index.d.mts +8 -2
- package/dist/services/index.d.ts +8 -2
- package/dist/services/index.js +20 -4
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs +20 -4
- package/dist/services/index.mjs.map +1 -1
- package/dist/wallet/index.d.mts +2 -2
- package/dist/wallet/index.d.ts +2 -2
- package/dist/wallet/index.js +55 -99
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +55 -99
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
*
|
|
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
|
-
|
|
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
|
|
5965
|
-
*
|
|
5957
|
+
* Derive address for a specific chain (sync version)
|
|
5958
|
+
* Only supports Ethereum - for other chains use deriveAddressForChainAsync with WDK API
|
|
5966
5959
|
*
|
|
5967
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
|
5965
|
-
*
|
|
5957
|
+
* Derive address for a specific chain (sync version)
|
|
5958
|
+
* Only supports Ethereum - for other chains use deriveAddressForChainAsync with WDK API
|
|
5966
5959
|
*
|
|
5967
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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-
|
|
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-
|
|
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
|
|
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-
|
|
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-
|
|
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
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
*
|
|
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
|
|
1730
|
+
static async deriveAddressForChainAsync(seed, chain, network = "testnet", apiUrl) {
|
|
1731
1731
|
if (chain === "ethereum") {
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
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
|
|
1787
|
-
*
|
|
1746
|
+
* Derive address for a specific chain (sync version)
|
|
1747
|
+
* Only supports Ethereum - for other chains use deriveAddressForChainAsync with WDK API
|
|
1788
1748
|
*
|
|
1789
|
-
*
|
|
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
|
-
|
|
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
|
-
|
|
1809
|
-
|
|
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
|
-
*
|
|
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
|
-
|
|
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 (
|
|
1906
|
-
return this.derivedAddresses[chain]
|
|
1860
|
+
if (this.derivedAddresses[chain]) {
|
|
1861
|
+
return this.derivedAddresses[chain];
|
|
1907
1862
|
}
|
|
1908
|
-
if (
|
|
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
|
|
1867
|
+
return null;
|
|
1912
1868
|
}
|
|
1913
1869
|
/**
|
|
1914
1870
|
* Get all derived addresses
|