@zubari/sdk 0.3.7 → 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.
- package/dist/PayoutsProtocol-B5z8SEA-.d.ts +734 -0
- package/dist/PayoutsProtocol-CLiMFe54.d.mts +734 -0
- package/dist/{TransactionService-DuMJmrG3.d.mts → TransactionService-1Jt8ZRqO.d.mts} +1 -1
- package/dist/{TransactionService-DURp3bRL.d.ts → TransactionService-Djonkbp4.d.ts} +1 -1
- package/dist/{WalletManager-CmiNyapl.d.ts → WalletManager-DfvFJ-mk.d.ts} +12 -1
- package/dist/{WalletManager-DXt6vihp.d.mts → WalletManager-j0tgNIKi.d.mts} +12 -1
- package/dist/{index-CRsZrlN0.d.mts → index-BnlkQ9B6.d.ts} +5 -2
- package/dist/{index-DF0Gf8NK.d.mts → index-CTyZlHKg.d.mts} +7 -1
- package/dist/{index-DF0Gf8NK.d.ts → index-CTyZlHKg.d.ts} +7 -1
- package/dist/{index-VNzO49qu.d.ts → index-QLZi5YRN.d.mts} +5 -2
- package/dist/index.d.mts +21 -5
- package/dist/index.d.ts +21 -5
- package/dist/index.js +152 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +152 -38
- package/dist/index.mjs.map +1 -1
- package/dist/protocols/index.d.mts +102 -502
- package/dist/protocols/index.d.ts +102 -502
- package/dist/protocols/index.js +1849 -2
- package/dist/protocols/index.js.map +1 -1
- package/dist/protocols/index.mjs +1849 -3
- package/dist/protocols/index.mjs.map +1 -1
- package/dist/react/index.d.mts +7 -3
- package/dist/react/index.d.ts +7 -3
- package/dist/react/index.js +136 -21
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +136 -21
- package/dist/react/index.mjs.map +1 -1
- package/dist/services/index.d.mts +2 -2
- package/dist/services/index.d.ts +2 -2
- package/dist/services/index.js +6 -6
- package/dist/services/index.js.map +1 -1
- package/dist/services/index.mjs +6 -6
- package/dist/services/index.mjs.map +1 -1
- package/dist/storage/index.js +61 -3
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/index.mjs +61 -3
- package/dist/storage/index.mjs.map +1 -1
- package/dist/wallet/index.d.mts +3 -3
- package/dist/wallet/index.d.ts +3 -3
- package/dist/wallet/index.js +150 -36
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +150 -36
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,93 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
export { a as ZubariMarketProtocol, Z as ZubariNFTProtocol, d as ZubariPayoutsProtocol, c as ZubariSubscriptionProtocol, b as ZubariTipsProtocol } from '../PayoutsProtocol-CLiMFe54.mjs';
|
|
2
|
+
import { T as TxResult, C as Creator, S as SubscriptionPlan, a as Subscription } from '../index-CTyZlHKg.mjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* ZubariSubscriptionV2Protocol - Subscription payments with integrated payouts
|
|
5
6
|
*
|
|
6
|
-
* Handles
|
|
7
|
-
* and
|
|
8
|
-
*/
|
|
9
|
-
declare class ZubariNFTProtocol {
|
|
10
|
-
private readonly contractAddress;
|
|
11
|
-
private readonly _marketplaceAddress;
|
|
12
|
-
private readonly chainId;
|
|
13
|
-
private readonly network;
|
|
14
|
-
private readonly apiClient;
|
|
15
|
-
private nonceCounter;
|
|
16
|
-
constructor(contractAddress: string, marketplaceAddress: string, chainId: number, network?: 'testnet' | 'mainnet', apiUrl?: string);
|
|
17
|
-
/**
|
|
18
|
-
* Convert human-readable price to wei
|
|
19
|
-
* @param price - Price in human-readable format (e.g., "1.5")
|
|
20
|
-
* @param currency - ETH (18 decimals) or USDT (6 decimals)
|
|
21
|
-
*/
|
|
22
|
-
private priceToWei;
|
|
23
|
-
/**
|
|
24
|
-
* Get currency address for the configured network
|
|
25
|
-
*/
|
|
26
|
-
private getCurrencyAddress;
|
|
27
|
-
/**
|
|
28
|
-
* Generate a unique nonce
|
|
29
|
-
*/
|
|
30
|
-
private generateNonce;
|
|
31
|
-
/**
|
|
32
|
-
* Pad string to bytes32 format
|
|
33
|
-
*/
|
|
34
|
-
private toBytes32;
|
|
35
|
-
/**
|
|
36
|
-
* Create a lazy mint voucher for off-chain NFT creation
|
|
37
|
-
* The voucher can be redeemed on-chain when purchased
|
|
38
|
-
*
|
|
39
|
-
* @param params - Voucher creation parameters
|
|
40
|
-
* @param signer - Object with signTypedData method (ethers.js wallet or viem client)
|
|
41
|
-
*/
|
|
42
|
-
createLazyMintVoucher(params: CreateVoucherParams, signer: {
|
|
43
|
-
signTypedData: (domain: object, types: object, value: object) => Promise<string>;
|
|
44
|
-
}): Promise<LazyMintVoucher>;
|
|
45
|
-
/**
|
|
46
|
-
* @deprecated Use createLazyMintVoucher(params, signer) instead
|
|
47
|
-
* Legacy method for backward compatibility
|
|
48
|
-
*/
|
|
49
|
-
createLazyMintVoucherLegacy(metadata: NFTMetadata, creatorAddress: string, signer: {
|
|
50
|
-
signTypedData: (domain: object, types: object, value: object) => Promise<string>;
|
|
51
|
-
}): Promise<LazyMintVoucher>;
|
|
52
|
-
/**
|
|
53
|
-
* Redeem a lazy mint voucher to mint the NFT on-chain
|
|
54
|
-
* Uses the backend API which handles the on-chain transaction
|
|
55
|
-
*/
|
|
56
|
-
redeemVoucher(voucher: LazyMintVoucher, buyerAddress: string, nftId: string, authToken: string): Promise<TxResult>;
|
|
57
|
-
/**
|
|
58
|
-
* List an NFT for sale on the marketplace via backend API
|
|
59
|
-
*/
|
|
60
|
-
listForSale(params: ListingParams, authToken: string): Promise<TxResult>;
|
|
61
|
-
/**
|
|
62
|
-
* Buy an NFT from the marketplace via backend API
|
|
63
|
-
*/
|
|
64
|
-
buyNFT(listingId: string, price: bigint, buyerAddress: string): Promise<TxResult>;
|
|
65
|
-
/**
|
|
66
|
-
* Transfer an NFT to another address
|
|
67
|
-
* Note: This requires direct contract interaction via wallet
|
|
68
|
-
*/
|
|
69
|
-
transfer(tokenId: string, to: string, from: string, signer: {
|
|
70
|
-
sendTransaction: (tx: object) => Promise<{
|
|
71
|
-
hash: string;
|
|
72
|
-
}>;
|
|
73
|
-
}): Promise<TxResult>;
|
|
74
|
-
/**
|
|
75
|
-
* Get NFTs owned by an address via backend API
|
|
76
|
-
*/
|
|
77
|
-
getOwnedNFTs(address: string): Promise<NFT[]>;
|
|
78
|
-
/**
|
|
79
|
-
* Generate a random tokenId (32 bytes hex)
|
|
80
|
-
*/
|
|
81
|
-
private generateTokenId;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* ZubariMarketProtocol - NFT Marketplace operations
|
|
7
|
+
* Handles creator registration, subscription plan creation, subscription management,
|
|
8
|
+
* and automatic earnings distribution to ZubariPayouts contract.
|
|
86
9
|
*
|
|
87
|
-
*
|
|
88
|
-
* with
|
|
10
|
+
* Key features:
|
|
11
|
+
* - Creator registration with configurable payout wallet (WDK or MetaMask)
|
|
12
|
+
* - Multiple subscription plans per creator
|
|
13
|
+
* - Automatic fee split: 10% to treasury, 90% to Payouts contract
|
|
14
|
+
* - Support for ETH and ERC-20 payments
|
|
89
15
|
*/
|
|
90
|
-
declare class
|
|
16
|
+
declare class ZubariSubscriptionV2Protocol {
|
|
91
17
|
private readonly contractAddress;
|
|
92
18
|
private readonly chainId;
|
|
93
19
|
private readonly abi;
|
|
@@ -137,11 +63,6 @@ declare class ZubariMarketProtocol {
|
|
|
137
63
|
}[];
|
|
138
64
|
name: string;
|
|
139
65
|
outputs: {
|
|
140
|
-
components: {
|
|
141
|
-
internalType: string;
|
|
142
|
-
name: string;
|
|
143
|
-
type: string;
|
|
144
|
-
}[];
|
|
145
66
|
internalType: string;
|
|
146
67
|
name: string;
|
|
147
68
|
type: string;
|
|
@@ -157,6 +78,11 @@ declare class ZubariMarketProtocol {
|
|
|
157
78
|
}[];
|
|
158
79
|
name: string;
|
|
159
80
|
outputs: {
|
|
81
|
+
components: {
|
|
82
|
+
internalType: string;
|
|
83
|
+
name: string;
|
|
84
|
+
type: string;
|
|
85
|
+
}[];
|
|
160
86
|
internalType: string;
|
|
161
87
|
name: string;
|
|
162
88
|
type: string;
|
|
@@ -164,362 +90,119 @@ declare class ZubariMarketProtocol {
|
|
|
164
90
|
stateMutability: string;
|
|
165
91
|
type: string;
|
|
166
92
|
anonymous?: undefined;
|
|
93
|
+
} | {
|
|
94
|
+
stateMutability: string;
|
|
95
|
+
type: string;
|
|
96
|
+
inputs?: undefined;
|
|
97
|
+
name?: undefined;
|
|
98
|
+
anonymous?: undefined;
|
|
99
|
+
outputs?: undefined;
|
|
167
100
|
})[];
|
|
168
101
|
/**
|
|
169
102
|
* Get the contract address
|
|
170
103
|
*/
|
|
171
104
|
getAddress(): string;
|
|
172
105
|
/**
|
|
173
|
-
*
|
|
174
|
-
* @param
|
|
106
|
+
* Register as a creator with a payout wallet
|
|
107
|
+
* @param payoutWallet The wallet that will receive payments (WDK wallet by default)
|
|
175
108
|
* @param signer Wallet signer with sendTransaction method
|
|
176
109
|
*/
|
|
177
|
-
|
|
178
|
-
sendTransaction: (tx: object) => Promise<{
|
|
179
|
-
hash: string;
|
|
180
|
-
}>;
|
|
181
|
-
}): Promise<TxResult>;
|
|
182
|
-
/**
|
|
183
|
-
* Buy an NFT from a listing
|
|
184
|
-
* @param params Buy parameters
|
|
185
|
-
* @param signer Wallet signer
|
|
186
|
-
*/
|
|
187
|
-
buyItem(params: BuyParams, signer: {
|
|
110
|
+
registerCreator(payoutWallet: string, signer: {
|
|
188
111
|
sendTransaction: (tx: object) => Promise<{
|
|
189
112
|
hash: string;
|
|
190
113
|
}>;
|
|
191
114
|
}): Promise<TxResult>;
|
|
192
115
|
/**
|
|
193
|
-
*
|
|
194
|
-
* @param
|
|
195
|
-
* @param signer Wallet signer
|
|
116
|
+
* Prepare transaction data for creator registration (for frontend signing)
|
|
117
|
+
* @param payoutWallet The wallet that will receive payments
|
|
196
118
|
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
119
|
+
prepareRegisterCreator(payoutWallet: string): Promise<{
|
|
120
|
+
to: string;
|
|
121
|
+
data: string;
|
|
122
|
+
value: string;
|
|
123
|
+
}>;
|
|
202
124
|
/**
|
|
203
|
-
* Update
|
|
204
|
-
* @param
|
|
205
|
-
* @param newPrice New price
|
|
125
|
+
* Update the payout wallet address
|
|
126
|
+
* @param newWallet New wallet address (can be WDK or MetaMask)
|
|
206
127
|
* @param signer Wallet signer
|
|
207
128
|
*/
|
|
208
|
-
|
|
129
|
+
updatePayoutWallet(newWallet: string, signer: {
|
|
209
130
|
sendTransaction: (tx: object) => Promise<{
|
|
210
131
|
hash: string;
|
|
211
132
|
}>;
|
|
212
133
|
}): Promise<TxResult>;
|
|
213
134
|
/**
|
|
214
|
-
* Get
|
|
215
|
-
* @param
|
|
135
|
+
* Get creator information
|
|
136
|
+
* @param creatorAddress The creator's address
|
|
216
137
|
* @param provider JSON-RPC provider
|
|
217
138
|
*/
|
|
218
|
-
|
|
139
|
+
getCreator(creatorAddress: string, provider: {
|
|
219
140
|
call: (tx: object) => Promise<string>;
|
|
220
|
-
}): Promise<
|
|
141
|
+
}): Promise<Creator | null>;
|
|
221
142
|
/**
|
|
222
|
-
* Check if
|
|
223
|
-
* @param
|
|
143
|
+
* Check if an address is a registered creator
|
|
144
|
+
* @param creatorAddress The address to check
|
|
224
145
|
* @param provider JSON-RPC provider
|
|
225
146
|
*/
|
|
226
|
-
|
|
147
|
+
isRegisteredCreator(creatorAddress: string, provider: {
|
|
227
148
|
call: (tx: object) => Promise<string>;
|
|
228
149
|
}): Promise<boolean>;
|
|
229
150
|
/**
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* @param price The sale price
|
|
233
|
-
*/
|
|
234
|
-
calculateFee(price: bigint): {
|
|
235
|
-
fee: bigint;
|
|
236
|
-
sellerAmount: bigint;
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* ZubariTipsProtocol - Micropayment tips for creators
|
|
242
|
-
*
|
|
243
|
-
* Handles ETH and ERC-20 token tips with platform fee distribution.
|
|
244
|
-
* Supports individual tips, batch tips, and tip queries.
|
|
245
|
-
*/
|
|
246
|
-
declare class ZubariTipsProtocol {
|
|
247
|
-
private readonly contractAddress;
|
|
248
|
-
private readonly chainId;
|
|
249
|
-
private readonly abi;
|
|
250
|
-
constructor(contractAddress: string, chainId: number);
|
|
251
|
-
/**
|
|
252
|
-
* Get the contract ABI
|
|
253
|
-
*/
|
|
254
|
-
getAbi(): ({
|
|
255
|
-
inputs: {
|
|
256
|
-
internalType: string;
|
|
257
|
-
name: string;
|
|
258
|
-
type: string;
|
|
259
|
-
}[];
|
|
260
|
-
stateMutability: string;
|
|
261
|
-
type: string;
|
|
262
|
-
name?: undefined;
|
|
263
|
-
anonymous?: undefined;
|
|
264
|
-
outputs?: undefined;
|
|
265
|
-
} | {
|
|
266
|
-
inputs: {
|
|
267
|
-
internalType: string;
|
|
268
|
-
name: string;
|
|
269
|
-
type: string;
|
|
270
|
-
}[];
|
|
271
|
-
name: string;
|
|
272
|
-
type: string;
|
|
273
|
-
stateMutability?: undefined;
|
|
274
|
-
anonymous?: undefined;
|
|
275
|
-
outputs?: undefined;
|
|
276
|
-
} | {
|
|
277
|
-
anonymous: boolean;
|
|
278
|
-
inputs: {
|
|
279
|
-
indexed: boolean;
|
|
280
|
-
internalType: string;
|
|
281
|
-
name: string;
|
|
282
|
-
type: string;
|
|
283
|
-
}[];
|
|
284
|
-
name: string;
|
|
285
|
-
type: string;
|
|
286
|
-
stateMutability?: undefined;
|
|
287
|
-
outputs?: undefined;
|
|
288
|
-
} | {
|
|
289
|
-
inputs: {
|
|
290
|
-
internalType: string;
|
|
291
|
-
name: string;
|
|
292
|
-
type: string;
|
|
293
|
-
}[];
|
|
294
|
-
name: string;
|
|
295
|
-
outputs: {
|
|
296
|
-
components: {
|
|
297
|
-
internalType: string;
|
|
298
|
-
name: string;
|
|
299
|
-
type: string;
|
|
300
|
-
}[];
|
|
301
|
-
internalType: string;
|
|
302
|
-
name: string;
|
|
303
|
-
type: string;
|
|
304
|
-
}[];
|
|
305
|
-
stateMutability: string;
|
|
306
|
-
type: string;
|
|
307
|
-
anonymous?: undefined;
|
|
308
|
-
} | {
|
|
309
|
-
inputs: {
|
|
310
|
-
internalType: string;
|
|
311
|
-
name: string;
|
|
312
|
-
type: string;
|
|
313
|
-
}[];
|
|
314
|
-
name: string;
|
|
315
|
-
outputs: {
|
|
316
|
-
internalType: string;
|
|
317
|
-
name: string;
|
|
318
|
-
type: string;
|
|
319
|
-
}[];
|
|
320
|
-
stateMutability: string;
|
|
321
|
-
type: string;
|
|
322
|
-
anonymous?: undefined;
|
|
323
|
-
})[];
|
|
324
|
-
/**
|
|
325
|
-
* Get the contract address
|
|
326
|
-
*/
|
|
327
|
-
getAddress(): string;
|
|
328
|
-
/**
|
|
329
|
-
* Send ETH tip to a creator
|
|
330
|
-
* @param recipient The recipient address
|
|
331
|
-
* @param message Optional tip message
|
|
151
|
+
* Create a new subscription plan
|
|
152
|
+
* @param plan The plan details
|
|
332
153
|
* @param signer Wallet signer with sendTransaction method
|
|
333
|
-
* @param value ETH amount to tip (in wei)
|
|
334
154
|
*/
|
|
335
|
-
|
|
155
|
+
createPlan(plan: SubscriptionPlan, signer: {
|
|
336
156
|
sendTransaction: (tx: object) => Promise<{
|
|
337
157
|
hash: string;
|
|
338
158
|
}>;
|
|
339
|
-
}
|
|
159
|
+
}): Promise<string>;
|
|
340
160
|
/**
|
|
341
|
-
*
|
|
342
|
-
* @param
|
|
343
|
-
* @param
|
|
344
|
-
* @param
|
|
345
|
-
* @param message Optional tip message
|
|
161
|
+
* Update an existing plan's price and duration
|
|
162
|
+
* @param planId The plan ID to update
|
|
163
|
+
* @param newPrice New price (0 to keep current)
|
|
164
|
+
* @param newDurationDays New duration in days (0 to keep current)
|
|
346
165
|
* @param signer Wallet signer
|
|
347
166
|
*/
|
|
348
|
-
|
|
167
|
+
updatePlan(planId: string, newPrice: bigint, newDurationDays: number, signer: {
|
|
349
168
|
sendTransaction: (tx: object) => Promise<{
|
|
350
169
|
hash: string;
|
|
351
170
|
}>;
|
|
352
171
|
}): Promise<TxResult>;
|
|
353
172
|
/**
|
|
354
|
-
*
|
|
355
|
-
* @param
|
|
356
|
-
* @param amounts Array of tip amounts (in wei)
|
|
357
|
-
* @param messages Array of tip messages
|
|
173
|
+
* Deactivate a subscription plan (only creator can do this)
|
|
174
|
+
* @param planId The plan ID to deactivate
|
|
358
175
|
* @param signer Wallet signer
|
|
359
|
-
* @param value Total ETH to send
|
|
360
176
|
*/
|
|
361
|
-
|
|
177
|
+
deactivatePlan(planId: string, signer: {
|
|
362
178
|
sendTransaction: (tx: object) => Promise<{
|
|
363
179
|
hash: string;
|
|
364
180
|
}>;
|
|
365
|
-
}
|
|
366
|
-
/**
|
|
367
|
-
* Get tip details by ID
|
|
368
|
-
* @param tipId The tip ID
|
|
369
|
-
* @param provider JSON-RPC provider
|
|
370
|
-
*/
|
|
371
|
-
getTip(tipId: string, provider: {
|
|
372
|
-
call: (tx: object) => Promise<string>;
|
|
373
|
-
}): Promise<Tip | null>;
|
|
374
|
-
/**
|
|
375
|
-
* Get total tips received by an address
|
|
376
|
-
* @param address The address to query
|
|
377
|
-
* @param provider JSON-RPC provider
|
|
378
|
-
*/
|
|
379
|
-
getTotalTipsReceived(address: string, provider: {
|
|
380
|
-
call: (tx: object) => Promise<string>;
|
|
381
|
-
}): Promise<bigint>;
|
|
181
|
+
}): Promise<TxResult>;
|
|
382
182
|
/**
|
|
383
|
-
* Get
|
|
183
|
+
* Get a specific plan by ID
|
|
184
|
+
* @param planId The plan ID
|
|
384
185
|
* @param provider JSON-RPC provider
|
|
385
186
|
*/
|
|
386
|
-
|
|
187
|
+
getPlan(planId: string, provider: {
|
|
387
188
|
call: (tx: object) => Promise<string>;
|
|
388
|
-
}): Promise<
|
|
189
|
+
}): Promise<SubscriptionPlan | null>;
|
|
389
190
|
/**
|
|
390
|
-
* Get
|
|
191
|
+
* Get all plan IDs for a creator
|
|
192
|
+
* @param creator The creator address
|
|
391
193
|
* @param provider JSON-RPC provider
|
|
392
194
|
*/
|
|
393
|
-
|
|
195
|
+
getCreatorPlanIds(creator: string, provider: {
|
|
394
196
|
call: (tx: object) => Promise<string>;
|
|
395
|
-
}): Promise<
|
|
197
|
+
}): Promise<string[]>;
|
|
396
198
|
/**
|
|
397
|
-
* Get
|
|
199
|
+
* Get all plans for a creator with full details
|
|
200
|
+
* @param creator The creator address
|
|
398
201
|
* @param provider JSON-RPC provider
|
|
399
202
|
*/
|
|
400
|
-
|
|
203
|
+
getCreatorPlans(creator: string, provider: {
|
|
401
204
|
call: (tx: object) => Promise<string>;
|
|
402
|
-
}): Promise<
|
|
403
|
-
/**
|
|
404
|
-
* Calculate platform fee for a given amount
|
|
405
|
-
* @param amount The tip amount
|
|
406
|
-
* @param feeBps Fee in basis points (default: 1000 = 10%)
|
|
407
|
-
* Platform keeps 10%, Creator receives 90%
|
|
408
|
-
*/
|
|
409
|
-
calculateFee(amount: bigint, feeBps?: number): {
|
|
410
|
-
fee: bigint;
|
|
411
|
-
creatorAmount: bigint;
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* ZubariSubscriptionProtocol - Recurring subscription payments
|
|
417
|
-
*
|
|
418
|
-
* Handles subscription plan creation, subscription management,
|
|
419
|
-
* and verification of active subscriptions using the ZubariSubscription smart contract.
|
|
420
|
-
*/
|
|
421
|
-
declare class ZubariSubscriptionProtocol {
|
|
422
|
-
private readonly contractAddress;
|
|
423
|
-
private readonly chainId;
|
|
424
|
-
private readonly abi;
|
|
425
|
-
constructor(contractAddress: string, chainId: number);
|
|
426
|
-
/**
|
|
427
|
-
* Get the contract ABI
|
|
428
|
-
*/
|
|
429
|
-
getAbi(): ({
|
|
430
|
-
inputs: {
|
|
431
|
-
internalType: string;
|
|
432
|
-
name: string;
|
|
433
|
-
type: string;
|
|
434
|
-
}[];
|
|
435
|
-
stateMutability: string;
|
|
436
|
-
type: string;
|
|
437
|
-
name?: undefined;
|
|
438
|
-
anonymous?: undefined;
|
|
439
|
-
outputs?: undefined;
|
|
440
|
-
} | {
|
|
441
|
-
inputs: {
|
|
442
|
-
internalType: string;
|
|
443
|
-
name: string;
|
|
444
|
-
type: string;
|
|
445
|
-
}[];
|
|
446
|
-
name: string;
|
|
447
|
-
type: string;
|
|
448
|
-
stateMutability?: undefined;
|
|
449
|
-
anonymous?: undefined;
|
|
450
|
-
outputs?: undefined;
|
|
451
|
-
} | {
|
|
452
|
-
anonymous: boolean;
|
|
453
|
-
inputs: {
|
|
454
|
-
indexed: boolean;
|
|
455
|
-
internalType: string;
|
|
456
|
-
name: string;
|
|
457
|
-
type: string;
|
|
458
|
-
}[];
|
|
459
|
-
name: string;
|
|
460
|
-
type: string;
|
|
461
|
-
stateMutability?: undefined;
|
|
462
|
-
outputs?: undefined;
|
|
463
|
-
} | {
|
|
464
|
-
inputs: {
|
|
465
|
-
internalType: string;
|
|
466
|
-
name: string;
|
|
467
|
-
type: string;
|
|
468
|
-
}[];
|
|
469
|
-
name: string;
|
|
470
|
-
outputs: {
|
|
471
|
-
internalType: string;
|
|
472
|
-
name: string;
|
|
473
|
-
type: string;
|
|
474
|
-
}[];
|
|
475
|
-
stateMutability: string;
|
|
476
|
-
type: string;
|
|
477
|
-
anonymous?: undefined;
|
|
478
|
-
} | {
|
|
479
|
-
inputs: {
|
|
480
|
-
internalType: string;
|
|
481
|
-
name: string;
|
|
482
|
-
type: string;
|
|
483
|
-
}[];
|
|
484
|
-
name: string;
|
|
485
|
-
outputs: {
|
|
486
|
-
components: {
|
|
487
|
-
internalType: string;
|
|
488
|
-
name: string;
|
|
489
|
-
type: string;
|
|
490
|
-
}[];
|
|
491
|
-
internalType: string;
|
|
492
|
-
name: string;
|
|
493
|
-
type: string;
|
|
494
|
-
}[];
|
|
495
|
-
stateMutability: string;
|
|
496
|
-
type: string;
|
|
497
|
-
anonymous?: undefined;
|
|
498
|
-
})[];
|
|
499
|
-
/**
|
|
500
|
-
* Get the contract address
|
|
501
|
-
*/
|
|
502
|
-
getAddress(): string;
|
|
503
|
-
/**
|
|
504
|
-
* Create a new subscription plan
|
|
505
|
-
* @param plan The plan details
|
|
506
|
-
* @param signer Wallet signer with sendTransaction method
|
|
507
|
-
*/
|
|
508
|
-
createPlan(plan: SubscriptionPlan, signer: {
|
|
509
|
-
sendTransaction: (tx: object) => Promise<{
|
|
510
|
-
hash: string;
|
|
511
|
-
}>;
|
|
512
|
-
}): Promise<string>;
|
|
513
|
-
/**
|
|
514
|
-
* Deactivate a subscription plan (only creator can do this)
|
|
515
|
-
* @param planId The plan ID to deactivate
|
|
516
|
-
* @param signer Wallet signer
|
|
517
|
-
*/
|
|
518
|
-
deactivatePlan(planId: string, signer: {
|
|
519
|
-
sendTransaction: (tx: object) => Promise<{
|
|
520
|
-
hash: string;
|
|
521
|
-
}>;
|
|
522
|
-
}): Promise<TxResult>;
|
|
205
|
+
}): Promise<SubscriptionPlan[]>;
|
|
523
206
|
/**
|
|
524
207
|
* Subscribe to a creator's plan
|
|
525
208
|
* @param planId The plan ID to subscribe to
|
|
@@ -532,6 +215,17 @@ declare class ZubariSubscriptionProtocol {
|
|
|
532
215
|
hash: string;
|
|
533
216
|
}>;
|
|
534
217
|
}, value?: bigint): Promise<TxResult>;
|
|
218
|
+
/**
|
|
219
|
+
* Prepare transaction data for subscription (for frontend signing)
|
|
220
|
+
* @param planId The plan ID to subscribe to
|
|
221
|
+
* @param months Number of months to subscribe
|
|
222
|
+
* @param value ETH value in wei
|
|
223
|
+
*/
|
|
224
|
+
prepareSubscribe(planId: string, months: number, value: bigint): Promise<{
|
|
225
|
+
to: string;
|
|
226
|
+
data: string;
|
|
227
|
+
value: string;
|
|
228
|
+
}>;
|
|
535
229
|
/**
|
|
536
230
|
* Cancel an active subscription
|
|
537
231
|
* @param subscriptionId The subscription ID to cancel
|
|
@@ -580,29 +274,13 @@ declare class ZubariSubscriptionProtocol {
|
|
|
580
274
|
call: (tx: object) => Promise<string>;
|
|
581
275
|
}): Promise<Subscription | null>;
|
|
582
276
|
/**
|
|
583
|
-
* Get
|
|
584
|
-
* @param
|
|
585
|
-
* @param provider JSON-RPC provider
|
|
586
|
-
*/
|
|
587
|
-
getPlan(planId: string, provider: {
|
|
588
|
-
call: (tx: object) => Promise<string>;
|
|
589
|
-
}): Promise<SubscriptionPlan | null>;
|
|
590
|
-
/**
|
|
591
|
-
* Get all plan IDs for a creator
|
|
592
|
-
* @param creator The creator address
|
|
277
|
+
* Get all subscription IDs for a subscriber
|
|
278
|
+
* @param subscriber The subscriber address
|
|
593
279
|
* @param provider JSON-RPC provider
|
|
594
280
|
*/
|
|
595
|
-
|
|
281
|
+
getSubscriberSubscriptionIds(subscriber: string, provider: {
|
|
596
282
|
call: (tx: object) => Promise<string>;
|
|
597
283
|
}): Promise<string[]>;
|
|
598
|
-
/**
|
|
599
|
-
* Get all plans for a creator with full details
|
|
600
|
-
* @param creator The creator address
|
|
601
|
-
* @param provider JSON-RPC provider
|
|
602
|
-
*/
|
|
603
|
-
getCreatorPlans(creator: string, provider: {
|
|
604
|
-
call: (tx: object) => Promise<string>;
|
|
605
|
-
}): Promise<SubscriptionPlan[]>;
|
|
606
284
|
/**
|
|
607
285
|
* Get platform fee in basis points
|
|
608
286
|
* @param provider JSON-RPC provider
|
|
@@ -626,109 +304,31 @@ declare class ZubariSubscriptionProtocol {
|
|
|
626
304
|
fee: bigint;
|
|
627
305
|
creatorAmount: bigint;
|
|
628
306
|
};
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* ZubariPayoutsProtocol - Creator earnings management
|
|
633
|
-
*
|
|
634
|
-
* Handles earnings tracking, claiming, revenue splits,
|
|
635
|
-
* and conversion to stablecoins.
|
|
636
|
-
*/
|
|
637
|
-
declare class ZubariPayoutsProtocol {
|
|
638
|
-
private readonly contractAddress;
|
|
639
|
-
private readonly chainId;
|
|
640
|
-
private readonly apiBaseUrl;
|
|
641
|
-
private readonly apiClient;
|
|
642
|
-
constructor(contractAddress: string, chainId: number, apiBaseUrl?: string);
|
|
643
|
-
/**
|
|
644
|
-
* Get pending earnings breakdown for the current user via API
|
|
645
|
-
* Uses backend API which reads from contract/database
|
|
646
|
-
*/
|
|
647
|
-
getPendingEarnings(authToken: string): Promise<EarningsBreakdown>;
|
|
648
|
-
/**
|
|
649
|
-
* Get earnings data from API (includes pending, total, breakdown, and recent payouts)
|
|
650
|
-
* Requires authentication token
|
|
651
|
-
*/
|
|
652
|
-
getEarnings(authToken: string): Promise<EarningsResponse>;
|
|
653
|
-
/**
|
|
654
|
-
* Get payout history with pagination
|
|
655
|
-
* Requires authentication token
|
|
656
|
-
*/
|
|
657
|
-
getPayoutHistory(authToken: string, page?: number, limit?: number): Promise<PayoutHistoryResponse>;
|
|
658
|
-
/**
|
|
659
|
-
* Get earnings breakdown by source with percentages
|
|
660
|
-
* Requires authentication token
|
|
661
|
-
*/
|
|
662
|
-
getBreakdown(authToken: string): Promise<BreakdownResponse>;
|
|
663
|
-
/**
|
|
664
|
-
* Get current platform fee
|
|
665
|
-
*/
|
|
666
|
-
getPlatformFee(): Promise<PlatformFeeResponse>;
|
|
667
|
-
/**
|
|
668
|
-
* Get historical earnings for a time period via API
|
|
669
|
-
*/
|
|
670
|
-
getEarningsHistory(authToken: string, period?: 'day' | 'week' | 'month' | 'all'): Promise<EarningsBreakdown[]>;
|
|
671
|
-
/**
|
|
672
|
-
* Claim all pending earnings via API
|
|
673
|
-
* Requires authentication token and seed phrase
|
|
674
|
-
*/
|
|
675
|
-
claimEarningsViaApi(authToken: string, seed: string): Promise<ClaimResult>;
|
|
676
|
-
/**
|
|
677
|
-
* Claim all pending earnings (direct contract call)
|
|
678
|
-
* Requires a signer with sendTransaction capability
|
|
679
|
-
*/
|
|
680
|
-
claimEarnings(tokenAddress: string, signer: {
|
|
681
|
-
sendTransaction: (tx: object) => Promise<{
|
|
682
|
-
hash: string;
|
|
683
|
-
}>;
|
|
684
|
-
}): Promise<TxResult>;
|
|
685
|
-
/**
|
|
686
|
-
* Claim specific amount of earnings
|
|
687
|
-
* Requires a signer with sendTransaction capability
|
|
688
|
-
*/
|
|
689
|
-
claimPartialEarnings(tokenAddress: string, amount: bigint, signer: {
|
|
690
|
-
sendTransaction: (tx: object) => Promise<{
|
|
691
|
-
hash: string;
|
|
692
|
-
}>;
|
|
693
|
-
}): Promise<TxResult>;
|
|
694
|
-
/**
|
|
695
|
-
* Setup revenue split with collaborators
|
|
696
|
-
* Basis points must sum to 10000 (100%)
|
|
697
|
-
* Requires a signer with sendTransaction capability
|
|
698
|
-
*/
|
|
699
|
-
setupRevenueSplit(splits: RevenueSplit[], signer: {
|
|
700
|
-
sendTransaction: (tx: object) => Promise<{
|
|
701
|
-
hash: string;
|
|
702
|
-
}>;
|
|
703
|
-
}): Promise<TxResult>;
|
|
704
|
-
/**
|
|
705
|
-
* Get current revenue split configuration via API
|
|
706
|
-
*/
|
|
707
|
-
getRevenueSplit(creatorAddress: string): Promise<RevenueSplit[]>;
|
|
708
|
-
/**
|
|
709
|
-
* Remove revenue split (creator gets 100%)
|
|
710
|
-
* Requires a signer with sendTransaction capability
|
|
711
|
-
*/
|
|
712
|
-
removeRevenueSplit(signer: {
|
|
713
|
-
sendTransaction: (tx: object) => Promise<{
|
|
714
|
-
hash: string;
|
|
715
|
-
}>;
|
|
716
|
-
}): Promise<TxResult>;
|
|
717
307
|
/**
|
|
718
|
-
*
|
|
719
|
-
*
|
|
308
|
+
* Calculate fee using on-chain values
|
|
309
|
+
* @param amount The amount
|
|
310
|
+
* @param provider JSON-RPC provider
|
|
720
311
|
*/
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
}): Promise<
|
|
312
|
+
calculateFeeOnChain(amount: bigint, provider: {
|
|
313
|
+
call: (tx: object) => Promise<string>;
|
|
314
|
+
}): Promise<{
|
|
315
|
+
fee: bigint;
|
|
316
|
+
creatorAmount: bigint;
|
|
317
|
+
}>;
|
|
724
318
|
/**
|
|
725
|
-
* Get
|
|
319
|
+
* Get treasury address
|
|
320
|
+
* @param provider JSON-RPC provider
|
|
726
321
|
*/
|
|
727
|
-
|
|
322
|
+
getTreasury(provider: {
|
|
323
|
+
call: (tx: object) => Promise<string>;
|
|
324
|
+
}): Promise<string>;
|
|
728
325
|
/**
|
|
729
|
-
* Get
|
|
326
|
+
* Get payouts contract address
|
|
327
|
+
* @param provider JSON-RPC provider
|
|
730
328
|
*/
|
|
731
|
-
|
|
329
|
+
getPayoutsContract(provider: {
|
|
330
|
+
call: (tx: object) => Promise<string>;
|
|
331
|
+
}): Promise<string>;
|
|
732
332
|
}
|
|
733
333
|
|
|
734
|
-
export {
|
|
334
|
+
export { ZubariSubscriptionV2Protocol };
|