@zubari/sdk 0.2.4 → 0.2.6

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.
@@ -1,579 +1,705 @@
1
- import { o as SwapQuote, b as TxResult, N as NetworkType } from '../index-Bou-9cAG.mjs';
1
+ export { B as BrowserAddressDerivation, C as BrowserChainAddress, a as BrowserMultiChainAddresses, l as ChainAddress, m as ChainBalance, D as DeriveAddressResponse, c as DeriveAllAddressesResponse, v as FeeEstimate, F as FeeRates, G as GenerateSeedResponse, M as MultiChainAddresses, e as SendTransactionResponse, k as SupportedChain, S as SwapService, u as TransactionHistoryItem, d as TransactionHistoryResponse, s as TransactionParams, t as TransactionResult, p as TransactionService, w as TransactionServiceConfig, f as TransactionStatusResponse, V as ValidateSeedResponse, W as WdkApiClient, b as WdkApiConfig, T as WdkTransactionHistoryItem, n as WdkTransactionResult, 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';
2
+ import { N as NFTCurrency } from '../index-Cx389p_j.mjs';
2
3
 
3
4
  /**
4
- * SwapService - DEX integration via Velora
5
+ * Zubari API Client
5
6
  *
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
- * WDK API Client
37
- *
38
- * Client for calling the backend WDK endpoints to derive addresses
39
- * using Tether WDK (which runs server-side in Node.js).
7
+ * Comprehensive client for interacting with the Zubari backend API.
8
+ * Includes NFT, Marketplace, Tips, and Subscription operations.
40
9
  */
41
10
 
42
- interface WdkApiConfig {
11
+ interface ZubariApiConfig {
43
12
  baseUrl: string;
44
13
  timeout?: number;
14
+ authToken?: string;
15
+ }
16
+ interface NFTVoucher {
17
+ tokenId: string;
18
+ uri: string;
19
+ creator: string;
20
+ royaltyBps: number;
21
+ deadline: number;
22
+ signature: string;
23
+ price: string;
24
+ currency: string;
25
+ nonce: number;
26
+ contentHash?: string;
27
+ userId?: string;
28
+ watermarkTimestamp?: number;
29
+ sessionId?: string;
45
30
  }
46
- interface DeriveAddressResponse {
31
+ interface CreateVoucherRequest {
32
+ creatorAddress: string;
33
+ price: string;
34
+ currency: NFTCurrency;
35
+ }
36
+ interface CreateVoucherResponse {
47
37
  success: boolean;
48
- address?: string;
49
- chain?: string;
50
- path?: string;
51
- network?: string;
38
+ voucher?: NFTVoucher;
39
+ signature?: string;
40
+ nftId?: string;
41
+ error?: string;
42
+ }
43
+ interface RedeemVoucherRequest {
44
+ buyerAddress: string;
45
+ paymentTxHash?: string;
46
+ }
47
+ interface RedeemVoucherResponse {
48
+ success: boolean;
49
+ transactionHash?: string;
50
+ tokenId?: string;
51
+ owner?: string;
52
+ nftId?: string;
53
+ error?: string;
54
+ }
55
+ interface VoucherStatusResponse {
56
+ success: boolean;
57
+ nftId?: string;
58
+ hasVoucher?: boolean;
59
+ isRedeemed?: boolean;
60
+ voucher?: NFTVoucher;
61
+ error?: string;
62
+ }
63
+ interface NFTResponse {
64
+ id: string;
65
+ tokenId?: string;
66
+ contractAddress?: string;
67
+ name: string;
68
+ description?: string;
69
+ imageUrl?: string;
70
+ animationUrl?: string;
71
+ externalUrl?: string;
72
+ attributes?: Array<{
73
+ trait_type: string;
74
+ value: string | number;
75
+ }>;
76
+ creatorId: string;
77
+ ownerId: string;
78
+ price?: string;
79
+ currency?: string;
80
+ royaltyBps: number;
81
+ isLazyMinted: boolean;
82
+ isMinted: boolean;
83
+ mintedAt?: string;
84
+ transactionHash?: string;
85
+ createdAt: string;
86
+ updatedAt: string;
87
+ }
88
+ interface CreateNFTRequest {
89
+ name: string;
90
+ description?: string;
91
+ price: string;
92
+ currency: NFTCurrency;
93
+ royaltyBps?: number;
94
+ attributes?: Array<{
95
+ trait_type: string;
96
+ value: string | number;
97
+ }>;
98
+ externalUrl?: string;
99
+ }
100
+ interface NFTListResponse {
101
+ success: boolean;
102
+ nfts?: NFTResponse[];
103
+ pagination?: {
104
+ page: number;
105
+ limit: number;
106
+ total: number;
107
+ pages: number;
108
+ };
109
+ error?: string;
110
+ }
111
+ interface MarketListing {
112
+ id: string;
113
+ nftId: string;
114
+ nft?: NFTResponse;
115
+ sellerId: string;
116
+ sellerAddress: string;
117
+ price: string;
118
+ currency: string;
119
+ expiresAt: string;
120
+ status: 'ACTIVE' | 'SOLD' | 'CANCELLED' | 'EXPIRED';
121
+ transactionHash?: string;
122
+ createdAt: string;
123
+ updatedAt: string;
124
+ }
125
+ interface ListItemRequest {
126
+ nftId: string;
127
+ price: string;
128
+ currency: NFTCurrency;
129
+ duration?: number;
130
+ }
131
+ interface ListItemResponse {
132
+ success: boolean;
133
+ listing?: MarketListing;
134
+ transactionHash?: string;
135
+ error?: string;
136
+ }
137
+ interface BuyItemRequest {
138
+ listingId: string;
139
+ buyerAddress: string;
140
+ }
141
+ interface BuyItemResponse {
142
+ success: boolean;
143
+ transactionHash?: string;
144
+ tokenId?: string;
145
+ newOwner?: string;
146
+ error?: string;
147
+ }
148
+ interface CancelListingRequest {
149
+ listingId: string;
150
+ }
151
+ interface CancelListingResponse {
152
+ success: boolean;
153
+ transactionHash?: string;
154
+ error?: string;
155
+ }
156
+ interface UpdatePriceRequest {
157
+ listingId: string;
158
+ newPrice: string;
159
+ }
160
+ interface UpdatePriceResponse {
161
+ success: boolean;
162
+ listing?: MarketListing;
163
+ transactionHash?: string;
164
+ error?: string;
165
+ }
166
+ interface ListingsResponse {
167
+ success: boolean;
168
+ listings?: MarketListing[];
169
+ pagination?: {
170
+ page: number;
171
+ limit: number;
172
+ total: number;
173
+ pages: number;
174
+ };
52
175
  error?: string;
53
176
  }
54
- interface DeriveAllAddressesResponse {
177
+ interface MarketStatsResponse {
55
178
  success: boolean;
56
- addresses?: {
57
- ethereum: string | null;
58
- bitcoin: string | null;
59
- ton: string | null;
60
- tron: string | null;
61
- solana: string | null;
62
- spark: string | null;
179
+ stats?: {
180
+ totalListings: number;
181
+ activeListings: number;
182
+ totalVolume: string;
183
+ totalSales: number;
184
+ averagePrice: string;
185
+ topSellers: Array<{
186
+ address: string;
187
+ sales: number;
188
+ volume: string;
189
+ }>;
63
190
  };
191
+ error?: string;
192
+ }
193
+ interface NFTFilters {
194
+ creatorId?: string;
195
+ ownerId?: string;
196
+ isLazyMinted?: boolean;
197
+ isMinted?: boolean;
198
+ minPrice?: string;
199
+ maxPrice?: string;
200
+ currency?: NFTCurrency;
201
+ page?: number;
202
+ limit?: number;
203
+ }
204
+ interface ListingFilters {
205
+ sellerId?: string;
206
+ status?: 'ACTIVE' | 'SOLD' | 'CANCELLED' | 'EXPIRED';
207
+ minPrice?: string;
208
+ maxPrice?: string;
209
+ currency?: NFTCurrency;
210
+ sortBy?: 'price' | 'createdAt' | 'expiresAt';
211
+ sortOrder?: 'asc' | 'desc';
212
+ page?: number;
213
+ limit?: number;
214
+ }
215
+ interface TipUser {
216
+ id: string;
217
+ username?: string;
218
+ displayName?: string;
219
+ avatarUrl?: string;
220
+ }
221
+ interface Tip {
222
+ id: string;
223
+ senderId: string;
224
+ recipientId?: string;
225
+ senderAddress: string;
226
+ recipientAddress: string;
227
+ tokenAddress?: string;
228
+ amount: string;
229
+ amountUsd?: string;
230
+ platformFee: string;
231
+ message?: string;
232
+ network: string;
233
+ transactionHash?: string;
234
+ status: 'PENDING' | 'CONFIRMED' | 'FAILED';
235
+ createdAt: string;
236
+ sender?: TipUser;
237
+ recipient?: TipUser;
238
+ }
239
+ interface SendTipRequest {
240
+ recipientAddress: string;
241
+ recipientUsername?: string;
242
+ amount: string;
243
+ tokenAddress?: string;
64
244
  network?: string;
245
+ message?: string;
246
+ transactionHash?: string;
247
+ }
248
+ interface SendTipResponse {
249
+ success: boolean;
250
+ message?: string;
251
+ tip?: Tip;
252
+ platformFee?: string;
253
+ platformFeeBps?: number;
254
+ error?: string;
255
+ }
256
+ interface TipStatsResponse {
257
+ success: boolean;
258
+ sent?: {
259
+ count: number;
260
+ totalAmount: string;
261
+ totalAmountUsd: string;
262
+ };
263
+ received?: {
264
+ count: number;
265
+ totalAmount: string;
266
+ totalAmountUsd: string;
267
+ platformFees: string;
268
+ };
269
+ error?: string;
270
+ }
271
+ interface TipsListResponse {
272
+ success: boolean;
273
+ tips?: Tip[];
274
+ pagination?: {
275
+ page: number;
276
+ limit: number;
277
+ total: number;
278
+ totalPages: number;
279
+ };
280
+ totals?: {
281
+ count: number;
282
+ amount: string;
283
+ amountUsd: string;
284
+ };
285
+ error?: string;
286
+ }
287
+ interface TipFilters {
288
+ page?: number;
289
+ limit?: number;
290
+ status?: 'PENDING' | 'CONFIRMED' | 'FAILED';
291
+ }
292
+ interface UpdateTipStatusRequest {
293
+ status: 'PENDING' | 'CONFIRMED' | 'FAILED';
294
+ transactionHash?: string;
295
+ }
296
+ interface SubscriptionPlan {
297
+ id: string;
298
+ creatorId: string;
299
+ name: string;
300
+ description?: string;
301
+ price: string;
302
+ priceUsd?: string;
303
+ paymentToken?: string;
304
+ durationDays: number;
305
+ perks: string[];
306
+ nftBadge: boolean;
307
+ maxSubscribers?: number;
308
+ isActive: boolean;
309
+ activeSubscribers?: number;
310
+ createdAt: string;
311
+ updatedAt: string;
312
+ creator?: TipUser & {
313
+ isVerified?: boolean;
314
+ };
315
+ }
316
+ interface Subscription {
317
+ id: string;
318
+ planId: string;
319
+ subscriberId: string;
320
+ creatorId: string;
321
+ subscriberAddress?: string;
322
+ creatorAddress?: string;
323
+ transactionHash?: string;
324
+ amount?: string;
325
+ startDate: string;
326
+ endDate: string;
327
+ expiresAt: string;
328
+ autoRenew: boolean;
329
+ status: 'ACTIVE' | 'EXPIRED' | 'CANCELLED';
330
+ createdAt: string;
331
+ plan?: Partial<SubscriptionPlan>;
332
+ creator?: TipUser & {
333
+ isVerified?: boolean;
334
+ };
335
+ subscriber?: TipUser;
336
+ }
337
+ interface CreatePlanRequest {
338
+ name: string;
339
+ description?: string;
340
+ price: string;
341
+ priceUsd?: number;
342
+ paymentToken?: string;
343
+ durationDays?: number;
344
+ perks?: string[];
345
+ nftBadge?: boolean;
346
+ maxSubscribers?: number;
347
+ }
348
+ interface CreatePlanResponse {
349
+ success: boolean;
350
+ message?: string;
351
+ plan?: SubscriptionPlan;
352
+ error?: string;
353
+ }
354
+ interface SubscribeRequest {
355
+ planId: string;
356
+ transactionHash?: string;
357
+ autoRenew?: boolean;
358
+ }
359
+ interface SubscribeResponse {
360
+ success: boolean;
361
+ message?: string;
362
+ subscription?: Subscription;
65
363
  error?: string;
66
364
  }
67
- interface ValidateSeedResponse {
365
+ interface SubscriptionListResponse {
68
366
  success: boolean;
69
- isValid?: boolean;
70
- wordCount?: number;
367
+ subscriptions?: Subscription[];
368
+ pagination?: {
369
+ page: number;
370
+ limit: number;
371
+ total: number;
372
+ totalPages: number;
373
+ };
374
+ stats?: {
375
+ totalSubscribers: number;
376
+ };
71
377
  error?: string;
72
378
  }
73
- interface GenerateSeedResponse {
379
+ interface SubscriptionFilters {
380
+ page?: number;
381
+ limit?: number;
382
+ status?: 'ACTIVE' | 'EXPIRED' | 'CANCELLED';
383
+ }
384
+ interface ContractSubscribeRequest {
385
+ planId: string;
386
+ months?: number;
387
+ seed: string;
388
+ }
389
+ interface ContractSubscribeResponse {
74
390
  success: boolean;
75
- seed?: string;
76
- wordCount?: number;
391
+ transactionHash?: string;
392
+ subscription?: Subscription;
393
+ message?: string;
77
394
  error?: string;
78
395
  }
79
- interface TransactionHistoryItem$1 {
80
- hash: string;
81
- from: string;
82
- to: string;
83
- value: string;
84
- timestamp: number;
85
- status: 'confirmed' | 'pending' | 'failed';
86
- blockNumber?: number;
396
+ interface ContractCreatePlanRequest {
397
+ name: string;
398
+ description?: string;
399
+ price: string;
400
+ paymentToken?: string;
401
+ durationDays?: number;
402
+ maxSubscribers?: number;
403
+ seed: string;
87
404
  }
88
- interface TransactionHistoryResponse {
405
+ interface ContractCreatePlanResponse {
406
+ success: boolean;
407
+ transactionHash?: string;
408
+ plan?: SubscriptionPlan;
409
+ message?: string;
410
+ error?: string;
411
+ }
412
+ interface IsSubscribedResponse {
413
+ subscriber: string;
414
+ creator: string;
415
+ isSubscribed: boolean;
416
+ }
417
+ interface PlatformFeeResponse {
418
+ feeBps: number;
419
+ feePercent: string;
420
+ }
421
+ interface EarningsResponse {
89
422
  success: boolean;
90
423
  address?: string;
91
- transactions?: TransactionHistoryItem$1[];
92
- chain?: string;
93
- network?: string;
424
+ pendingEarnings?: string;
425
+ totalEarnings?: string;
426
+ earningsBreakdown?: {
427
+ tips: string;
428
+ subscriptions: string;
429
+ nftSales: string;
430
+ royalties: string;
431
+ };
432
+ recentPayouts?: Array<{
433
+ id: string;
434
+ amount: string;
435
+ txHash: string;
436
+ createdAt: string;
437
+ }>;
94
438
  error?: string;
95
439
  }
96
- interface SendTransactionResponse {
440
+ interface ClaimEarningsRequest {
441
+ seed: string;
442
+ }
443
+ interface ClaimEarningsResponse {
97
444
  success: boolean;
98
- txHash?: string;
99
- from?: string;
100
- to?: string;
445
+ transactionHash?: string;
101
446
  amount?: string;
102
- chain?: string;
103
- network?: string;
447
+ message?: string;
104
448
  error?: string;
105
449
  }
106
- interface TransactionStatusResponse {
450
+ interface PayoutHistoryResponse {
107
451
  success: boolean;
108
- hash?: string;
109
- status?: 'confirmed' | 'pending' | 'failed';
110
- blockNumber?: number;
111
- confirmations?: number;
112
- timestamp?: number;
113
- from?: string;
114
- to?: string;
115
- value?: string;
116
- fee?: string;
117
- chain?: string;
118
- network?: string;
452
+ payouts?: Array<{
453
+ id: string;
454
+ amount: string;
455
+ status: string;
456
+ txHash: string;
457
+ createdAt: string;
458
+ confirmedAt?: string;
459
+ }>;
460
+ pagination?: {
461
+ page: number;
462
+ limit: number;
463
+ total: number;
464
+ pages: number;
465
+ };
466
+ error?: string;
467
+ }
468
+ interface EarningsBreakdownResponse {
469
+ success: boolean;
470
+ breakdown?: {
471
+ tips: string;
472
+ subscriptions: string;
473
+ nftSales: string;
474
+ royalties: string;
475
+ total: string;
476
+ };
477
+ percentages?: {
478
+ tips: string;
479
+ subscriptions: string;
480
+ nftSales: string;
481
+ royalties: string;
482
+ };
119
483
  error?: string;
120
484
  }
121
485
  /**
122
- * WDK API Client for server-side Tether WDK integration
486
+ * Zubari API Client for backend integration
123
487
  */
124
- declare class WdkApiClient {
488
+ declare class ZubariApiClient {
125
489
  private config;
126
- constructor(config: WdkApiConfig);
490
+ constructor(config: ZubariApiConfig);
127
491
  /**
128
- * Generate a new BIP-39 seed phrase using Tether WDK
492
+ * Set the authentication token
129
493
  */
130
- generateSeed(): Promise<GenerateSeedResponse>;
494
+ setAuthToken(token: string): void;
131
495
  /**
132
- * Validate a BIP-39 seed phrase
496
+ * Clear the authentication token
133
497
  */
134
- validateSeed(seed: string): Promise<ValidateSeedResponse>;
498
+ clearAuthToken(): void;
135
499
  /**
136
- * Derive address for a specific chain using Tether WDK
500
+ * Make an authenticated request to the API
137
501
  */
138
- deriveAddress(seed: string, chain: NetworkType, network?: 'mainnet' | 'testnet'): Promise<DeriveAddressResponse>;
502
+ private request;
139
503
  /**
140
- * Derive addresses for all chains using Tether WDK
504
+ * Get all NFTs with optional filters
141
505
  */
142
- deriveAllAddresses(seed: string, network?: 'mainnet' | 'testnet'): Promise<DeriveAllAddressesResponse>;
506
+ getNFTs(filters?: NFTFilters): Promise<NFTListResponse>;
143
507
  /**
144
- * Send a transaction on a specific chain using Tether WDK
508
+ * Get a single NFT by ID
145
509
  */
146
- sendTransaction(seed: string, chain: NetworkType, to: string, amount: string, network?: 'mainnet' | 'testnet'): Promise<SendTransactionResponse>;
510
+ getNFT(nftId: string): Promise<{
511
+ success: boolean;
512
+ nft?: NFTResponse;
513
+ error?: string;
514
+ }>;
147
515
  /**
148
- * Get transaction history for an address on a specific chain
149
- * Fetches from blockchain explorers (Etherscan, mempool.space, etc.)
516
+ * Create a new NFT (lazy minted)
150
517
  */
151
- getTransactionHistory(seed: string, chain: NetworkType, network?: 'mainnet' | 'testnet', limit?: number): Promise<TransactionHistoryResponse>;
518
+ createNFT(data: CreateNFTRequest, image: File | Blob): Promise<{
519
+ success: boolean;
520
+ nft?: NFTResponse;
521
+ error?: string;
522
+ }>;
152
523
  /**
153
- * Get transaction status by hash
154
- * Fetches from blockchain explorers to check confirmation status
524
+ * Create a voucher for an NFT (EIP-712 signed)
155
525
  */
156
- getTransactionStatus(txHash: string, chain: NetworkType, network?: 'mainnet' | 'testnet'): Promise<TransactionStatusResponse>;
157
- }
158
- /**
159
- * Get or create the WDK API client instance
160
- */
161
- declare function getWdkApiClient(baseUrl?: string): WdkApiClient;
162
-
163
- /**
164
- * Browser-Compatible Address Derivation
165
- *
166
- * This module provides multi-chain address derivation that works in browser environments.
167
- * It uses the @scure libraries which are pure JS and don't require Node.js polyfills.
168
- *
169
- * Supported chains:
170
- * - Ethereum: ethers.js (BIP-44)
171
- * - Bitcoin: @scure/bip32 + @scure/base (BIP-84 native SegWit)
172
- * - Solana: ed25519-hd-key + tweetnacl (SLIP-0010)
173
- * - TON: ed25519 derivation with TON address format
174
- * - TRON: secp256k1 + base58check
175
- * - Spark: Bitcoin-based with custom derivation
176
- */
177
-
178
- interface ChainAddress$1 {
179
- chain: NetworkType;
180
- address: string;
181
- path: string;
182
- }
183
- interface BrowserMultiChainAddresses {
184
- ethereum: string | null;
185
- bitcoin: string | null;
186
- ton: string | null;
187
- tron: string | null;
188
- solana: string | null;
189
- spark: string | null;
190
- }
191
- /**
192
- * Derive Ethereum address from seed phrase
193
- */
194
- declare function deriveEthereumAddress(seed: string): string;
195
- /**
196
- * Derive Bitcoin address from seed phrase (BIP-84 native SegWit)
197
- * Uses @scure libraries for browser compatibility
198
- */
199
- declare function deriveBitcoinAddress(seed: string, network?: 'mainnet' | 'testnet'): string;
200
- /**
201
- * Derive Solana address from seed phrase using SLIP-0010 (ed25519)
202
- */
203
- declare function deriveSolanaAddress(seed: string): Promise<string>;
204
- /**
205
- * Derive TON address from seed phrase
206
- * Uses proper BIP-44 derivation path m/44'/607'/0'/0'/0'
207
- */
208
- declare function deriveTonAddress(seed: string): Promise<string>;
209
- /**
210
- * Derive TRON address from seed phrase
211
- * TRON uses secp256k1 like Ethereum but with base58check encoding
212
- * Uses @scure/base for browser compatibility
213
- */
214
- declare function deriveTronAddress(seed: string): string;
215
- /**
216
- * Derive Spark address from seed phrase
217
- * Spark uses its own derivation path and bech32 format
218
- * Uses @scure libraries for browser compatibility
219
- */
220
- declare function deriveSparkAddress(seed: string, network?: 'mainnet' | 'testnet'): string;
221
- /**
222
- * Derive addresses for all supported chains
223
- */
224
- declare function deriveAllAddresses(seed: string, network?: 'mainnet' | 'testnet'): Promise<BrowserMultiChainAddresses>;
225
- /**
226
- * Validate a BIP-39 seed phrase using @scure/bip39
227
- */
228
- declare function isValidSeed(seed: string): boolean;
229
- /**
230
- * Generate a random BIP-39 seed phrase using @scure/bip39
231
- */
232
- declare function generateSeedPhrase(): string;
233
-
234
- type BrowserAddressDerivation_BrowserMultiChainAddresses = BrowserMultiChainAddresses;
235
- declare const BrowserAddressDerivation_deriveAllAddresses: typeof deriveAllAddresses;
236
- declare const BrowserAddressDerivation_deriveBitcoinAddress: typeof deriveBitcoinAddress;
237
- declare const BrowserAddressDerivation_deriveEthereumAddress: typeof deriveEthereumAddress;
238
- declare const BrowserAddressDerivation_deriveSolanaAddress: typeof deriveSolanaAddress;
239
- declare const BrowserAddressDerivation_deriveSparkAddress: typeof deriveSparkAddress;
240
- declare const BrowserAddressDerivation_deriveTonAddress: typeof deriveTonAddress;
241
- declare const BrowserAddressDerivation_deriveTronAddress: typeof deriveTronAddress;
242
- declare const BrowserAddressDerivation_generateSeedPhrase: typeof generateSeedPhrase;
243
- declare const BrowserAddressDerivation_isValidSeed: typeof isValidSeed;
244
- declare namespace BrowserAddressDerivation {
245
- export { type BrowserAddressDerivation_BrowserMultiChainAddresses as BrowserMultiChainAddresses, type ChainAddress$1 as ChainAddress, BrowserAddressDerivation_deriveAllAddresses as deriveAllAddresses, BrowserAddressDerivation_deriveBitcoinAddress as deriveBitcoinAddress, BrowserAddressDerivation_deriveEthereumAddress as deriveEthereumAddress, BrowserAddressDerivation_deriveSolanaAddress as deriveSolanaAddress, BrowserAddressDerivation_deriveSparkAddress as deriveSparkAddress, BrowserAddressDerivation_deriveTonAddress as deriveTonAddress, BrowserAddressDerivation_deriveTronAddress as deriveTronAddress, BrowserAddressDerivation_generateSeedPhrase as generateSeedPhrase, BrowserAddressDerivation_isValidSeed as isValidSeed };
246
- }
247
-
248
- /**
249
- * Zubari WDK Service - Unified Multi-Chain Wallet Service
250
- *
251
- * This service provides a unified interface for multi-chain wallet operations
252
- * that works in both browser and Node.js environments.
253
- *
254
- * Strategy:
255
- * - Browser: Uses WdkApiClient to call the backend API (which has Tether WDK)
256
- * - Node.js: Uses WdkService natively (with Tether WDK modules)
257
- *
258
- * The Tether WDK (@tetherto/wdk-*) only works in Node.js environments due to
259
- * native dependencies (Electrum client, gRPC, etc.). For browser environments,
260
- * we route all operations through the backend API.
261
- *
262
- * @see https://docs.wallet.tether.io/
263
- */
264
- type SupportedChain = 'ethereum' | 'bitcoin' | 'ton' | 'tron' | 'solana' | 'spark';
265
- interface ChainAddress {
266
- chain: SupportedChain;
267
- address: string;
268
- path: string;
269
- }
270
- interface MultiChainAddresses {
271
- ethereum: string | null;
272
- bitcoin: string | null;
273
- ton: string | null;
274
- tron: string | null;
275
- solana: string | null;
276
- spark: string | null;
277
- }
278
- interface ChainBalance {
279
- chain: SupportedChain;
280
- address: string;
281
- balance: string;
282
- symbol: string;
283
- }
284
- interface FeeRates {
285
- slow: string;
286
- normal: string;
287
- fast: string;
288
- }
289
- interface TransactionResult$1 {
290
- success: boolean;
291
- txHash?: string;
292
- from?: string;
293
- to?: string;
294
- amount?: string;
295
- chain?: string;
296
- network?: string;
297
- error?: string;
298
- }
299
- interface ZubariWdkServiceConfig {
300
- /** Network to use (mainnet or testnet) */
301
- network: 'mainnet' | 'testnet';
302
- /** API URL for the Zubari backend (required for browser environments) */
303
- apiUrl?: string;
304
- /** Force using API even in Node.js (useful for testing) */
305
- forceApi?: boolean;
306
- /** Request timeout in milliseconds */
307
- timeout?: number;
308
- }
309
- /**
310
- * Check if we're running in a browser environment
311
- */
312
- declare function isBrowser(): boolean;
313
- /**
314
- * ZubariWdkService - Unified wallet service for browser and Node.js
315
- *
316
- * This service automatically routes operations to:
317
- * - API backend (browser) - using WdkApiClient
318
- * - Native WDK (Node.js) - using WdkService
319
- * - Browser derivation (fallback) - using BrowserAddressDerivation
320
- */
321
- declare class ZubariWdkService {
322
- private config;
323
- private apiClient;
324
- private nativeWdkService;
325
- private initialized;
326
- private useNativeWdk;
327
- constructor(config?: Partial<ZubariWdkServiceConfig>);
526
+ createVoucher(nftId: string, params: CreateVoucherRequest): Promise<CreateVoucherResponse>;
328
527
  /**
329
- * Initialize the service and determine the best strategy
528
+ * Redeem an NFT voucher (buy/mint)
330
529
  */
331
- initialize(): Promise<void>;
530
+ redeemVoucher(nftId: string, params: RedeemVoucherRequest): Promise<RedeemVoucherResponse>;
332
531
  /**
333
- * Get the current execution mode
532
+ * Get voucher status for an NFT
334
533
  */
335
- getMode(): 'api' | 'native' | 'browser-fallback';
534
+ getVoucherStatus(nftId: string): Promise<VoucherStatusResponse>;
336
535
  /**
337
- * Check if running in browser
536
+ * Get all active listings
338
537
  */
339
- isBrowserEnvironment(): boolean;
538
+ getListings(filters?: ListingFilters): Promise<ListingsResponse>;
340
539
  /**
341
- * Generate a new BIP-39 seed phrase (12 words)
540
+ * List an NFT for sale
342
541
  */
343
- generateSeed(): Promise<string>;
542
+ listItem(params: ListItemRequest): Promise<ListItemResponse>;
344
543
  /**
345
- * Validate a BIP-39 seed phrase
544
+ * Buy a listed NFT
346
545
  */
347
- validateSeed(seed: string): Promise<boolean>;
546
+ buyItem(params: BuyItemRequest): Promise<BuyItemResponse>;
348
547
  /**
349
- * Derive address for a specific chain using WDK API
350
- *
351
- * For Ethereum, falls back to local derivation if API fails.
352
- * For other chains, WDK API is required - no placeholder fallback.
548
+ * Cancel a listing
353
549
  */
354
- deriveAddress(seed: string, chain: SupportedChain): Promise<ChainAddress>;
550
+ cancelListing(params: CancelListingRequest): Promise<CancelListingResponse>;
355
551
  /**
356
- * Derive addresses for all supported chains using WDK API
357
- *
358
- * Uses the backend WDK API for real cryptographically valid addresses.
359
- * No placeholder fallback - WDK API is required for multi-chain addresses.
552
+ * Update listing price
360
553
  */
361
- deriveAllAddresses(seed: string): Promise<MultiChainAddresses>;
554
+ updateListingPrice(params: UpdatePriceRequest): Promise<UpdatePriceResponse>;
362
555
  /**
363
- * Get balances for all chains
556
+ * Get current user's listings
364
557
  */
365
- getAllBalances(seed: string): Promise<Record<string, ChainBalance | null>>;
558
+ getMyListings(filters?: Omit<ListingFilters, 'sellerId'>): Promise<ListingsResponse>;
366
559
  /**
367
- * Get fee rates for a chain
560
+ * Get marketplace statistics
368
561
  */
369
- getFeeRates(seed: string, chain: SupportedChain): Promise<FeeRates>;
562
+ getMarketStats(): Promise<MarketStatsResponse>;
370
563
  /**
371
- * Estimate transaction fee
564
+ * Send a tip to a creator
372
565
  */
373
- estimateFee(seed: string, chain: SupportedChain, to: string, amount: string): Promise<{
374
- fee: string;
375
- symbol: string;
376
- }>;
566
+ sendTip(params: SendTipRequest): Promise<SendTipResponse>;
377
567
  /**
378
- * Send a transaction
568
+ * Get tip statistics for current user
379
569
  */
380
- sendTransaction(seed: string, chain: SupportedChain, to: string, amount: string): Promise<TransactionResult$1>;
570
+ getTipStats(): Promise<TipStatsResponse>;
381
571
  /**
382
- * Get the network configuration
572
+ * Get tips sent by current user
383
573
  */
384
- getNetwork(): 'mainnet' | 'testnet';
574
+ getSentTips(filters?: TipFilters): Promise<TipsListResponse>;
385
575
  /**
386
- * Get API URL
576
+ * Get tips received by current user
387
577
  */
388
- getApiUrl(): string;
389
- private getDerivationPath;
390
- private getChainSymbol;
578
+ getReceivedTips(filters?: TipFilters): Promise<TipsListResponse>;
391
579
  /**
392
- * Derive address using browser-compatible libraries
580
+ * Get a single tip by ID
393
581
  */
394
- private deriveBrowserAddress;
582
+ getTip(tipId: string): Promise<{
583
+ success: boolean;
584
+ tip?: Tip;
585
+ error?: string;
586
+ }>;
395
587
  /**
396
- * Derive all addresses using browser-compatible libraries
588
+ * Update tip status (for transaction confirmation)
397
589
  */
398
- private deriveAllBrowserAddresses;
399
- }
400
- /**
401
- * Get or create the default ZubariWdkService instance
402
- */
403
- declare function getZubariWdkService(config?: Partial<ZubariWdkServiceConfig>): ZubariWdkService;
404
- /**
405
- * Create a new ZubariWdkService instance
406
- */
407
- declare function createZubariWdkService(config?: Partial<ZubariWdkServiceConfig>): ZubariWdkService;
408
-
409
- /**
410
- * Transaction Service for Zubari SDK
411
- *
412
- * Provides multi-chain transaction capabilities using Tether WDK.
413
- * Supports Ethereum, Bitcoin, Solana, TON, TRON, and Spark (Lightning).
414
- *
415
- * @see https://docs.wallet.tether.io/
416
- */
417
-
418
- /**
419
- * Transaction parameters for sending
420
- */
421
- interface TransactionParams {
422
- /** Recipient address */
423
- to: string;
424
- /** Amount to send (in human-readable format, e.g., "0.1") */
425
- amount: string;
426
- /** Token address (optional, for ERC-20/SPL tokens) */
427
- token?: string;
428
- /** Transaction memo/message (for chains that support it) */
429
- memo?: string;
430
- /** Fee priority: 'slow' | 'medium' | 'fast' */
431
- feePriority?: 'slow' | 'medium' | 'fast';
432
- /** Custom gas limit (EVM chains) */
433
- gasLimit?: string;
434
- /** Custom gas price (EVM chains) */
435
- gasPrice?: string;
436
- }
437
- /**
438
- * Transaction result with detailed information
439
- */
440
- interface TransactionResult {
441
- /** Transaction hash */
442
- hash: string;
443
- /** Network/chain */
444
- network: NetworkType;
445
- /** Transaction status */
446
- status: 'pending' | 'confirmed' | 'failed';
447
- /** Block number (when confirmed) */
448
- blockNumber?: number;
449
- /** Gas used (EVM chains) */
450
- gasUsed?: string;
451
- /** Fee paid */
452
- fee?: string;
453
- /** Explorer URL */
454
- explorerUrl?: string;
455
- /** Error message if failed */
456
- error?: string;
457
- /** Timestamp */
458
- timestamp: number;
459
- }
460
- /**
461
- * Transaction history item
462
- */
463
- interface TransactionHistoryItem {
464
- hash: string;
465
- network: NetworkType;
466
- type: 'send' | 'receive' | 'swap' | 'contract';
467
- from: string;
468
- to: string;
469
- amount: string;
470
- token?: string;
471
- fee?: string;
472
- status: 'pending' | 'confirmed' | 'failed';
473
- timestamp: number;
474
- blockNumber?: number;
475
- }
476
- /**
477
- * Fee estimate for a transaction
478
- */
479
- interface FeeEstimate {
480
- slow: {
481
- fee: string;
482
- estimatedTime: string;
483
- };
484
- medium: {
485
- fee: string;
486
- estimatedTime: string;
487
- };
488
- fast: {
489
- fee: string;
490
- estimatedTime: string;
491
- };
492
- }
493
- /**
494
- * Transaction Service configuration
495
- */
496
- interface TransactionServiceConfig {
497
- network: 'mainnet' | 'testnet';
498
- rpcUrls?: Partial<Record<NetworkType, string>>;
499
- }
500
- /**
501
- * Transaction Service
502
- *
503
- * Provides multi-chain transaction capabilities:
504
- * - Send native tokens (ETH, BTC, SOL, TON, TRX)
505
- * - Send ERC-20/SPL tokens
506
- * - Fee estimation
507
- * - Transaction history
508
- */
509
- declare class TransactionService {
510
- private seed;
511
- private config;
512
- private wallets;
513
- constructor(config?: Partial<TransactionServiceConfig>);
590
+ updateTipStatus(tipId: string, params: UpdateTipStatusRequest): Promise<{
591
+ success: boolean;
592
+ tip?: Tip;
593
+ message?: string;
594
+ error?: string;
595
+ }>;
514
596
  /**
515
- * Ensure WDK modules are loaded
597
+ * Create a new subscription plan (creator only)
516
598
  */
517
- private ensureLoaded;
599
+ createSubscriptionPlan(params: CreatePlanRequest): Promise<CreatePlanResponse>;
518
600
  /**
519
- * Get RPC URL for a chain
601
+ * Get current user's subscription plans
520
602
  */
521
- private getRpcUrl;
603
+ getMySubscriptionPlans(): Promise<{
604
+ success: boolean;
605
+ plans?: SubscriptionPlan[];
606
+ error?: string;
607
+ }>;
522
608
  /**
523
- * Get explorer URL for a transaction
609
+ * Get subscription plan by ID
524
610
  */
525
- getExplorerUrl(chain: NetworkType, txHash: string): string;
611
+ getSubscriptionPlan(planId: string): Promise<{
612
+ success: boolean;
613
+ plan?: SubscriptionPlan & {
614
+ isSubscribed?: boolean;
615
+ };
616
+ error?: string;
617
+ }>;
526
618
  /**
527
- * Initialize the service with a seed phrase
619
+ * Delete/deactivate subscription plan
528
620
  */
529
- initialize(seed: string): Promise<void>;
621
+ deleteSubscriptionPlan(planId: string): Promise<{
622
+ success: boolean;
623
+ message?: string;
624
+ deactivated?: boolean;
625
+ error?: string;
626
+ }>;
530
627
  /**
531
- * Check if service is initialized
628
+ * Subscribe to a plan
532
629
  */
533
- isInitialized(): boolean;
630
+ subscribe(params: SubscribeRequest): Promise<SubscribeResponse>;
534
631
  /**
535
- * Get or create wallet instance for a specific chain
632
+ * Get current user's subscriptions (as subscriber)
536
633
  */
537
- private getWallet;
634
+ getMySubscriptions(filters?: SubscriptionFilters): Promise<SubscriptionListResponse>;
538
635
  /**
539
- * Estimate transaction fee
636
+ * Get subscribers to current user's plans (as creator)
540
637
  */
541
- estimateFee(chain: NetworkType, params: TransactionParams): Promise<FeeEstimate>;
638
+ getMySubscribers(filters?: SubscriptionFilters): Promise<SubscriptionListResponse>;
542
639
  /**
543
- * Send a transaction
640
+ * Cancel subscription
544
641
  */
545
- send(chain: NetworkType, params: TransactionParams): Promise<TransactionResult>;
642
+ cancelSubscription(subscriptionId: string): Promise<{
643
+ success: boolean;
644
+ message?: string;
645
+ error?: string;
646
+ }>;
546
647
  /**
547
- * Get transaction status
648
+ * Create a subscription plan on-chain
548
649
  */
549
- getTransactionStatus(chain: NetworkType, txHash: string): Promise<TransactionResult>;
650
+ createSubscriptionPlanOnChain(params: ContractCreatePlanRequest): Promise<ContractCreatePlanResponse>;
550
651
  /**
551
- * Get transaction history for an address
652
+ * Subscribe to a plan on-chain
552
653
  */
553
- getTransactionHistory(chain: NetworkType, limit?: number): Promise<TransactionHistoryItem[]>;
654
+ subscribeOnChain(params: ContractSubscribeRequest): Promise<ContractSubscribeResponse>;
554
655
  /**
555
- * Get balance for a specific chain
656
+ * Cancel subscription on-chain
556
657
  */
557
- getBalance(chain: NetworkType): Promise<{
558
- balance: string;
559
- balanceUsd: number;
658
+ cancelSubscriptionOnChain(subscriptionId: string, seed: string): Promise<{
659
+ success: boolean;
660
+ transactionHash?: string;
661
+ message?: string;
662
+ error?: string;
560
663
  }>;
561
664
  /**
562
- * Get the current network configuration
665
+ * Check if user is subscribed to a creator on-chain
666
+ */
667
+ isSubscribed(subscriber: string, creator: string): Promise<IsSubscribedResponse>;
668
+ /**
669
+ * Get subscription platform fee
670
+ */
671
+ getSubscriptionPlatformFee(): Promise<PlatformFeeResponse>;
672
+ /**
673
+ * Get pending and claimed earnings for the authenticated user
674
+ */
675
+ getEarnings(): Promise<EarningsResponse>;
676
+ /**
677
+ * Claim pending earnings
678
+ */
679
+ claimEarnings(params: ClaimEarningsRequest): Promise<ClaimEarningsResponse>;
680
+ /**
681
+ * Get payout history for the authenticated user
682
+ */
683
+ getPayoutHistory(filters?: {
684
+ page?: number;
685
+ limit?: number;
686
+ }): Promise<PayoutHistoryResponse>;
687
+ /**
688
+ * Get earnings breakdown by source
563
689
  */
564
- getNetwork(): 'mainnet' | 'testnet';
690
+ getEarningsBreakdown(): Promise<EarningsBreakdownResponse>;
565
691
  /**
566
- * Clean up and dispose of wallet instances
692
+ * Get current platform fee for payouts
567
693
  */
568
- dispose(): void;
694
+ getPayoutsPlatformFee(): Promise<PlatformFeeResponse>;
569
695
  }
570
696
  /**
571
- * Get or create the Transaction service singleton
697
+ * Get or create the Zubari API client instance
572
698
  */
573
- declare function getTransactionService(config?: Partial<TransactionServiceConfig>): TransactionService;
699
+ declare function getZubariApiClient(config?: Partial<ZubariApiConfig>): ZubariApiClient;
574
700
  /**
575
- * Create a new Transaction service instance (non-singleton)
701
+ * Create a new Zubari API client instance
576
702
  */
577
- declare function createTransactionService(config?: Partial<TransactionServiceConfig>): TransactionService;
703
+ declare function createZubariApiClient(config: ZubariApiConfig): ZubariApiClient;
578
704
 
579
- export { BrowserAddressDerivation, type ChainAddress$1 as BrowserChainAddress, type BrowserMultiChainAddresses, type ChainAddress, type ChainBalance, type DeriveAddressResponse, type DeriveAllAddressesResponse, type FeeEstimate, type FeeRates, type GenerateSeedResponse, type MultiChainAddresses, type SendTransactionResponse, type SupportedChain, SwapService, type TransactionHistoryItem, type TransactionHistoryResponse, type TransactionParams, type TransactionResult, TransactionService, type TransactionServiceConfig, type TransactionStatusResponse, type ValidateSeedResponse, WdkApiClient, type WdkApiConfig, type TransactionHistoryItem$1 as WdkTransactionHistoryItem, type TransactionResult$1 as WdkTransactionResult, ZubariWdkService, type ZubariWdkServiceConfig, createTransactionService, createZubariWdkService, getTransactionService, getWdkApiClient, getZubariWdkService, isBrowser };
705
+ export { type BuyItemRequest, type BuyItemResponse, type CancelListingRequest, type CancelListingResponse, type ClaimEarningsRequest, type ClaimEarningsResponse, type ContractCreatePlanRequest, type ContractCreatePlanResponse, type ContractSubscribeRequest, type ContractSubscribeResponse, type CreateNFTRequest, type CreatePlanRequest, type CreatePlanResponse, type CreateVoucherRequest, type CreateVoucherResponse, type EarningsBreakdownResponse, type EarningsResponse, type IsSubscribedResponse, type ListItemRequest, type ListItemResponse, type ListingFilters, type ListingsResponse, type MarketListing, type MarketStatsResponse, type NFTFilters, type NFTListResponse, type NFTResponse, type NFTVoucher, type PayoutHistoryResponse, type PlatformFeeResponse, type RedeemVoucherRequest, type RedeemVoucherResponse, type SendTipRequest, type SendTipResponse, type SubscribeRequest, type SubscribeResponse, type Subscription, type SubscriptionFilters, type SubscriptionListResponse, type SubscriptionPlan, type Tip, type TipFilters, type TipStatsResponse, type TipUser, type TipsListResponse, type UpdatePriceRequest, type UpdatePriceResponse, type UpdateTipStatusRequest, type VoucherStatusResponse, ZubariApiClient, type ZubariApiConfig, createZubariApiClient, getZubariApiClient };