@zubari/sdk 0.1.29 → 0.1.31

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,4 +1,4 @@
1
- import { c as NFTMetadata, L as LazyMintVoucher, b as TxResult, e as ListingParams, d as NFT, B as BuyParams, f as Listing, g as TipData, h as TipResult, i as TipStats, j as SubscriptionPlan, k as Subscription, E as EarningsBreakdown, R as RevenueSplit } from '../index-IPLQBUaD.js';
1
+ import { c as NFTMetadata, L as LazyMintVoucher, b as TxResult, e as ListingParams, d as NFT, B as BuyParams, f as Listing, j as Tip, k as SubscriptionPlan, l as Subscription, E as EarningsBreakdown, R as RevenueSplit } from '../index-6y3uV1Sh.js';
2
2
 
3
3
  /**
4
4
  * ZubariNFTProtocol - NFT creation and marketplace operations
@@ -203,89 +203,389 @@ declare class ZubariMarketProtocol {
203
203
  * ZubariTipsProtocol - Micropayment tips for creators
204
204
  *
205
205
  * Handles ETH and ERC-20 token tips with platform fee distribution.
206
- * Supports gasless tips via ERC-4337 when enabled.
206
+ * Supports individual tips, batch tips, and tip queries.
207
207
  */
208
208
  declare class ZubariTipsProtocol {
209
209
  private readonly contractAddress;
210
210
  private readonly chainId;
211
- private readonly gaslessEnabled;
212
- constructor(contractAddress: string, chainId: number, gaslessEnabled?: boolean);
211
+ private readonly abi;
212
+ constructor(contractAddress: string, chainId: number);
213
213
  /**
214
- * Send a tip to a creator
214
+ * Get the contract ABI
215
215
  */
216
- sendTip(tip: TipData): Promise<TipResult>;
216
+ getAbi(): ({
217
+ inputs: {
218
+ internalType: string;
219
+ name: string;
220
+ type: string;
221
+ }[];
222
+ stateMutability: string;
223
+ type: string;
224
+ name?: undefined;
225
+ anonymous?: undefined;
226
+ outputs?: undefined;
227
+ } | {
228
+ inputs: {
229
+ internalType: string;
230
+ name: string;
231
+ type: string;
232
+ }[];
233
+ name: string;
234
+ type: string;
235
+ stateMutability?: undefined;
236
+ anonymous?: undefined;
237
+ outputs?: undefined;
238
+ } | {
239
+ anonymous: boolean;
240
+ inputs: {
241
+ indexed: boolean;
242
+ internalType: string;
243
+ name: string;
244
+ type: string;
245
+ }[];
246
+ name: string;
247
+ type: string;
248
+ stateMutability?: undefined;
249
+ outputs?: undefined;
250
+ } | {
251
+ inputs: {
252
+ internalType: string;
253
+ name: string;
254
+ type: string;
255
+ }[];
256
+ name: string;
257
+ outputs: {
258
+ components: {
259
+ internalType: string;
260
+ name: string;
261
+ type: string;
262
+ }[];
263
+ internalType: string;
264
+ name: string;
265
+ type: string;
266
+ }[];
267
+ stateMutability: string;
268
+ type: string;
269
+ anonymous?: undefined;
270
+ } | {
271
+ inputs: {
272
+ internalType: string;
273
+ name: string;
274
+ type: string;
275
+ }[];
276
+ name: string;
277
+ outputs: {
278
+ internalType: string;
279
+ name: string;
280
+ type: string;
281
+ }[];
282
+ stateMutability: string;
283
+ type: string;
284
+ anonymous?: undefined;
285
+ })[];
217
286
  /**
218
- * Send tips to multiple creators in a single transaction
287
+ * Get the contract address
219
288
  */
220
- sendBatchTips(tips: TipData[]): Promise<TipResult[]>;
289
+ getAddress(): string;
221
290
  /**
222
- * Get tips received by an address
291
+ * Send ETH tip to a creator
292
+ * @param recipient The recipient address
293
+ * @param message Optional tip message
294
+ * @param signer Wallet signer with sendTransaction method
295
+ * @param value ETH amount to tip (in wei)
223
296
  */
224
- getTipsReceived(address: string): Promise<TipResult[]>;
297
+ tipETH(recipient: string, message: string, signer: {
298
+ sendTransaction: (tx: object) => Promise<{
299
+ hash: string;
300
+ }>;
301
+ }, value: bigint): Promise<TxResult>;
225
302
  /**
226
- * Get tips sent by an address
303
+ * Send ERC-20 token tip to a creator
304
+ * @param recipient The recipient address
305
+ * @param token The ERC-20 token address
306
+ * @param amount The amount of tokens to tip
307
+ * @param message Optional tip message
308
+ * @param signer Wallet signer
227
309
  */
228
- getTipsSent(address: string): Promise<TipResult[]>;
310
+ tipToken(recipient: string, token: string, amount: bigint, message: string, signer: {
311
+ sendTransaction: (tx: object) => Promise<{
312
+ hash: string;
313
+ }>;
314
+ }): Promise<TxResult>;
229
315
  /**
230
- * Get tip statistics for a creator
316
+ * Send batch tips to multiple creators in a single transaction
317
+ * @param recipients Array of recipient addresses
318
+ * @param amounts Array of tip amounts (in wei)
319
+ * @param messages Array of tip messages
320
+ * @param signer Wallet signer
321
+ * @param value Total ETH to send
231
322
  */
232
- getCreatorTipStats(creator: string): Promise<TipStats>;
323
+ sendBatchTips(recipients: string[], amounts: bigint[], messages: string[], signer: {
324
+ sendTransaction: (tx: object) => Promise<{
325
+ hash: string;
326
+ }>;
327
+ }, value: bigint): Promise<TxResult>;
328
+ /**
329
+ * Get tip details by ID
330
+ * @param tipId The tip ID
331
+ * @param provider JSON-RPC provider
332
+ */
333
+ getTip(tipId: string, provider: {
334
+ call: (tx: object) => Promise<string>;
335
+ }): Promise<Tip | null>;
336
+ /**
337
+ * Get total tips received by an address
338
+ * @param address The address to query
339
+ * @param provider JSON-RPC provider
340
+ */
341
+ getTotalTipsReceived(address: string, provider: {
342
+ call: (tx: object) => Promise<string>;
343
+ }): Promise<bigint>;
233
344
  /**
234
345
  * Get platform fee in basis points
346
+ * @param provider JSON-RPC provider
347
+ */
348
+ getPlatformFeeBps(provider: {
349
+ call: (tx: object) => Promise<string>;
350
+ }): Promise<number>;
351
+ /**
352
+ * Get current tip counter
353
+ * @param provider JSON-RPC provider
354
+ */
355
+ getTipCounter(provider: {
356
+ call: (tx: object) => Promise<string>;
357
+ }): Promise<bigint>;
358
+ /**
359
+ * Get treasury address
360
+ * @param provider JSON-RPC provider
235
361
  */
236
- getPlatformFeeBps(): number;
362
+ getTreasury(provider: {
363
+ call: (tx: object) => Promise<string>;
364
+ }): Promise<string>;
365
+ /**
366
+ * Calculate platform fee for a given amount
367
+ * @param amount The tip amount
368
+ * @param feeBps Fee in basis points (default: 300 = 3%)
369
+ */
370
+ calculateFee(amount: bigint, feeBps?: number): {
371
+ fee: bigint;
372
+ creatorAmount: bigint;
373
+ };
237
374
  }
238
375
 
239
376
  /**
240
377
  * ZubariSubscriptionProtocol - Recurring subscription payments
241
378
  *
242
379
  * Handles subscription plan creation, subscription management,
243
- * and verification of active subscriptions.
380
+ * and verification of active subscriptions using the ZubariSubscription smart contract.
244
381
  */
245
382
  declare class ZubariSubscriptionProtocol {
246
383
  private readonly contractAddress;
247
384
  private readonly chainId;
385
+ private readonly abi;
248
386
  constructor(contractAddress: string, chainId: number);
387
+ /**
388
+ * Get the contract ABI
389
+ */
390
+ getAbi(): ({
391
+ inputs: {
392
+ internalType: string;
393
+ name: string;
394
+ type: string;
395
+ }[];
396
+ stateMutability: string;
397
+ type: string;
398
+ name?: undefined;
399
+ anonymous?: undefined;
400
+ outputs?: undefined;
401
+ } | {
402
+ inputs: {
403
+ internalType: string;
404
+ name: string;
405
+ type: string;
406
+ }[];
407
+ name: string;
408
+ type: string;
409
+ stateMutability?: undefined;
410
+ anonymous?: undefined;
411
+ outputs?: undefined;
412
+ } | {
413
+ anonymous: boolean;
414
+ inputs: {
415
+ indexed: boolean;
416
+ internalType: string;
417
+ name: string;
418
+ type: string;
419
+ }[];
420
+ name: string;
421
+ type: string;
422
+ stateMutability?: undefined;
423
+ outputs?: undefined;
424
+ } | {
425
+ inputs: {
426
+ internalType: string;
427
+ name: string;
428
+ type: string;
429
+ }[];
430
+ name: string;
431
+ outputs: {
432
+ internalType: string;
433
+ name: string;
434
+ type: string;
435
+ }[];
436
+ stateMutability: string;
437
+ type: string;
438
+ anonymous?: undefined;
439
+ } | {
440
+ inputs: {
441
+ internalType: string;
442
+ name: string;
443
+ type: string;
444
+ }[];
445
+ name: string;
446
+ outputs: {
447
+ components: {
448
+ internalType: string;
449
+ name: string;
450
+ type: string;
451
+ }[];
452
+ internalType: string;
453
+ name: string;
454
+ type: string;
455
+ }[];
456
+ stateMutability: string;
457
+ type: string;
458
+ anonymous?: undefined;
459
+ })[];
460
+ /**
461
+ * Get the contract address
462
+ */
463
+ getAddress(): string;
249
464
  /**
250
465
  * Create a new subscription plan
466
+ * @param plan The plan details
467
+ * @param signer Wallet signer with sendTransaction method
251
468
  */
252
- createPlan(plan: SubscriptionPlan): Promise<string>;
469
+ createPlan(plan: SubscriptionPlan, signer: {
470
+ sendTransaction: (tx: object) => Promise<{
471
+ hash: string;
472
+ }>;
473
+ }): Promise<string>;
253
474
  /**
254
- * Update an existing subscription plan
475
+ * Deactivate a subscription plan (only creator can do this)
476
+ * @param planId The plan ID to deactivate
477
+ * @param signer Wallet signer
255
478
  */
256
- updatePlan(planId: string, updates: Partial<SubscriptionPlan>): Promise<TxResult>;
479
+ deactivatePlan(planId: string, signer: {
480
+ sendTransaction: (tx: object) => Promise<{
481
+ hash: string;
482
+ }>;
483
+ }): Promise<TxResult>;
257
484
  /**
258
485
  * Subscribe to a creator's plan
486
+ * @param planId The plan ID to subscribe to
487
+ * @param months Number of months to subscribe
488
+ * @param signer Wallet signer
489
+ * @param value ETH value to send (if paying with ETH)
259
490
  */
260
- subscribe(creator: string, planId: string, months?: number): Promise<Subscription>;
491
+ subscribe(planId: string, months: number, signer: {
492
+ sendTransaction: (tx: object) => Promise<{
493
+ hash: string;
494
+ }>;
495
+ }, value?: bigint): Promise<TxResult>;
261
496
  /**
262
497
  * Cancel an active subscription
498
+ * @param subscriptionId The subscription ID to cancel
499
+ * @param signer Wallet signer
263
500
  */
264
- cancel(subscriptionId: string): Promise<TxResult>;
501
+ cancel(subscriptionId: string, signer: {
502
+ sendTransaction: (tx: object) => Promise<{
503
+ hash: string;
504
+ }>;
505
+ }): Promise<TxResult>;
506
+ /**
507
+ * Set auto-renew for a subscription
508
+ * @param subscriptionId The subscription ID
509
+ * @param autoRenew Whether to enable auto-renew
510
+ * @param signer Wallet signer
511
+ */
512
+ setAutoRenew(subscriptionId: string, autoRenew: boolean, signer: {
513
+ sendTransaction: (tx: object) => Promise<{
514
+ hash: string;
515
+ }>;
516
+ }): Promise<TxResult>;
265
517
  /**
266
518
  * Check if an address is subscribed to a creator
519
+ * @param subscriber The subscriber address
520
+ * @param creator The creator address
521
+ * @param provider JSON-RPC provider
267
522
  */
268
- isSubscribed(creator: string, subscriber?: string): Promise<boolean>;
523
+ isSubscribed(subscriber: string, creator: string, provider: {
524
+ call: (tx: object) => Promise<string>;
525
+ }): Promise<boolean>;
269
526
  /**
270
- * Get active subscriptions for a subscriber
527
+ * Get the active subscription ID between subscriber and creator
528
+ * @param subscriber The subscriber address
529
+ * @param creator The creator address
530
+ * @param provider JSON-RPC provider
271
531
  */
272
- getActiveSubscriptions(subscriber?: string): Promise<Subscription[]>;
532
+ getActiveSubscriptionId(subscriber: string, creator: string, provider: {
533
+ call: (tx: object) => Promise<string>;
534
+ }): Promise<string | null>;
273
535
  /**
274
- * Get all subscribers for a creator
536
+ * Get subscription details by ID
537
+ * @param subscriptionId The subscription ID
538
+ * @param provider JSON-RPC provider
275
539
  */
276
- getSubscribers(creator: string): Promise<Subscription[]>;
540
+ getSubscription(subscriptionId: string, provider: {
541
+ call: (tx: object) => Promise<string>;
542
+ }): Promise<Subscription | null>;
277
543
  /**
278
544
  * Get a specific plan by ID
545
+ * @param planId The plan ID
546
+ * @param provider JSON-RPC provider
279
547
  */
280
- getPlan(planId: string): Promise<SubscriptionPlan | null>;
548
+ getPlan(planId: string, provider: {
549
+ call: (tx: object) => Promise<string>;
550
+ }): Promise<SubscriptionPlan | null>;
281
551
  /**
282
- * Get all plans for a creator
552
+ * Get all plan IDs for a creator
553
+ * @param creator The creator address
554
+ * @param provider JSON-RPC provider
283
555
  */
284
- getCreatorPlans(creator: string): Promise<SubscriptionPlan[]>;
556
+ getCreatorPlanIds(creator: string, provider: {
557
+ call: (tx: object) => Promise<string>;
558
+ }): Promise<string[]>;
559
+ /**
560
+ * Get all plans for a creator with full details
561
+ * @param creator The creator address
562
+ * @param provider JSON-RPC provider
563
+ */
564
+ getCreatorPlans(creator: string, provider: {
565
+ call: (tx: object) => Promise<string>;
566
+ }): Promise<SubscriptionPlan[]>;
567
+ /**
568
+ * Get platform fee in basis points
569
+ * @param provider JSON-RPC provider
570
+ */
571
+ getPlatformFeeBps(provider: {
572
+ call: (tx: object) => Promise<string>;
573
+ }): Promise<number>;
285
574
  /**
286
- * Generate a unique plan ID
575
+ * Calculate the total cost for a subscription
576
+ * @param planPrice The plan price per period
577
+ * @param months Number of months
287
578
  */
288
- private generatePlanId;
579
+ calculateSubscriptionCost(planPrice: bigint, months: number): bigint;
580
+ /**
581
+ * Calculate platform fee for a given amount
582
+ * @param amount The amount
583
+ * @param feeBps Fee in basis points
584
+ */
585
+ calculateFee(amount: bigint, feeBps?: number): {
586
+ fee: bigint;
587
+ creatorAmount: bigint;
588
+ };
289
589
  }
290
590
 
291
591
  /**