@zubari/sdk 0.2.8 → 0.3.1

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.
Files changed (39) hide show
  1. package/dist/{TransactionService-8xSEGoWA.d.mts → TransactionService-DURp3bRL.d.ts} +34 -10
  2. package/dist/{TransactionService-CaIcCoqY.d.ts → TransactionService-DuMJmrG3.d.mts} +34 -10
  3. package/dist/{WalletManager-CCs4Jsv7.d.ts → WalletManager-CEjN-YBF.d.ts} +12 -12
  4. package/dist/{WalletManager-B1qvFF4K.d.mts → WalletManager-bo35aHOJ.d.mts} +12 -12
  5. package/dist/{index-BOc9U2TK.d.mts → index-BpjMiC3n.d.ts} +22 -11
  6. package/dist/{index-Cx389p_j.d.mts → index-DF0Gf8NK.d.mts} +7 -1
  7. package/dist/{index-Cx389p_j.d.ts → index-DF0Gf8NK.d.ts} +7 -1
  8. package/dist/{index-Cqrpp3XA.d.ts → index-DJnsirV5.d.mts} +22 -11
  9. package/dist/index.d.mts +4 -4
  10. package/dist/index.d.ts +4 -4
  11. package/dist/index.js +3064 -1770
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +3064 -1770
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/protocols/index.d.mts +54 -22
  16. package/dist/protocols/index.d.ts +54 -22
  17. package/dist/protocols/index.js +1008 -76
  18. package/dist/protocols/index.js.map +1 -1
  19. package/dist/protocols/index.mjs +1008 -76
  20. package/dist/protocols/index.mjs.map +1 -1
  21. package/dist/react/index.d.mts +3 -3
  22. package/dist/react/index.d.ts +3 -3
  23. package/dist/react/index.js +884 -884
  24. package/dist/react/index.js.map +1 -1
  25. package/dist/react/index.mjs +884 -884
  26. package/dist/react/index.mjs.map +1 -1
  27. package/dist/services/index.d.mts +2 -2
  28. package/dist/services/index.d.ts +2 -2
  29. package/dist/services/index.js +152 -75
  30. package/dist/services/index.js.map +1 -1
  31. package/dist/services/index.mjs +152 -75
  32. package/dist/services/index.mjs.map +1 -1
  33. package/dist/wallet/index.d.mts +3 -3
  34. package/dist/wallet/index.d.ts +3 -3
  35. package/dist/wallet/index.js +1352 -1105
  36. package/dist/wallet/index.js.map +1 -1
  37. package/dist/wallet/index.mjs +1352 -1105
  38. package/dist/wallet/index.mjs.map +1 -1
  39. package/package.json +13 -12
@@ -1,35 +1,59 @@
1
- import { o as SwapQuote, c as TxResult, a as NetworkType } from './index-Cx389p_j.mjs';
1
+ import { o as SwapQuote, c as TxResult, s as TokenInfo, a as NetworkType } from './index-DF0Gf8NK.js';
2
2
 
3
3
  /**
4
- * SwapService - DEX integration via Velora
4
+ * SwapService - DEX integration via Uniswap V3
5
5
  *
6
6
  * Handles token swaps with slippage protection,
7
7
  * quote fetching, and earnings conversion.
8
8
  */
9
9
  declare class SwapService {
10
- private readonly _chainId;
10
+ private readonly chainId;
11
11
  private readonly isTestnet;
12
+ private readonly addresses;
13
+ private readonly tokens;
12
14
  constructor(chainId: number, isTestnet?: boolean);
13
15
  /**
14
- * Get a swap quote
16
+ * Get a swap quote from Uniswap V3 Quoter
15
17
  */
16
- getQuote(tokenIn: string, tokenOut: string, amountIn: bigint): Promise<SwapQuote>;
18
+ getQuote(tokenIn: string, tokenOut: string, amountIn: bigint, provider?: {
19
+ call: (tx: object) => Promise<string>;
20
+ }): Promise<SwapQuote>;
17
21
  /**
18
- * Execute a swap with slippage protection
22
+ * Execute a swap with slippage protection via Uniswap V3 SwapRouter
19
23
  */
20
- executeSwap(quote: SwapQuote, slippageToleranceBps?: number): Promise<TxResult>;
24
+ executeSwap(quote: SwapQuote, signer: {
25
+ sendTransaction: (tx: object) => Promise<{
26
+ hash: string;
27
+ }>;
28
+ }, recipient: string, slippageToleranceBps?: number): Promise<TxResult>;
21
29
  /**
22
30
  * Convert earnings to USDT, keeping some ETH for gas
23
31
  */
24
- convertEarningsToStable(ethBalance: bigint, reserveForGas?: bigint): Promise<TxResult>;
32
+ convertEarningsToStable(ethBalance: bigint, signer: {
33
+ sendTransaction: (tx: object) => Promise<{
34
+ hash: string;
35
+ }>;
36
+ }, recipient: string, provider?: {
37
+ call: (tx: object) => Promise<string>;
38
+ }, reserveForGas?: bigint): Promise<TxResult>;
25
39
  /**
26
40
  * Check if a swap route exists
27
41
  */
28
- hasRoute(tokenIn: string, tokenOut: string): Promise<boolean>;
42
+ hasRoute(tokenIn: string, tokenOut: string, provider?: {
43
+ call: (tx: object) => Promise<string>;
44
+ }): Promise<boolean>;
29
45
  /**
30
46
  * Get supported tokens for swapping
31
47
  */
32
- getSupportedTokens(): Promise<string[]>;
48
+ getSupportedTokens(): Promise<TokenInfo[]>;
49
+ /**
50
+ * Get Uniswap router address for approvals
51
+ */
52
+ getRouterAddress(): string;
53
+ /**
54
+ * Calculate price impact (simplified)
55
+ */
56
+ private calculatePriceImpact;
33
57
  }
34
58
 
35
59
  /**
@@ -1,35 +1,59 @@
1
- import { o as SwapQuote, c as TxResult, a as NetworkType } from './index-Cx389p_j.js';
1
+ import { o as SwapQuote, c as TxResult, s as TokenInfo, a as NetworkType } from './index-DF0Gf8NK.mjs';
2
2
 
3
3
  /**
4
- * SwapService - DEX integration via Velora
4
+ * SwapService - DEX integration via Uniswap V3
5
5
  *
6
6
  * Handles token swaps with slippage protection,
7
7
  * quote fetching, and earnings conversion.
8
8
  */
9
9
  declare class SwapService {
10
- private readonly _chainId;
10
+ private readonly chainId;
11
11
  private readonly isTestnet;
12
+ private readonly addresses;
13
+ private readonly tokens;
12
14
  constructor(chainId: number, isTestnet?: boolean);
13
15
  /**
14
- * Get a swap quote
16
+ * Get a swap quote from Uniswap V3 Quoter
15
17
  */
16
- getQuote(tokenIn: string, tokenOut: string, amountIn: bigint): Promise<SwapQuote>;
18
+ getQuote(tokenIn: string, tokenOut: string, amountIn: bigint, provider?: {
19
+ call: (tx: object) => Promise<string>;
20
+ }): Promise<SwapQuote>;
17
21
  /**
18
- * Execute a swap with slippage protection
22
+ * Execute a swap with slippage protection via Uniswap V3 SwapRouter
19
23
  */
20
- executeSwap(quote: SwapQuote, slippageToleranceBps?: number): Promise<TxResult>;
24
+ executeSwap(quote: SwapQuote, signer: {
25
+ sendTransaction: (tx: object) => Promise<{
26
+ hash: string;
27
+ }>;
28
+ }, recipient: string, slippageToleranceBps?: number): Promise<TxResult>;
21
29
  /**
22
30
  * Convert earnings to USDT, keeping some ETH for gas
23
31
  */
24
- convertEarningsToStable(ethBalance: bigint, reserveForGas?: bigint): Promise<TxResult>;
32
+ convertEarningsToStable(ethBalance: bigint, signer: {
33
+ sendTransaction: (tx: object) => Promise<{
34
+ hash: string;
35
+ }>;
36
+ }, recipient: string, provider?: {
37
+ call: (tx: object) => Promise<string>;
38
+ }, reserveForGas?: bigint): Promise<TxResult>;
25
39
  /**
26
40
  * Check if a swap route exists
27
41
  */
28
- hasRoute(tokenIn: string, tokenOut: string): Promise<boolean>;
42
+ hasRoute(tokenIn: string, tokenOut: string, provider?: {
43
+ call: (tx: object) => Promise<string>;
44
+ }): Promise<boolean>;
29
45
  /**
30
46
  * Get supported tokens for swapping
31
47
  */
32
- getSupportedTokens(): Promise<string[]>;
48
+ getSupportedTokens(): Promise<TokenInfo[]>;
49
+ /**
50
+ * Get Uniswap router address for approvals
51
+ */
52
+ getRouterAddress(): string;
53
+ /**
54
+ * Calculate price impact (simplified)
55
+ */
56
+ private calculatePriceImpact;
33
57
  }
34
58
 
35
59
  /**
@@ -2,7 +2,7 @@ import * as abitype from 'abitype';
2
2
  import * as viem from 'viem';
3
3
  import { HDNodeWallet } from 'ethers';
4
4
  import { S as SecureStorageAdapter } from './SecureStorage-jO783AhC.js';
5
- import { a as NetworkType } from './index-Cx389p_j.js';
5
+ import { a as NetworkType } from './index-DF0Gf8NK.js';
6
6
 
7
7
  interface NetworkConfig {
8
8
  name: string;
@@ -766,8 +766,8 @@ declare class WalletManager {
766
766
  number: blockTag extends "pending" ? null : bigint;
767
767
  nonce: blockTag extends "pending" ? null : `0x${string}`;
768
768
  hash: blockTag extends "pending" ? null : `0x${string}`;
769
- gasUsed: bigint;
770
769
  timestamp: bigint;
770
+ gasUsed: bigint;
771
771
  logsBloom: blockTag extends "pending" ? null : `0x${string}`;
772
772
  baseFeePerGas: bigint | null;
773
773
  blobGasUsed: bigint;
@@ -792,9 +792,9 @@ declare class WalletManager {
792
792
  transactions: includeTransactions extends true ? ({
793
793
  chainId?: number | undefined;
794
794
  nonce: number;
795
+ from: abitype.Address;
795
796
  to: abitype.Address | null;
796
797
  hash: viem.Hash;
797
- from: abitype.Address;
798
798
  value: bigint;
799
799
  yParity?: undefined | undefined;
800
800
  gas: bigint;
@@ -817,9 +817,9 @@ declare class WalletManager {
817
817
  } | {
818
818
  chainId: number;
819
819
  nonce: number;
820
+ from: abitype.Address;
820
821
  to: abitype.Address | null;
821
822
  hash: viem.Hash;
822
- from: abitype.Address;
823
823
  value: bigint;
824
824
  yParity: number;
825
825
  gas: bigint;
@@ -842,9 +842,9 @@ declare class WalletManager {
842
842
  } | {
843
843
  chainId: number;
844
844
  nonce: number;
845
+ from: abitype.Address;
845
846
  to: abitype.Address | null;
846
847
  hash: viem.Hash;
847
- from: abitype.Address;
848
848
  value: bigint;
849
849
  yParity: number;
850
850
  gas: bigint;
@@ -867,9 +867,9 @@ declare class WalletManager {
867
867
  } | {
868
868
  chainId: number;
869
869
  nonce: number;
870
+ from: abitype.Address;
870
871
  to: abitype.Address | null;
871
872
  hash: viem.Hash;
872
- from: abitype.Address;
873
873
  value: bigint;
874
874
  yParity: number;
875
875
  gas: bigint;
@@ -892,9 +892,9 @@ declare class WalletManager {
892
892
  } | {
893
893
  chainId: number;
894
894
  nonce: number;
895
+ from: abitype.Address;
895
896
  to: abitype.Address | null;
896
897
  hash: viem.Hash;
897
- from: abitype.Address;
898
898
  value: bigint;
899
899
  yParity: number;
900
900
  gas: bigint;
@@ -1034,9 +1034,9 @@ declare class WalletManager {
1034
1034
  getTransaction: <blockTag extends viem.BlockTag = "latest">(args: viem.GetTransactionParameters<blockTag>) => Promise<{
1035
1035
  chainId?: number | undefined;
1036
1036
  nonce: number;
1037
+ from: abitype.Address;
1037
1038
  to: abitype.Address | null;
1038
1039
  hash: viem.Hash;
1039
- from: abitype.Address;
1040
1040
  value: bigint;
1041
1041
  yParity?: undefined | undefined;
1042
1042
  gas: bigint;
@@ -1059,9 +1059,9 @@ declare class WalletManager {
1059
1059
  } | {
1060
1060
  chainId: number;
1061
1061
  nonce: number;
1062
+ from: abitype.Address;
1062
1063
  to: abitype.Address | null;
1063
1064
  hash: viem.Hash;
1064
- from: abitype.Address;
1065
1065
  value: bigint;
1066
1066
  yParity: number;
1067
1067
  gas: bigint;
@@ -1084,9 +1084,9 @@ declare class WalletManager {
1084
1084
  } | {
1085
1085
  chainId: number;
1086
1086
  nonce: number;
1087
+ from: abitype.Address;
1087
1088
  to: abitype.Address | null;
1088
1089
  hash: viem.Hash;
1089
- from: abitype.Address;
1090
1090
  value: bigint;
1091
1091
  yParity: number;
1092
1092
  gas: bigint;
@@ -1109,9 +1109,9 @@ declare class WalletManager {
1109
1109
  } | {
1110
1110
  chainId: number;
1111
1111
  nonce: number;
1112
+ from: abitype.Address;
1112
1113
  to: abitype.Address | null;
1113
1114
  hash: viem.Hash;
1114
- from: abitype.Address;
1115
1115
  value: bigint;
1116
1116
  yParity: number;
1117
1117
  gas: bigint;
@@ -1134,9 +1134,9 @@ declare class WalletManager {
1134
1134
  } | {
1135
1135
  chainId: number;
1136
1136
  nonce: number;
1137
+ from: abitype.Address;
1137
1138
  to: abitype.Address | null;
1138
1139
  hash: viem.Hash;
1139
- from: abitype.Address;
1140
1140
  value: bigint;
1141
1141
  yParity: number;
1142
1142
  gas: bigint;
@@ -2,7 +2,7 @@ import * as abitype from 'abitype';
2
2
  import * as viem from 'viem';
3
3
  import { HDNodeWallet } from 'ethers';
4
4
  import { S as SecureStorageAdapter } from './SecureStorage-jO783AhC.mjs';
5
- import { a as NetworkType } from './index-Cx389p_j.mjs';
5
+ import { a as NetworkType } from './index-DF0Gf8NK.mjs';
6
6
 
7
7
  interface NetworkConfig {
8
8
  name: string;
@@ -766,8 +766,8 @@ declare class WalletManager {
766
766
  number: blockTag extends "pending" ? null : bigint;
767
767
  nonce: blockTag extends "pending" ? null : `0x${string}`;
768
768
  hash: blockTag extends "pending" ? null : `0x${string}`;
769
- gasUsed: bigint;
770
769
  timestamp: bigint;
770
+ gasUsed: bigint;
771
771
  logsBloom: blockTag extends "pending" ? null : `0x${string}`;
772
772
  baseFeePerGas: bigint | null;
773
773
  blobGasUsed: bigint;
@@ -792,9 +792,9 @@ declare class WalletManager {
792
792
  transactions: includeTransactions extends true ? ({
793
793
  chainId?: number | undefined;
794
794
  nonce: number;
795
+ from: abitype.Address;
795
796
  to: abitype.Address | null;
796
797
  hash: viem.Hash;
797
- from: abitype.Address;
798
798
  value: bigint;
799
799
  yParity?: undefined | undefined;
800
800
  gas: bigint;
@@ -817,9 +817,9 @@ declare class WalletManager {
817
817
  } | {
818
818
  chainId: number;
819
819
  nonce: number;
820
+ from: abitype.Address;
820
821
  to: abitype.Address | null;
821
822
  hash: viem.Hash;
822
- from: abitype.Address;
823
823
  value: bigint;
824
824
  yParity: number;
825
825
  gas: bigint;
@@ -842,9 +842,9 @@ declare class WalletManager {
842
842
  } | {
843
843
  chainId: number;
844
844
  nonce: number;
845
+ from: abitype.Address;
845
846
  to: abitype.Address | null;
846
847
  hash: viem.Hash;
847
- from: abitype.Address;
848
848
  value: bigint;
849
849
  yParity: number;
850
850
  gas: bigint;
@@ -867,9 +867,9 @@ declare class WalletManager {
867
867
  } | {
868
868
  chainId: number;
869
869
  nonce: number;
870
+ from: abitype.Address;
870
871
  to: abitype.Address | null;
871
872
  hash: viem.Hash;
872
- from: abitype.Address;
873
873
  value: bigint;
874
874
  yParity: number;
875
875
  gas: bigint;
@@ -892,9 +892,9 @@ declare class WalletManager {
892
892
  } | {
893
893
  chainId: number;
894
894
  nonce: number;
895
+ from: abitype.Address;
895
896
  to: abitype.Address | null;
896
897
  hash: viem.Hash;
897
- from: abitype.Address;
898
898
  value: bigint;
899
899
  yParity: number;
900
900
  gas: bigint;
@@ -1034,9 +1034,9 @@ declare class WalletManager {
1034
1034
  getTransaction: <blockTag extends viem.BlockTag = "latest">(args: viem.GetTransactionParameters<blockTag>) => Promise<{
1035
1035
  chainId?: number | undefined;
1036
1036
  nonce: number;
1037
+ from: abitype.Address;
1037
1038
  to: abitype.Address | null;
1038
1039
  hash: viem.Hash;
1039
- from: abitype.Address;
1040
1040
  value: bigint;
1041
1041
  yParity?: undefined | undefined;
1042
1042
  gas: bigint;
@@ -1059,9 +1059,9 @@ declare class WalletManager {
1059
1059
  } | {
1060
1060
  chainId: number;
1061
1061
  nonce: number;
1062
+ from: abitype.Address;
1062
1063
  to: abitype.Address | null;
1063
1064
  hash: viem.Hash;
1064
- from: abitype.Address;
1065
1065
  value: bigint;
1066
1066
  yParity: number;
1067
1067
  gas: bigint;
@@ -1084,9 +1084,9 @@ declare class WalletManager {
1084
1084
  } | {
1085
1085
  chainId: number;
1086
1086
  nonce: number;
1087
+ from: abitype.Address;
1087
1088
  to: abitype.Address | null;
1088
1089
  hash: viem.Hash;
1089
- from: abitype.Address;
1090
1090
  value: bigint;
1091
1091
  yParity: number;
1092
1092
  gas: bigint;
@@ -1109,9 +1109,9 @@ declare class WalletManager {
1109
1109
  } | {
1110
1110
  chainId: number;
1111
1111
  nonce: number;
1112
+ from: abitype.Address;
1112
1113
  to: abitype.Address | null;
1113
1114
  hash: viem.Hash;
1114
- from: abitype.Address;
1115
1115
  value: bigint;
1116
1116
  yParity: number;
1117
1117
  gas: bigint;
@@ -1134,9 +1134,9 @@ declare class WalletManager {
1134
1134
  } | {
1135
1135
  chainId: number;
1136
1136
  nonce: number;
1137
+ from: abitype.Address;
1137
1138
  to: abitype.Address | null;
1138
1139
  hash: viem.Hash;
1139
- from: abitype.Address;
1140
1140
  value: bigint;
1141
1141
  yParity: number;
1142
1142
  gas: bigint;
@@ -1,5 +1,5 @@
1
- import { Z as ZubariWalletConfig, a as NetworkType, A as Account, b as NetworkBalance, S as SendParams, c as TxResult } from './index-Cx389p_j.mjs';
2
- import './WalletManager-B1qvFF4K.mjs';
1
+ import { Z as ZubariWalletConfig, a as NetworkType, A as Account, b as NetworkBalance, S as SendParams, c as TxResult } from './index-DF0Gf8NK.js';
2
+ import './WalletManager-CEjN-YBF.js';
3
3
 
4
4
  interface ContractAddresses {
5
5
  registry: string;
@@ -83,12 +83,13 @@ declare function getContractAddresses(network: 'testnet' | 'mainnet'): ContractA
83
83
  * ZubariWallet - Multi-chain self-custodial wallet
84
84
  *
85
85
  * Core wallet class that manages accounts across multiple blockchain networks
86
- * using Tether WDK as the underlying infrastructure layer.
86
+ * using Tether WDK as the underlying infrastructure layer via ZubariWdkService.
87
87
  */
88
88
  declare class ZubariWallet {
89
89
  private readonly seed;
90
90
  private readonly config;
91
91
  private readonly accounts;
92
+ private readonly wdkService;
92
93
  private initialized;
93
94
  constructor(seed: string, config: ZubariWalletConfig);
94
95
  /**
@@ -96,7 +97,7 @@ declare class ZubariWallet {
96
97
  */
97
98
  initialize(): Promise<void>;
98
99
  /**
99
- * Derive account for a specific network using BIP-44
100
+ * Derive account for a specific network using BIP-44 via WDK API
100
101
  */
101
102
  private deriveAccount;
102
103
  /**
@@ -112,9 +113,13 @@ declare class ZubariWallet {
112
113
  */
113
114
  getAllAddresses(): Promise<Record<NetworkType, string>>;
114
115
  /**
115
- * Get balance for a specific network
116
+ * Get balance for a specific network via WDK API
116
117
  */
117
118
  getBalance(network: NetworkType): Promise<NetworkBalance>;
119
+ /**
120
+ * Format balance from wei/satoshi to human-readable string
121
+ */
122
+ private formatBalance;
118
123
  /**
119
124
  * Get balances for all enabled networks
120
125
  */
@@ -124,11 +129,11 @@ declare class ZubariWallet {
124
129
  */
125
130
  getTotalPortfolioUsd(): Promise<number>;
126
131
  /**
127
- * Send native currency on a specific network
132
+ * Send native currency on a specific network via WDK API
128
133
  */
129
134
  send(network: NetworkType, params: SendParams): Promise<TxResult>;
130
135
  /**
131
- * Send ERC-20 token on EVM networks
136
+ * Send ERC-20 token on EVM networks via WDK API
132
137
  */
133
138
  sendToken(network: NetworkType, token: string, to: string, amount: bigint): Promise<TxResult>;
134
139
  /**
@@ -146,13 +151,13 @@ declare class ZubariWallet {
146
151
  */
147
152
  getBitcoinAddress(): Promise<string>;
148
153
  /**
149
- * Pay Lightning invoice via Spark network
154
+ * Pay Lightning invoice via Spark network using WDK API
150
155
  * Uses WDK WalletManagerSpark (m/44'/998')
151
156
  * @param invoice - Lightning invoice string (lnbc...)
152
157
  */
153
158
  sendLightning(invoice: string): Promise<TxResult>;
154
159
  /**
155
- * Create Lightning invoice via Spark
160
+ * Create Lightning invoice via Spark using WDK API
156
161
  * @param amount - Amount in millisatoshis
157
162
  * @param memo - Optional payment memo
158
163
  * @returns Lightning invoice string (lnbc...)
@@ -163,11 +168,17 @@ declare class ZubariWallet {
163
168
  */
164
169
  private isValidLightningInvoice;
165
170
  /**
166
- * Decode Lightning invoice (basic parsing)
171
+ * Decode Lightning invoice using backend API
172
+ * Parses BOLT11 invoice to extract payment details
167
173
  */
168
174
  private decodeLightningInvoice;
169
175
  /**
170
- * Get Lightning (Spark) balance
176
+ * Basic Lightning invoice parsing (fallback)
177
+ * Extracts amount from invoice prefix when API is unavailable
178
+ */
179
+ private parseInvoiceBasic;
180
+ /**
181
+ * Get Lightning (Spark) balance via WDK API
171
182
  */
172
183
  getLightningBalance(): Promise<{
173
184
  available: bigint;
@@ -15,6 +15,12 @@ interface TokenBalance {
15
15
  balanceUsd: number;
16
16
  decimals: number;
17
17
  }
18
+ interface TokenInfo {
19
+ address: string;
20
+ symbol: string;
21
+ decimals: number;
22
+ name: string;
23
+ }
18
24
  interface NetworkBalance {
19
25
  network: NetworkType;
20
26
  native: {
@@ -258,4 +264,4 @@ declare class ZubariError extends Error {
258
264
  constructor(code: ZubariErrorCode, message: string, details?: unknown | undefined);
259
265
  }
260
266
 
261
- export { type Account as A, type BuyParams as B, type CreateVoucherParams as C, type EarningsBreakdown as E, type LazyMintVoucher as L, type NFTCurrency as N, type PayoutHistoryResponse as P, type RevenueSplit as R, type SendParams as S, type TokenBalance as T, type WatermarkingData as W, type ZubariWalletConfig as Z, type NetworkType as a, type NetworkBalance as b, type TxResult as c, type NFTAttribute as d, type NFTMetadata as e, type NFT as f, type ListingParams as g, type Listing as h, type TipData as i, type TipResult as j, type TipStats as k, type Tip as l, type SubscriptionPlan as m, type Subscription as n, type SwapQuote as o, type SwapParams as p, type ZubariErrorCode as q, ZubariError as r, type EarningsResponse as s, type BreakdownResponse as t, type PlatformFeeResponse as u, type ClaimResult as v };
267
+ export { type Account as A, type BuyParams as B, type CreateVoucherParams as C, type EarningsBreakdown as E, type LazyMintVoucher as L, type NFTCurrency as N, type PayoutHistoryResponse as P, type RevenueSplit as R, type SendParams as S, type TokenBalance as T, type WatermarkingData as W, type ZubariWalletConfig as Z, type NetworkType as a, type NetworkBalance as b, type TxResult as c, type NFTAttribute as d, type NFTMetadata as e, type NFT as f, type ListingParams as g, type Listing as h, type TipData as i, type TipResult as j, type TipStats as k, type Tip as l, type SubscriptionPlan as m, type Subscription as n, type SwapQuote as o, type SwapParams as p, type ZubariErrorCode as q, ZubariError as r, type TokenInfo as s, type EarningsResponse as t, type BreakdownResponse as u, type PlatformFeeResponse as v, type ClaimResult as w };
@@ -15,6 +15,12 @@ interface TokenBalance {
15
15
  balanceUsd: number;
16
16
  decimals: number;
17
17
  }
18
+ interface TokenInfo {
19
+ address: string;
20
+ symbol: string;
21
+ decimals: number;
22
+ name: string;
23
+ }
18
24
  interface NetworkBalance {
19
25
  network: NetworkType;
20
26
  native: {
@@ -258,4 +264,4 @@ declare class ZubariError extends Error {
258
264
  constructor(code: ZubariErrorCode, message: string, details?: unknown | undefined);
259
265
  }
260
266
 
261
- export { type Account as A, type BuyParams as B, type CreateVoucherParams as C, type EarningsBreakdown as E, type LazyMintVoucher as L, type NFTCurrency as N, type PayoutHistoryResponse as P, type RevenueSplit as R, type SendParams as S, type TokenBalance as T, type WatermarkingData as W, type ZubariWalletConfig as Z, type NetworkType as a, type NetworkBalance as b, type TxResult as c, type NFTAttribute as d, type NFTMetadata as e, type NFT as f, type ListingParams as g, type Listing as h, type TipData as i, type TipResult as j, type TipStats as k, type Tip as l, type SubscriptionPlan as m, type Subscription as n, type SwapQuote as o, type SwapParams as p, type ZubariErrorCode as q, ZubariError as r, type EarningsResponse as s, type BreakdownResponse as t, type PlatformFeeResponse as u, type ClaimResult as v };
267
+ export { type Account as A, type BuyParams as B, type CreateVoucherParams as C, type EarningsBreakdown as E, type LazyMintVoucher as L, type NFTCurrency as N, type PayoutHistoryResponse as P, type RevenueSplit as R, type SendParams as S, type TokenBalance as T, type WatermarkingData as W, type ZubariWalletConfig as Z, type NetworkType as a, type NetworkBalance as b, type TxResult as c, type NFTAttribute as d, type NFTMetadata as e, type NFT as f, type ListingParams as g, type Listing as h, type TipData as i, type TipResult as j, type TipStats as k, type Tip as l, type SubscriptionPlan as m, type Subscription as n, type SwapQuote as o, type SwapParams as p, type ZubariErrorCode as q, ZubariError as r, type TokenInfo as s, type EarningsResponse as t, type BreakdownResponse as u, type PlatformFeeResponse as v, type ClaimResult as w };
@@ -1,5 +1,5 @@
1
- import { Z as ZubariWalletConfig, a as NetworkType, A as Account, b as NetworkBalance, S as SendParams, c as TxResult } from './index-Cx389p_j.js';
2
- import './WalletManager-CCs4Jsv7.js';
1
+ import { Z as ZubariWalletConfig, a as NetworkType, A as Account, b as NetworkBalance, S as SendParams, c as TxResult } from './index-DF0Gf8NK.mjs';
2
+ import './WalletManager-bo35aHOJ.mjs';
3
3
 
4
4
  interface ContractAddresses {
5
5
  registry: string;
@@ -83,12 +83,13 @@ declare function getContractAddresses(network: 'testnet' | 'mainnet'): ContractA
83
83
  * ZubariWallet - Multi-chain self-custodial wallet
84
84
  *
85
85
  * Core wallet class that manages accounts across multiple blockchain networks
86
- * using Tether WDK as the underlying infrastructure layer.
86
+ * using Tether WDK as the underlying infrastructure layer via ZubariWdkService.
87
87
  */
88
88
  declare class ZubariWallet {
89
89
  private readonly seed;
90
90
  private readonly config;
91
91
  private readonly accounts;
92
+ private readonly wdkService;
92
93
  private initialized;
93
94
  constructor(seed: string, config: ZubariWalletConfig);
94
95
  /**
@@ -96,7 +97,7 @@ declare class ZubariWallet {
96
97
  */
97
98
  initialize(): Promise<void>;
98
99
  /**
99
- * Derive account for a specific network using BIP-44
100
+ * Derive account for a specific network using BIP-44 via WDK API
100
101
  */
101
102
  private deriveAccount;
102
103
  /**
@@ -112,9 +113,13 @@ declare class ZubariWallet {
112
113
  */
113
114
  getAllAddresses(): Promise<Record<NetworkType, string>>;
114
115
  /**
115
- * Get balance for a specific network
116
+ * Get balance for a specific network via WDK API
116
117
  */
117
118
  getBalance(network: NetworkType): Promise<NetworkBalance>;
119
+ /**
120
+ * Format balance from wei/satoshi to human-readable string
121
+ */
122
+ private formatBalance;
118
123
  /**
119
124
  * Get balances for all enabled networks
120
125
  */
@@ -124,11 +129,11 @@ declare class ZubariWallet {
124
129
  */
125
130
  getTotalPortfolioUsd(): Promise<number>;
126
131
  /**
127
- * Send native currency on a specific network
132
+ * Send native currency on a specific network via WDK API
128
133
  */
129
134
  send(network: NetworkType, params: SendParams): Promise<TxResult>;
130
135
  /**
131
- * Send ERC-20 token on EVM networks
136
+ * Send ERC-20 token on EVM networks via WDK API
132
137
  */
133
138
  sendToken(network: NetworkType, token: string, to: string, amount: bigint): Promise<TxResult>;
134
139
  /**
@@ -146,13 +151,13 @@ declare class ZubariWallet {
146
151
  */
147
152
  getBitcoinAddress(): Promise<string>;
148
153
  /**
149
- * Pay Lightning invoice via Spark network
154
+ * Pay Lightning invoice via Spark network using WDK API
150
155
  * Uses WDK WalletManagerSpark (m/44'/998')
151
156
  * @param invoice - Lightning invoice string (lnbc...)
152
157
  */
153
158
  sendLightning(invoice: string): Promise<TxResult>;
154
159
  /**
155
- * Create Lightning invoice via Spark
160
+ * Create Lightning invoice via Spark using WDK API
156
161
  * @param amount - Amount in millisatoshis
157
162
  * @param memo - Optional payment memo
158
163
  * @returns Lightning invoice string (lnbc...)
@@ -163,11 +168,17 @@ declare class ZubariWallet {
163
168
  */
164
169
  private isValidLightningInvoice;
165
170
  /**
166
- * Decode Lightning invoice (basic parsing)
171
+ * Decode Lightning invoice using backend API
172
+ * Parses BOLT11 invoice to extract payment details
167
173
  */
168
174
  private decodeLightningInvoice;
169
175
  /**
170
- * Get Lightning (Spark) balance
176
+ * Basic Lightning invoice parsing (fallback)
177
+ * Extracts amount from invoice prefix when API is unavailable
178
+ */
179
+ private parseInvoiceBasic;
180
+ /**
181
+ * Get Lightning (Spark) balance via WDK API
171
182
  */
172
183
  getLightningBalance(): Promise<{
173
184
  available: bigint;
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- export { C as CURRENCY_ADDRESSES, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-BOc9U2TK.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-B1qvFF4K.mjs';
1
+ export { C as CURRENCY_ADDRESSES, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-DJnsirV5.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-bo35aHOJ.mjs';
3
3
  export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.mjs';
4
4
  export { ZubariMarketProtocol, ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol } from './protocols/index.mjs';
5
- export { B as BrowserAddressDerivation, l as ChainAddress, m as ChainBalance, v as FeeEstimate, F as FeeRates, M as MultiChainAddresses, k as SupportedChain, S as SwapService, u as TransactionHistoryItem, s as TransactionParams, t as TransactionResult, p as TransactionService, w as TransactionServiceConfig, W as WdkApiClient, Z as ZubariWdkService, o as ZubariWdkServiceConfig, r as createTransactionService, i as createZubariWdkService, q as getTransactionService, g as getWdkApiClient, h as getZubariWdkService, j as isBrowser } from './TransactionService-8xSEGoWA.mjs';
6
- export { A as Account, B as BuyParams, C as CreateVoucherParams, E as EarningsBreakdown, L as LazyMintVoucher, h as Listing, g as ListingParams, f as NFT, d as NFTAttribute, N as NFTCurrency, e as NFTMetadata, b as NetworkBalance, a as NetworkType, R as RevenueSplit, S as SendParams, n as Subscription, m as SubscriptionPlan, p as SwapParams, o as SwapQuote, l as Tip, i as TipData, j as TipResult, k as TipStats, T as TokenBalance, c as TxResult, W as WatermarkingData, r as ZubariError, q as ZubariErrorCode, Z as ZubariWalletConfig } from './index-Cx389p_j.mjs';
5
+ export { B as BrowserAddressDerivation, l as ChainAddress, m as ChainBalance, v as FeeEstimate, F as FeeRates, M as MultiChainAddresses, k as SupportedChain, S as SwapService, u as TransactionHistoryItem, s as TransactionParams, t as TransactionResult, p as TransactionService, w as TransactionServiceConfig, W as WdkApiClient, Z as ZubariWdkService, o as ZubariWdkServiceConfig, r as createTransactionService, i as createZubariWdkService, q as getTransactionService, g as getWdkApiClient, h as getZubariWdkService, j as isBrowser } from './TransactionService-DuMJmrG3.mjs';
6
+ export { A as Account, B as BuyParams, C as CreateVoucherParams, E as EarningsBreakdown, L as LazyMintVoucher, h as Listing, g as ListingParams, f as NFT, d as NFTAttribute, N as NFTCurrency, e as NFTMetadata, b as NetworkBalance, a as NetworkType, R as RevenueSplit, S as SendParams, n as Subscription, m as SubscriptionPlan, p as SwapParams, o as SwapQuote, l as Tip, i as TipData, j as TipResult, k as TipStats, T as TokenBalance, c as TxResult, W as WatermarkingData, r as ZubariError, q as ZubariErrorCode, Z as ZubariWalletConfig } from './index-DF0Gf8NK.mjs';
7
7
  export { FeeEstimateResult, SendTransactionResult, UseWalletManagerOptions, UseWalletManagerReturn, useWalletManager } from './react/index.mjs';
8
8
  import 'abitype';
9
9
  import 'viem';
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { C as CURRENCY_ADDRESSES, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-Cqrpp3XA.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-CCs4Jsv7.js';
1
+ export { C as CURRENCY_ADDRESSES, N as NFT_VOUCHER_DOMAIN, c as NFT_VOUCHER_TYPES, P as PLATFORM_CONFIG, b as ZERO_ADDRESS, a as ZUBARI_CONTRACTS, Z as ZubariWallet, g as getContractAddresses } from './index-BpjMiC3n.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-CEjN-YBF.js';
3
3
  export { M as MemoryStorageAdapter, S as SecureStorageAdapter, W as WebEncryptedStorageAdapter, c as createSecureStorage } from './SecureStorage-jO783AhC.js';
4
4
  export { ZubariMarketProtocol, ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol } from './protocols/index.js';
5
- export { B as BrowserAddressDerivation, l as ChainAddress, m as ChainBalance, v as FeeEstimate, F as FeeRates, M as MultiChainAddresses, k as SupportedChain, S as SwapService, u as TransactionHistoryItem, s as TransactionParams, t as TransactionResult, p as TransactionService, w as TransactionServiceConfig, W as WdkApiClient, Z as ZubariWdkService, o as ZubariWdkServiceConfig, r as createTransactionService, i as createZubariWdkService, q as getTransactionService, g as getWdkApiClient, h as getZubariWdkService, j as isBrowser } from './TransactionService-CaIcCoqY.js';
6
- export { A as Account, B as BuyParams, C as CreateVoucherParams, E as EarningsBreakdown, L as LazyMintVoucher, h as Listing, g as ListingParams, f as NFT, d as NFTAttribute, N as NFTCurrency, e as NFTMetadata, b as NetworkBalance, a as NetworkType, R as RevenueSplit, S as SendParams, n as Subscription, m as SubscriptionPlan, p as SwapParams, o as SwapQuote, l as Tip, i as TipData, j as TipResult, k as TipStats, T as TokenBalance, c as TxResult, W as WatermarkingData, r as ZubariError, q as ZubariErrorCode, Z as ZubariWalletConfig } from './index-Cx389p_j.js';
5
+ export { B as BrowserAddressDerivation, l as ChainAddress, m as ChainBalance, v as FeeEstimate, F as FeeRates, M as MultiChainAddresses, k as SupportedChain, S as SwapService, u as TransactionHistoryItem, s as TransactionParams, t as TransactionResult, p as TransactionService, w as TransactionServiceConfig, W as WdkApiClient, Z as ZubariWdkService, o as ZubariWdkServiceConfig, r as createTransactionService, i as createZubariWdkService, q as getTransactionService, g as getWdkApiClient, h as getZubariWdkService, j as isBrowser } from './TransactionService-DURp3bRL.js';
6
+ export { A as Account, B as BuyParams, C as CreateVoucherParams, E as EarningsBreakdown, L as LazyMintVoucher, h as Listing, g as ListingParams, f as NFT, d as NFTAttribute, N as NFTCurrency, e as NFTMetadata, b as NetworkBalance, a as NetworkType, R as RevenueSplit, S as SendParams, n as Subscription, m as SubscriptionPlan, p as SwapParams, o as SwapQuote, l as Tip, i as TipData, j as TipResult, k as TipStats, T as TokenBalance, c as TxResult, W as WatermarkingData, r as ZubariError, q as ZubariErrorCode, Z as ZubariWalletConfig } from './index-DF0Gf8NK.js';
7
7
  export { FeeEstimateResult, SendTransactionResult, UseWalletManagerOptions, UseWalletManagerReturn, useWalletManager } from './react/index.js';
8
8
  import 'abitype';
9
9
  import 'viem';