@zubari/sdk 0.1.1 → 0.1.3
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/README.md +2 -2
- package/dist/TransactionService-CxwB1kpN.d.mts +205 -0
- package/dist/TransactionService-DdL6H6M-.d.ts +205 -0
- package/dist/{WalletManager-TiAdzqrn.d.ts → WalletManager-CYJNiww6.d.ts} +49 -132
- package/dist/{WalletManager-DJjdq89b.d.mts → WalletManager-Dmmcbtiw.d.mts} +49 -132
- package/dist/{index-BLuxEdLp.d.mts → index-DhluuR9H.d.mts} +1 -1
- package/dist/{index-BLuxEdLp.d.ts → index-DhluuR9H.d.ts} +1 -1
- package/dist/{index-DO3T2HVe.d.ts → index-OxzgPoRG.d.ts} +2 -2
- package/dist/{index-fXVD8_D0.d.mts → index-poGbMJzn.d.mts} +2 -2
- package/dist/index.d.mts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.js +3057 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3055 -3
- package/dist/index.mjs.map +1 -1
- package/dist/protocols/index.d.mts +1 -1
- package/dist/protocols/index.d.ts +1 -1
- package/dist/react/index.d.mts +4 -5
- package/dist/react/index.d.ts +4 -5
- package/dist/react/index.js +2649 -3
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +2649 -3
- package/dist/react/index.mjs.map +1 -1
- package/dist/services/index.d.mts +87 -3
- package/dist/services/index.d.ts +87 -3
- package/dist/services/index.js +3065 -2
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs +3062 -3
- package/dist/services/index.mjs.map +1 -1
- package/dist/wallet/index.d.mts +4 -5
- package/dist/wallet/index.d.ts +4 -5
- package/dist/wallet/index.js +2650 -2
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +2650 -2
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +6 -1
- package/dist/SwapService-C0G8IXW2.d.mts +0 -35
- package/dist/SwapService-DZD0OJI_.d.ts +0 -35
package/README.md
CHANGED
|
@@ -319,6 +319,6 @@ MIT - see [LICENSE](LICENSE) for details.
|
|
|
319
319
|
|
|
320
320
|
## Links
|
|
321
321
|
|
|
322
|
-
- [GitHub Repository](https://github.com/
|
|
323
|
-
- [Documentation](https://
|
|
322
|
+
- [GitHub Repository](https://github.com/zubaridev/Zubari-wallet)
|
|
323
|
+
- [Documentation](https://zubari-wallet-api.vercel.app/demo)
|
|
324
324
|
- [Tether WDK](https://docs.wallet.tether.io)
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { k as SwapQuote, b as TxResult, N as NetworkType } from './index-DhluuR9H.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SwapService - DEX integration via Velora
|
|
5
|
+
*
|
|
6
|
+
* Handles token swaps with slippage protection,
|
|
7
|
+
* quote fetching, and earnings conversion.
|
|
8
|
+
*/
|
|
9
|
+
declare class SwapService {
|
|
10
|
+
private readonly _chainId;
|
|
11
|
+
private readonly isTestnet;
|
|
12
|
+
constructor(chainId: number, isTestnet?: boolean);
|
|
13
|
+
/**
|
|
14
|
+
* Get a swap quote
|
|
15
|
+
*/
|
|
16
|
+
getQuote(tokenIn: string, tokenOut: string, amountIn: bigint): Promise<SwapQuote>;
|
|
17
|
+
/**
|
|
18
|
+
* Execute a swap with slippage protection
|
|
19
|
+
*/
|
|
20
|
+
executeSwap(quote: SwapQuote, slippageToleranceBps?: number): Promise<TxResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Convert earnings to USDT, keeping some ETH for gas
|
|
23
|
+
*/
|
|
24
|
+
convertEarningsToStable(ethBalance: bigint, reserveForGas?: bigint): Promise<TxResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Check if a swap route exists
|
|
27
|
+
*/
|
|
28
|
+
hasRoute(tokenIn: string, tokenOut: string): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Get supported tokens for swapping
|
|
31
|
+
*/
|
|
32
|
+
getSupportedTokens(): Promise<string[]>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Transaction Service for Zubari SDK
|
|
37
|
+
*
|
|
38
|
+
* Provides multi-chain transaction capabilities using Tether WDK.
|
|
39
|
+
* Supports Ethereum, Bitcoin, Solana, TON, TRON, and Spark (Lightning).
|
|
40
|
+
*
|
|
41
|
+
* @see https://docs.wallet.tether.io/
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Transaction parameters for sending
|
|
46
|
+
*/
|
|
47
|
+
interface TransactionParams {
|
|
48
|
+
/** Recipient address */
|
|
49
|
+
to: string;
|
|
50
|
+
/** Amount to send (in human-readable format, e.g., "0.1") */
|
|
51
|
+
amount: string;
|
|
52
|
+
/** Token address (optional, for ERC-20/SPL tokens) */
|
|
53
|
+
token?: string;
|
|
54
|
+
/** Transaction memo/message (for chains that support it) */
|
|
55
|
+
memo?: string;
|
|
56
|
+
/** Fee priority: 'slow' | 'medium' | 'fast' */
|
|
57
|
+
feePriority?: 'slow' | 'medium' | 'fast';
|
|
58
|
+
/** Custom gas limit (EVM chains) */
|
|
59
|
+
gasLimit?: string;
|
|
60
|
+
/** Custom gas price (EVM chains) */
|
|
61
|
+
gasPrice?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Transaction result with detailed information
|
|
65
|
+
*/
|
|
66
|
+
interface TransactionResult {
|
|
67
|
+
/** Transaction hash */
|
|
68
|
+
hash: string;
|
|
69
|
+
/** Network/chain */
|
|
70
|
+
network: NetworkType;
|
|
71
|
+
/** Transaction status */
|
|
72
|
+
status: 'pending' | 'confirmed' | 'failed';
|
|
73
|
+
/** Block number (when confirmed) */
|
|
74
|
+
blockNumber?: number;
|
|
75
|
+
/** Gas used (EVM chains) */
|
|
76
|
+
gasUsed?: string;
|
|
77
|
+
/** Fee paid */
|
|
78
|
+
fee?: string;
|
|
79
|
+
/** Explorer URL */
|
|
80
|
+
explorerUrl?: string;
|
|
81
|
+
/** Error message if failed */
|
|
82
|
+
error?: string;
|
|
83
|
+
/** Timestamp */
|
|
84
|
+
timestamp: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Transaction history item
|
|
88
|
+
*/
|
|
89
|
+
interface TransactionHistoryItem {
|
|
90
|
+
hash: string;
|
|
91
|
+
network: NetworkType;
|
|
92
|
+
type: 'send' | 'receive' | 'swap' | 'contract';
|
|
93
|
+
from: string;
|
|
94
|
+
to: string;
|
|
95
|
+
amount: string;
|
|
96
|
+
token?: string;
|
|
97
|
+
fee?: string;
|
|
98
|
+
status: 'pending' | 'confirmed' | 'failed';
|
|
99
|
+
timestamp: number;
|
|
100
|
+
blockNumber?: number;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Fee estimate for a transaction
|
|
104
|
+
*/
|
|
105
|
+
interface FeeEstimate {
|
|
106
|
+
slow: {
|
|
107
|
+
fee: string;
|
|
108
|
+
estimatedTime: string;
|
|
109
|
+
};
|
|
110
|
+
medium: {
|
|
111
|
+
fee: string;
|
|
112
|
+
estimatedTime: string;
|
|
113
|
+
};
|
|
114
|
+
fast: {
|
|
115
|
+
fee: string;
|
|
116
|
+
estimatedTime: string;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Transaction Service configuration
|
|
121
|
+
*/
|
|
122
|
+
interface TransactionServiceConfig {
|
|
123
|
+
network: 'mainnet' | 'testnet';
|
|
124
|
+
rpcUrls?: Partial<Record<NetworkType, string>>;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Transaction Service
|
|
128
|
+
*
|
|
129
|
+
* Provides multi-chain transaction capabilities:
|
|
130
|
+
* - Send native tokens (ETH, BTC, SOL, TON, TRX)
|
|
131
|
+
* - Send ERC-20/SPL tokens
|
|
132
|
+
* - Fee estimation
|
|
133
|
+
* - Transaction history
|
|
134
|
+
*/
|
|
135
|
+
declare class TransactionService {
|
|
136
|
+
private seed;
|
|
137
|
+
private config;
|
|
138
|
+
private wallets;
|
|
139
|
+
constructor(config?: Partial<TransactionServiceConfig>);
|
|
140
|
+
/**
|
|
141
|
+
* Ensure WDK modules are loaded
|
|
142
|
+
*/
|
|
143
|
+
private ensureLoaded;
|
|
144
|
+
/**
|
|
145
|
+
* Get RPC URL for a chain
|
|
146
|
+
*/
|
|
147
|
+
private getRpcUrl;
|
|
148
|
+
/**
|
|
149
|
+
* Get explorer URL for a transaction
|
|
150
|
+
*/
|
|
151
|
+
getExplorerUrl(chain: NetworkType, txHash: string): string;
|
|
152
|
+
/**
|
|
153
|
+
* Initialize the service with a seed phrase
|
|
154
|
+
*/
|
|
155
|
+
initialize(seed: string): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Check if service is initialized
|
|
158
|
+
*/
|
|
159
|
+
isInitialized(): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Get or create wallet instance for a specific chain
|
|
162
|
+
*/
|
|
163
|
+
private getWallet;
|
|
164
|
+
/**
|
|
165
|
+
* Estimate transaction fee
|
|
166
|
+
*/
|
|
167
|
+
estimateFee(chain: NetworkType, params: TransactionParams): Promise<FeeEstimate>;
|
|
168
|
+
/**
|
|
169
|
+
* Send a transaction
|
|
170
|
+
*/
|
|
171
|
+
send(chain: NetworkType, params: TransactionParams): Promise<TransactionResult>;
|
|
172
|
+
/**
|
|
173
|
+
* Get transaction status
|
|
174
|
+
*/
|
|
175
|
+
getTransactionStatus(chain: NetworkType, txHash: string): Promise<TransactionResult>;
|
|
176
|
+
/**
|
|
177
|
+
* Get transaction history for an address
|
|
178
|
+
*/
|
|
179
|
+
getTransactionHistory(chain: NetworkType, limit?: number): Promise<TransactionHistoryItem[]>;
|
|
180
|
+
/**
|
|
181
|
+
* Get balance for a specific chain
|
|
182
|
+
*/
|
|
183
|
+
getBalance(chain: NetworkType): Promise<{
|
|
184
|
+
balance: string;
|
|
185
|
+
balanceUsd: number;
|
|
186
|
+
}>;
|
|
187
|
+
/**
|
|
188
|
+
* Get the current network configuration
|
|
189
|
+
*/
|
|
190
|
+
getNetwork(): 'mainnet' | 'testnet';
|
|
191
|
+
/**
|
|
192
|
+
* Clean up and dispose of wallet instances
|
|
193
|
+
*/
|
|
194
|
+
dispose(): void;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Get or create the Transaction service singleton
|
|
198
|
+
*/
|
|
199
|
+
declare function getTransactionService(config?: Partial<TransactionServiceConfig>): TransactionService;
|
|
200
|
+
/**
|
|
201
|
+
* Create a new Transaction service instance (non-singleton)
|
|
202
|
+
*/
|
|
203
|
+
declare function createTransactionService(config?: Partial<TransactionServiceConfig>): TransactionService;
|
|
204
|
+
|
|
205
|
+
export { type FeeEstimate as F, SwapService as S, TransactionService as T, type TransactionParams as a, type TransactionResult as b, createTransactionService as c, type TransactionHistoryItem as d, type TransactionServiceConfig as e, getTransactionService as g };
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { k as SwapQuote, b as TxResult, N as NetworkType } from './index-DhluuR9H.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SwapService - DEX integration via Velora
|
|
5
|
+
*
|
|
6
|
+
* Handles token swaps with slippage protection,
|
|
7
|
+
* quote fetching, and earnings conversion.
|
|
8
|
+
*/
|
|
9
|
+
declare class SwapService {
|
|
10
|
+
private readonly _chainId;
|
|
11
|
+
private readonly isTestnet;
|
|
12
|
+
constructor(chainId: number, isTestnet?: boolean);
|
|
13
|
+
/**
|
|
14
|
+
* Get a swap quote
|
|
15
|
+
*/
|
|
16
|
+
getQuote(tokenIn: string, tokenOut: string, amountIn: bigint): Promise<SwapQuote>;
|
|
17
|
+
/**
|
|
18
|
+
* Execute a swap with slippage protection
|
|
19
|
+
*/
|
|
20
|
+
executeSwap(quote: SwapQuote, slippageToleranceBps?: number): Promise<TxResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Convert earnings to USDT, keeping some ETH for gas
|
|
23
|
+
*/
|
|
24
|
+
convertEarningsToStable(ethBalance: bigint, reserveForGas?: bigint): Promise<TxResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Check if a swap route exists
|
|
27
|
+
*/
|
|
28
|
+
hasRoute(tokenIn: string, tokenOut: string): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Get supported tokens for swapping
|
|
31
|
+
*/
|
|
32
|
+
getSupportedTokens(): Promise<string[]>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Transaction Service for Zubari SDK
|
|
37
|
+
*
|
|
38
|
+
* Provides multi-chain transaction capabilities using Tether WDK.
|
|
39
|
+
* Supports Ethereum, Bitcoin, Solana, TON, TRON, and Spark (Lightning).
|
|
40
|
+
*
|
|
41
|
+
* @see https://docs.wallet.tether.io/
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Transaction parameters for sending
|
|
46
|
+
*/
|
|
47
|
+
interface TransactionParams {
|
|
48
|
+
/** Recipient address */
|
|
49
|
+
to: string;
|
|
50
|
+
/** Amount to send (in human-readable format, e.g., "0.1") */
|
|
51
|
+
amount: string;
|
|
52
|
+
/** Token address (optional, for ERC-20/SPL tokens) */
|
|
53
|
+
token?: string;
|
|
54
|
+
/** Transaction memo/message (for chains that support it) */
|
|
55
|
+
memo?: string;
|
|
56
|
+
/** Fee priority: 'slow' | 'medium' | 'fast' */
|
|
57
|
+
feePriority?: 'slow' | 'medium' | 'fast';
|
|
58
|
+
/** Custom gas limit (EVM chains) */
|
|
59
|
+
gasLimit?: string;
|
|
60
|
+
/** Custom gas price (EVM chains) */
|
|
61
|
+
gasPrice?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Transaction result with detailed information
|
|
65
|
+
*/
|
|
66
|
+
interface TransactionResult {
|
|
67
|
+
/** Transaction hash */
|
|
68
|
+
hash: string;
|
|
69
|
+
/** Network/chain */
|
|
70
|
+
network: NetworkType;
|
|
71
|
+
/** Transaction status */
|
|
72
|
+
status: 'pending' | 'confirmed' | 'failed';
|
|
73
|
+
/** Block number (when confirmed) */
|
|
74
|
+
blockNumber?: number;
|
|
75
|
+
/** Gas used (EVM chains) */
|
|
76
|
+
gasUsed?: string;
|
|
77
|
+
/** Fee paid */
|
|
78
|
+
fee?: string;
|
|
79
|
+
/** Explorer URL */
|
|
80
|
+
explorerUrl?: string;
|
|
81
|
+
/** Error message if failed */
|
|
82
|
+
error?: string;
|
|
83
|
+
/** Timestamp */
|
|
84
|
+
timestamp: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Transaction history item
|
|
88
|
+
*/
|
|
89
|
+
interface TransactionHistoryItem {
|
|
90
|
+
hash: string;
|
|
91
|
+
network: NetworkType;
|
|
92
|
+
type: 'send' | 'receive' | 'swap' | 'contract';
|
|
93
|
+
from: string;
|
|
94
|
+
to: string;
|
|
95
|
+
amount: string;
|
|
96
|
+
token?: string;
|
|
97
|
+
fee?: string;
|
|
98
|
+
status: 'pending' | 'confirmed' | 'failed';
|
|
99
|
+
timestamp: number;
|
|
100
|
+
blockNumber?: number;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Fee estimate for a transaction
|
|
104
|
+
*/
|
|
105
|
+
interface FeeEstimate {
|
|
106
|
+
slow: {
|
|
107
|
+
fee: string;
|
|
108
|
+
estimatedTime: string;
|
|
109
|
+
};
|
|
110
|
+
medium: {
|
|
111
|
+
fee: string;
|
|
112
|
+
estimatedTime: string;
|
|
113
|
+
};
|
|
114
|
+
fast: {
|
|
115
|
+
fee: string;
|
|
116
|
+
estimatedTime: string;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Transaction Service configuration
|
|
121
|
+
*/
|
|
122
|
+
interface TransactionServiceConfig {
|
|
123
|
+
network: 'mainnet' | 'testnet';
|
|
124
|
+
rpcUrls?: Partial<Record<NetworkType, string>>;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Transaction Service
|
|
128
|
+
*
|
|
129
|
+
* Provides multi-chain transaction capabilities:
|
|
130
|
+
* - Send native tokens (ETH, BTC, SOL, TON, TRX)
|
|
131
|
+
* - Send ERC-20/SPL tokens
|
|
132
|
+
* - Fee estimation
|
|
133
|
+
* - Transaction history
|
|
134
|
+
*/
|
|
135
|
+
declare class TransactionService {
|
|
136
|
+
private seed;
|
|
137
|
+
private config;
|
|
138
|
+
private wallets;
|
|
139
|
+
constructor(config?: Partial<TransactionServiceConfig>);
|
|
140
|
+
/**
|
|
141
|
+
* Ensure WDK modules are loaded
|
|
142
|
+
*/
|
|
143
|
+
private ensureLoaded;
|
|
144
|
+
/**
|
|
145
|
+
* Get RPC URL for a chain
|
|
146
|
+
*/
|
|
147
|
+
private getRpcUrl;
|
|
148
|
+
/**
|
|
149
|
+
* Get explorer URL for a transaction
|
|
150
|
+
*/
|
|
151
|
+
getExplorerUrl(chain: NetworkType, txHash: string): string;
|
|
152
|
+
/**
|
|
153
|
+
* Initialize the service with a seed phrase
|
|
154
|
+
*/
|
|
155
|
+
initialize(seed: string): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Check if service is initialized
|
|
158
|
+
*/
|
|
159
|
+
isInitialized(): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Get or create wallet instance for a specific chain
|
|
162
|
+
*/
|
|
163
|
+
private getWallet;
|
|
164
|
+
/**
|
|
165
|
+
* Estimate transaction fee
|
|
166
|
+
*/
|
|
167
|
+
estimateFee(chain: NetworkType, params: TransactionParams): Promise<FeeEstimate>;
|
|
168
|
+
/**
|
|
169
|
+
* Send a transaction
|
|
170
|
+
*/
|
|
171
|
+
send(chain: NetworkType, params: TransactionParams): Promise<TransactionResult>;
|
|
172
|
+
/**
|
|
173
|
+
* Get transaction status
|
|
174
|
+
*/
|
|
175
|
+
getTransactionStatus(chain: NetworkType, txHash: string): Promise<TransactionResult>;
|
|
176
|
+
/**
|
|
177
|
+
* Get transaction history for an address
|
|
178
|
+
*/
|
|
179
|
+
getTransactionHistory(chain: NetworkType, limit?: number): Promise<TransactionHistoryItem[]>;
|
|
180
|
+
/**
|
|
181
|
+
* Get balance for a specific chain
|
|
182
|
+
*/
|
|
183
|
+
getBalance(chain: NetworkType): Promise<{
|
|
184
|
+
balance: string;
|
|
185
|
+
balanceUsd: number;
|
|
186
|
+
}>;
|
|
187
|
+
/**
|
|
188
|
+
* Get the current network configuration
|
|
189
|
+
*/
|
|
190
|
+
getNetwork(): 'mainnet' | 'testnet';
|
|
191
|
+
/**
|
|
192
|
+
* Clean up and dispose of wallet instances
|
|
193
|
+
*/
|
|
194
|
+
dispose(): void;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Get or create the Transaction service singleton
|
|
198
|
+
*/
|
|
199
|
+
declare function getTransactionService(config?: Partial<TransactionServiceConfig>): TransactionService;
|
|
200
|
+
/**
|
|
201
|
+
* Create a new Transaction service instance (non-singleton)
|
|
202
|
+
*/
|
|
203
|
+
declare function createTransactionService(config?: Partial<TransactionServiceConfig>): TransactionService;
|
|
204
|
+
|
|
205
|
+
export { type FeeEstimate as F, SwapService as S, TransactionService as T, type TransactionParams as a, type TransactionResult as b, createTransactionService as c, type TransactionHistoryItem as d, type TransactionServiceConfig as e, getTransactionService as g };
|