@zubari/sdk 0.2.2 → 0.2.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.
@@ -1,4 +1,4 @@
1
- import { C as CreateVoucherParams, L as LazyMintVoucher, e as NFTMetadata, b as TxResult, g as ListingParams, f as NFT, B as BuyParams, h as Listing, l as Tip, m as SubscriptionPlan, n as Subscription, E as EarningsBreakdown, R as RevenueSplit } from '../index-Be7yLGAO.mjs';
1
+ import { C as CreateVoucherParams, L as LazyMintVoucher, e as NFTMetadata, b as TxResult, g as ListingParams, f as NFT, B as BuyParams, h as Listing, l as Tip, m as SubscriptionPlan, n as Subscription, E as EarningsBreakdown, s as EarningsResponse, P as PayoutHistoryResponse, t as BreakdownResponse, u as PlatformFeeResponse, v as ClaimResult, R as RevenueSplit } from '../index-Bou-9cAG.mjs';
2
2
 
3
3
  /**
4
4
  * ZubariNFTProtocol - NFT creation and marketplace operations
@@ -627,17 +627,42 @@ declare class ZubariSubscriptionProtocol {
627
627
  declare class ZubariPayoutsProtocol {
628
628
  private readonly contractAddress;
629
629
  private readonly chainId;
630
- constructor(contractAddress: string, chainId: number);
630
+ private readonly apiBaseUrl;
631
+ constructor(contractAddress: string, chainId: number, apiBaseUrl?: string);
631
632
  /**
632
- * Get pending earnings breakdown for the current user
633
+ * Get pending earnings breakdown for the current user (on-chain)
633
634
  */
634
635
  getPendingEarnings(): Promise<EarningsBreakdown>;
636
+ /**
637
+ * Get earnings data from API (includes pending, total, breakdown, and recent payouts)
638
+ * Requires authentication token
639
+ */
640
+ getEarnings(authToken: string): Promise<EarningsResponse>;
641
+ /**
642
+ * Get payout history with pagination
643
+ * Requires authentication token
644
+ */
645
+ getPayoutHistory(authToken: string, page?: number, limit?: number): Promise<PayoutHistoryResponse>;
646
+ /**
647
+ * Get earnings breakdown by source with percentages
648
+ * Requires authentication token
649
+ */
650
+ getBreakdown(authToken: string): Promise<BreakdownResponse>;
651
+ /**
652
+ * Get current platform fee
653
+ */
654
+ getPlatformFee(): Promise<PlatformFeeResponse>;
635
655
  /**
636
656
  * Get historical earnings for a time period
637
657
  */
638
658
  getEarningsHistory(period?: 'day' | 'week' | 'month' | 'all'): Promise<EarningsBreakdown[]>;
639
659
  /**
640
- * Claim all pending earnings
660
+ * Claim all pending earnings via API
661
+ * Requires authentication token and seed phrase
662
+ */
663
+ claimEarningsViaApi(authToken: string, seed: string): Promise<ClaimResult>;
664
+ /**
665
+ * Claim all pending earnings (direct contract call)
641
666
  */
642
667
  claimEarnings(): Promise<TxResult>;
643
668
  /**
@@ -661,6 +686,14 @@ declare class ZubariPayoutsProtocol {
661
686
  * Convert earnings to stablecoin (USDT)
662
687
  */
663
688
  convertToStable(token: string, amount: bigint): Promise<TxResult>;
689
+ /**
690
+ * Get the contract address
691
+ */
692
+ getContractAddress(): string;
693
+ /**
694
+ * Get the chain ID
695
+ */
696
+ getChainId(): number;
664
697
  }
665
698
 
666
699
  export { ZubariMarketProtocol, ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol };
@@ -1,4 +1,4 @@
1
- import { C as CreateVoucherParams, L as LazyMintVoucher, e as NFTMetadata, b as TxResult, g as ListingParams, f as NFT, B as BuyParams, h as Listing, l as Tip, m as SubscriptionPlan, n as Subscription, E as EarningsBreakdown, R as RevenueSplit } from '../index-Be7yLGAO.js';
1
+ import { C as CreateVoucherParams, L as LazyMintVoucher, e as NFTMetadata, b as TxResult, g as ListingParams, f as NFT, B as BuyParams, h as Listing, l as Tip, m as SubscriptionPlan, n as Subscription, E as EarningsBreakdown, s as EarningsResponse, P as PayoutHistoryResponse, t as BreakdownResponse, u as PlatformFeeResponse, v as ClaimResult, R as RevenueSplit } from '../index-Bou-9cAG.js';
2
2
 
3
3
  /**
4
4
  * ZubariNFTProtocol - NFT creation and marketplace operations
@@ -627,17 +627,42 @@ declare class ZubariSubscriptionProtocol {
627
627
  declare class ZubariPayoutsProtocol {
628
628
  private readonly contractAddress;
629
629
  private readonly chainId;
630
- constructor(contractAddress: string, chainId: number);
630
+ private readonly apiBaseUrl;
631
+ constructor(contractAddress: string, chainId: number, apiBaseUrl?: string);
631
632
  /**
632
- * Get pending earnings breakdown for the current user
633
+ * Get pending earnings breakdown for the current user (on-chain)
633
634
  */
634
635
  getPendingEarnings(): Promise<EarningsBreakdown>;
636
+ /**
637
+ * Get earnings data from API (includes pending, total, breakdown, and recent payouts)
638
+ * Requires authentication token
639
+ */
640
+ getEarnings(authToken: string): Promise<EarningsResponse>;
641
+ /**
642
+ * Get payout history with pagination
643
+ * Requires authentication token
644
+ */
645
+ getPayoutHistory(authToken: string, page?: number, limit?: number): Promise<PayoutHistoryResponse>;
646
+ /**
647
+ * Get earnings breakdown by source with percentages
648
+ * Requires authentication token
649
+ */
650
+ getBreakdown(authToken: string): Promise<BreakdownResponse>;
651
+ /**
652
+ * Get current platform fee
653
+ */
654
+ getPlatformFee(): Promise<PlatformFeeResponse>;
635
655
  /**
636
656
  * Get historical earnings for a time period
637
657
  */
638
658
  getEarningsHistory(period?: 'day' | 'week' | 'month' | 'all'): Promise<EarningsBreakdown[]>;
639
659
  /**
640
- * Claim all pending earnings
660
+ * Claim all pending earnings via API
661
+ * Requires authentication token and seed phrase
662
+ */
663
+ claimEarningsViaApi(authToken: string, seed: string): Promise<ClaimResult>;
664
+ /**
665
+ * Claim all pending earnings (direct contract call)
641
666
  */
642
667
  claimEarnings(): Promise<TxResult>;
643
668
  /**
@@ -661,6 +686,14 @@ declare class ZubariPayoutsProtocol {
661
686
  * Convert earnings to stablecoin (USDT)
662
687
  */
663
688
  convertToStable(token: string, amount: bigint): Promise<TxResult>;
689
+ /**
690
+ * Get the contract address
691
+ */
692
+ getContractAddress(): string;
693
+ /**
694
+ * Get the chain ID
695
+ */
696
+ getChainId(): number;
664
697
  }
665
698
 
666
699
  export { ZubariMarketProtocol, ZubariNFTProtocol, ZubariPayoutsProtocol, ZubariSubscriptionProtocol, ZubariTipsProtocol };
@@ -3139,12 +3139,14 @@ var ZubariSubscriptionProtocol = class {
3139
3139
  var ZubariPayoutsProtocol = class {
3140
3140
  contractAddress;
3141
3141
  chainId;
3142
- constructor(contractAddress, chainId) {
3142
+ apiBaseUrl;
3143
+ constructor(contractAddress, chainId, apiBaseUrl) {
3143
3144
  this.contractAddress = contractAddress;
3144
3145
  this.chainId = chainId;
3146
+ this.apiBaseUrl = apiBaseUrl || "https://ckgwifsxka.us-east-2.awsapprunner.com";
3145
3147
  }
3146
3148
  /**
3147
- * Get pending earnings breakdown for the current user
3149
+ * Get pending earnings breakdown for the current user (on-chain)
3148
3150
  */
3149
3151
  async getPendingEarnings() {
3150
3152
  return {
@@ -3155,6 +3157,75 @@ var ZubariPayoutsProtocol = class {
3155
3157
  total: BigInt(0)
3156
3158
  };
3157
3159
  }
3160
+ /**
3161
+ * Get earnings data from API (includes pending, total, breakdown, and recent payouts)
3162
+ * Requires authentication token
3163
+ */
3164
+ async getEarnings(authToken) {
3165
+ const response = await fetch(`${this.apiBaseUrl}/api/payouts/earnings`, {
3166
+ headers: {
3167
+ Authorization: `Bearer ${authToken}`,
3168
+ "Content-Type": "application/json"
3169
+ }
3170
+ });
3171
+ if (!response.ok) {
3172
+ const error = await response.json();
3173
+ throw new Error(error.error || "Failed to fetch earnings");
3174
+ }
3175
+ return response.json();
3176
+ }
3177
+ /**
3178
+ * Get payout history with pagination
3179
+ * Requires authentication token
3180
+ */
3181
+ async getPayoutHistory(authToken, page = 1, limit = 20) {
3182
+ const response = await fetch(
3183
+ `${this.apiBaseUrl}/api/payouts/history?page=${page}&limit=${limit}`,
3184
+ {
3185
+ headers: {
3186
+ Authorization: `Bearer ${authToken}`,
3187
+ "Content-Type": "application/json"
3188
+ }
3189
+ }
3190
+ );
3191
+ if (!response.ok) {
3192
+ const error = await response.json();
3193
+ throw new Error(error.error || "Failed to fetch payout history");
3194
+ }
3195
+ return response.json();
3196
+ }
3197
+ /**
3198
+ * Get earnings breakdown by source with percentages
3199
+ * Requires authentication token
3200
+ */
3201
+ async getBreakdown(authToken) {
3202
+ const response = await fetch(`${this.apiBaseUrl}/api/payouts/breakdown`, {
3203
+ headers: {
3204
+ Authorization: `Bearer ${authToken}`,
3205
+ "Content-Type": "application/json"
3206
+ }
3207
+ });
3208
+ if (!response.ok) {
3209
+ const error = await response.json();
3210
+ throw new Error(error.error || "Failed to fetch earnings breakdown");
3211
+ }
3212
+ return response.json();
3213
+ }
3214
+ /**
3215
+ * Get current platform fee
3216
+ */
3217
+ async getPlatformFee() {
3218
+ const response = await fetch(`${this.apiBaseUrl}/api/payouts/platform-fee`, {
3219
+ headers: {
3220
+ "Content-Type": "application/json"
3221
+ }
3222
+ });
3223
+ if (!response.ok) {
3224
+ const error = await response.json();
3225
+ throw new Error(error.error || "Failed to fetch platform fee");
3226
+ }
3227
+ return response.json();
3228
+ }
3158
3229
  /**
3159
3230
  * Get historical earnings for a time period
3160
3231
  */
@@ -3162,7 +3233,26 @@ var ZubariPayoutsProtocol = class {
3162
3233
  return [];
3163
3234
  }
3164
3235
  /**
3165
- * Claim all pending earnings
3236
+ * Claim all pending earnings via API
3237
+ * Requires authentication token and seed phrase
3238
+ */
3239
+ async claimEarningsViaApi(authToken, seed) {
3240
+ const response = await fetch(`${this.apiBaseUrl}/api/payouts/claim`, {
3241
+ method: "POST",
3242
+ headers: {
3243
+ Authorization: `Bearer ${authToken}`,
3244
+ "Content-Type": "application/json"
3245
+ },
3246
+ body: JSON.stringify({ seed })
3247
+ });
3248
+ if (!response.ok) {
3249
+ const error = await response.json();
3250
+ throw new Error(error.error || "Failed to claim earnings");
3251
+ }
3252
+ return response.json();
3253
+ }
3254
+ /**
3255
+ * Claim all pending earnings (direct contract call)
3166
3256
  */
3167
3257
  async claimEarnings() {
3168
3258
  return {
@@ -3236,6 +3326,18 @@ var ZubariPayoutsProtocol = class {
3236
3326
  status: "pending"
3237
3327
  };
3238
3328
  }
3329
+ /**
3330
+ * Get the contract address
3331
+ */
3332
+ getContractAddress() {
3333
+ return this.contractAddress;
3334
+ }
3335
+ /**
3336
+ * Get the chain ID
3337
+ */
3338
+ getChainId() {
3339
+ return this.chainId;
3340
+ }
3239
3341
  };
3240
3342
 
3241
3343
  exports.ZubariMarketProtocol = ZubariMarketProtocol;