@profullstack/coinpay 0.3.9 → 0.4.0

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.
@@ -0,0 +1,259 @@
1
+ /**
2
+ * Wallet Module Type Definitions
3
+ */
4
+
5
+ /**
6
+ * Supported blockchain chains
7
+ */
8
+ export declare const WalletChain: {
9
+ readonly BTC: 'BTC';
10
+ readonly BCH: 'BCH';
11
+ readonly ETH: 'ETH';
12
+ readonly POL: 'POL';
13
+ readonly SOL: 'SOL';
14
+ readonly BNB: 'BNB';
15
+ readonly USDC_ETH: 'USDC_ETH';
16
+ readonly USDC_POL: 'USDC_POL';
17
+ readonly USDC_SOL: 'USDC_SOL';
18
+ readonly USDT_ETH: 'USDT_ETH';
19
+ readonly USDT_POL: 'USDT_POL';
20
+ readonly USDT_SOL: 'USDT_SOL';
21
+ };
22
+
23
+ export type WalletChainType = (typeof WalletChain)[keyof typeof WalletChain];
24
+
25
+ /**
26
+ * Default chains to derive on wallet creation
27
+ */
28
+ export declare const DEFAULT_CHAINS: string[];
29
+
30
+ /**
31
+ * Wallet creation options
32
+ */
33
+ export interface WalletCreateOptions {
34
+ /** Number of mnemonic words (12 or 24) */
35
+ words?: 12 | 24;
36
+ /** Chains to derive initial addresses for */
37
+ chains?: string[];
38
+ /** API base URL */
39
+ baseUrl?: string;
40
+ /** Request timeout in ms */
41
+ timeout?: number;
42
+ }
43
+
44
+ /**
45
+ * Wallet import options
46
+ */
47
+ export interface WalletImportOptions {
48
+ /** Chains to derive addresses for */
49
+ chains?: string[];
50
+ /** API base URL */
51
+ baseUrl?: string;
52
+ /** Request timeout in ms */
53
+ timeout?: number;
54
+ }
55
+
56
+ /**
57
+ * Wallet address info
58
+ */
59
+ export interface WalletAddress {
60
+ address_id: string;
61
+ chain: string;
62
+ address: string;
63
+ derivation_index: number;
64
+ is_active: boolean;
65
+ cached_balance?: string;
66
+ balance_updated_at?: string;
67
+ }
68
+
69
+ /**
70
+ * Address list result
71
+ */
72
+ export interface AddressListResult {
73
+ addresses: WalletAddress[];
74
+ total: number;
75
+ }
76
+
77
+ /**
78
+ * Balance info
79
+ */
80
+ export interface WalletBalance {
81
+ chain: string;
82
+ address: string;
83
+ balance: string;
84
+ balance_usd?: string;
85
+ }
86
+
87
+ /**
88
+ * Send transaction options
89
+ */
90
+ export interface SendOptions {
91
+ /** Target blockchain */
92
+ chain: string;
93
+ /** Recipient address */
94
+ to: string;
95
+ /** Amount to send */
96
+ amount: string;
97
+ /** Fee priority */
98
+ priority?: 'low' | 'medium' | 'high';
99
+ }
100
+
101
+ /**
102
+ * Transaction history options
103
+ */
104
+ export interface HistoryOptions {
105
+ /** Filter by chain */
106
+ chain?: string;
107
+ /** Filter by direction */
108
+ direction?: 'incoming' | 'outgoing';
109
+ /** Number of results */
110
+ limit?: number;
111
+ /** Pagination offset */
112
+ offset?: number;
113
+ }
114
+
115
+ /**
116
+ * Transaction record
117
+ */
118
+ export interface Transaction {
119
+ tx_id: string;
120
+ chain: string;
121
+ direction: 'incoming' | 'outgoing';
122
+ amount: string;
123
+ from_address: string;
124
+ to_address: string;
125
+ status: string;
126
+ tx_hash?: string;
127
+ created_at: string;
128
+ }
129
+
130
+ /**
131
+ * Fee estimate
132
+ */
133
+ export interface FeeEstimate {
134
+ priority: 'low' | 'medium' | 'high';
135
+ fee: string;
136
+ fee_usd?: string;
137
+ estimated_time?: string;
138
+ }
139
+
140
+ /**
141
+ * WalletClient class for managing wallets
142
+ */
143
+ export declare class WalletClient {
144
+ private constructor(options?: { baseUrl?: string; timeout?: number });
145
+
146
+ /**
147
+ * Create a new wallet with a fresh mnemonic
148
+ */
149
+ static create(options?: WalletCreateOptions): Promise<WalletClient>;
150
+
151
+ /**
152
+ * Import an existing wallet from a mnemonic
153
+ */
154
+ static fromSeed(mnemonic: string, options?: WalletImportOptions): Promise<WalletClient>;
155
+
156
+ /**
157
+ * Get the mnemonic phrase (for backup)
158
+ */
159
+ getMnemonic(): string | null;
160
+
161
+ /**
162
+ * Get the wallet ID
163
+ */
164
+ getWalletId(): string | null;
165
+
166
+ /**
167
+ * Authenticate with the server
168
+ */
169
+ authenticate(): Promise<void>;
170
+
171
+ /**
172
+ * Get wallet info
173
+ */
174
+ getInfo(): Promise<{
175
+ wallet_id: string;
176
+ status: string;
177
+ created_at: string;
178
+ last_active_at?: string;
179
+ address_count: number;
180
+ }>;
181
+
182
+ /**
183
+ * Get all addresses for this wallet
184
+ */
185
+ getAddresses(options?: { chain?: string; activeOnly?: boolean }): Promise<AddressListResult>;
186
+
187
+ /**
188
+ * Derive a new address for a chain
189
+ */
190
+ deriveAddress(chain: string, index?: number): Promise<WalletAddress>;
191
+
192
+ /**
193
+ * Derive addresses for any missing chains
194
+ */
195
+ deriveMissingChains(targetChains?: string[]): Promise<WalletAddress[]>;
196
+
197
+ /**
198
+ * Get all balances for this wallet
199
+ */
200
+ getBalances(options?: { chain?: string; refresh?: boolean }): Promise<{ balances: WalletBalance[] }>;
201
+
202
+ /**
203
+ * Get balance for a specific chain
204
+ */
205
+ getBalance(chain: string): Promise<{ balances: WalletBalance[] }>;
206
+
207
+ /**
208
+ * Send a transaction
209
+ */
210
+ send(options: SendOptions): Promise<{
211
+ tx_id: string;
212
+ tx_hash: string;
213
+ status: string;
214
+ }>;
215
+
216
+ /**
217
+ * Get transaction history
218
+ */
219
+ getHistory(options?: HistoryOptions): Promise<{
220
+ transactions: Transaction[];
221
+ total: number;
222
+ }>;
223
+
224
+ /**
225
+ * Estimate transaction fee
226
+ */
227
+ estimateFee(chain: string, to?: string, amount?: string): Promise<{
228
+ chain: string;
229
+ estimates: FeeEstimate[];
230
+ }>;
231
+
232
+ /**
233
+ * Encrypt and backup the seed phrase
234
+ */
235
+ backupSeed(password: string): Promise<string>;
236
+ }
237
+
238
+ /**
239
+ * Generate a new mnemonic phrase
240
+ * @param words - Number of words (12 or 24)
241
+ */
242
+ export declare function generateMnemonic(words?: 12 | 24): string;
243
+
244
+ /**
245
+ * Validate a mnemonic phrase
246
+ */
247
+ export declare function validateMnemonic(mnemonic: string): boolean;
248
+
249
+ /**
250
+ * Get derivation path for a chain
251
+ */
252
+ export declare function getDerivationPath(chain: string, index?: number): string;
253
+
254
+ /**
255
+ * Restore a seed from encrypted backup
256
+ */
257
+ export declare function restoreFromBackup(encryptedBackup: string, password: string): Promise<string>;
258
+
259
+ export default WalletClient;