@zubari/sdk 0.2.5 → 0.2.7

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.
@@ -212,6 +212,276 @@ interface ListingFilters {
212
212
  page?: number;
213
213
  limit?: number;
214
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;
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;
363
+ error?: string;
364
+ }
365
+ interface SubscriptionListResponse {
366
+ success: boolean;
367
+ subscriptions?: Subscription[];
368
+ pagination?: {
369
+ page: number;
370
+ limit: number;
371
+ total: number;
372
+ totalPages: number;
373
+ };
374
+ stats?: {
375
+ totalSubscribers: number;
376
+ };
377
+ error?: string;
378
+ }
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 {
390
+ success: boolean;
391
+ transactionHash?: string;
392
+ subscription?: Subscription;
393
+ message?: string;
394
+ error?: string;
395
+ }
396
+ interface ContractCreatePlanRequest {
397
+ name: string;
398
+ description?: string;
399
+ price: string;
400
+ paymentToken?: string;
401
+ durationDays?: number;
402
+ maxSubscribers?: number;
403
+ seed: string;
404
+ }
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 {
422
+ success: boolean;
423
+ address?: 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
+ }>;
438
+ error?: string;
439
+ }
440
+ interface ClaimEarningsRequest {
441
+ seed: string;
442
+ }
443
+ interface ClaimEarningsResponse {
444
+ success: boolean;
445
+ transactionHash?: string;
446
+ amount?: string;
447
+ message?: string;
448
+ error?: string;
449
+ }
450
+ interface PayoutHistoryResponse {
451
+ success: boolean;
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
+ };
483
+ error?: string;
484
+ }
215
485
  /**
216
486
  * Zubari API Client for backend integration
217
487
  */
@@ -290,6 +560,138 @@ declare class ZubariApiClient {
290
560
  * Get marketplace statistics
291
561
  */
292
562
  getMarketStats(): Promise<MarketStatsResponse>;
563
+ /**
564
+ * Send a tip to a creator
565
+ */
566
+ sendTip(params: SendTipRequest): Promise<SendTipResponse>;
567
+ /**
568
+ * Get tip statistics for current user
569
+ */
570
+ getTipStats(): Promise<TipStatsResponse>;
571
+ /**
572
+ * Get tips sent by current user
573
+ */
574
+ getSentTips(filters?: TipFilters): Promise<TipsListResponse>;
575
+ /**
576
+ * Get tips received by current user
577
+ */
578
+ getReceivedTips(filters?: TipFilters): Promise<TipsListResponse>;
579
+ /**
580
+ * Get a single tip by ID
581
+ */
582
+ getTip(tipId: string): Promise<{
583
+ success: boolean;
584
+ tip?: Tip;
585
+ error?: string;
586
+ }>;
587
+ /**
588
+ * Update tip status (for transaction confirmation)
589
+ */
590
+ updateTipStatus(tipId: string, params: UpdateTipStatusRequest): Promise<{
591
+ success: boolean;
592
+ tip?: Tip;
593
+ message?: string;
594
+ error?: string;
595
+ }>;
596
+ /**
597
+ * Create a new subscription plan (creator only)
598
+ */
599
+ createSubscriptionPlan(params: CreatePlanRequest): Promise<CreatePlanResponse>;
600
+ /**
601
+ * Get current user's subscription plans
602
+ */
603
+ getMySubscriptionPlans(): Promise<{
604
+ success: boolean;
605
+ plans?: SubscriptionPlan[];
606
+ error?: string;
607
+ }>;
608
+ /**
609
+ * Get subscription plan by ID
610
+ */
611
+ getSubscriptionPlan(planId: string): Promise<{
612
+ success: boolean;
613
+ plan?: SubscriptionPlan & {
614
+ isSubscribed?: boolean;
615
+ };
616
+ error?: string;
617
+ }>;
618
+ /**
619
+ * Delete/deactivate subscription plan
620
+ */
621
+ deleteSubscriptionPlan(planId: string): Promise<{
622
+ success: boolean;
623
+ message?: string;
624
+ deactivated?: boolean;
625
+ error?: string;
626
+ }>;
627
+ /**
628
+ * Subscribe to a plan
629
+ */
630
+ subscribe(params: SubscribeRequest): Promise<SubscribeResponse>;
631
+ /**
632
+ * Get current user's subscriptions (as subscriber)
633
+ */
634
+ getMySubscriptions(filters?: SubscriptionFilters): Promise<SubscriptionListResponse>;
635
+ /**
636
+ * Get subscribers to current user's plans (as creator)
637
+ */
638
+ getMySubscribers(filters?: SubscriptionFilters): Promise<SubscriptionListResponse>;
639
+ /**
640
+ * Cancel subscription
641
+ */
642
+ cancelSubscription(subscriptionId: string): Promise<{
643
+ success: boolean;
644
+ message?: string;
645
+ error?: string;
646
+ }>;
647
+ /**
648
+ * Create a subscription plan on-chain
649
+ */
650
+ createSubscriptionPlanOnChain(params: ContractCreatePlanRequest): Promise<ContractCreatePlanResponse>;
651
+ /**
652
+ * Subscribe to a plan on-chain
653
+ */
654
+ subscribeOnChain(params: ContractSubscribeRequest): Promise<ContractSubscribeResponse>;
655
+ /**
656
+ * Cancel subscription on-chain
657
+ */
658
+ cancelSubscriptionOnChain(subscriptionId: string, seed: string): Promise<{
659
+ success: boolean;
660
+ transactionHash?: string;
661
+ message?: string;
662
+ error?: string;
663
+ }>;
664
+ /**
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
689
+ */
690
+ getEarningsBreakdown(): Promise<EarningsBreakdownResponse>;
691
+ /**
692
+ * Get current platform fee for payouts
693
+ */
694
+ getPayoutsPlatformFee(): Promise<PlatformFeeResponse>;
293
695
  }
294
696
  /**
295
697
  * Get or create the Zubari API client instance
@@ -300,4 +702,4 @@ declare function getZubariApiClient(config?: Partial<ZubariApiConfig>): ZubariAp
300
702
  */
301
703
  declare function createZubariApiClient(config: ZubariApiConfig): ZubariApiClient;
302
704
 
303
- export { type BuyItemRequest, type BuyItemResponse, type CancelListingRequest, type CancelListingResponse, type CreateNFTRequest, type CreateVoucherRequest, type CreateVoucherResponse, type ListItemRequest, type ListItemResponse, type ListingFilters, type ListingsResponse, type MarketListing, type MarketStatsResponse, type NFTFilters, type NFTListResponse, type NFTResponse, type NFTVoucher, type RedeemVoucherRequest, type RedeemVoucherResponse, type UpdatePriceRequest, type UpdatePriceResponse, type VoucherStatusResponse, ZubariApiClient, type ZubariApiConfig, createZubariApiClient, getZubariApiClient };
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 };