@zubari/sdk 0.3.7 → 0.3.8
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-VNzO49qu.d.ts → index-BZDwdQUe.d.mts} +3 -2
- package/dist/{index-CRsZrlN0.d.mts → index-CTb2uJpD.d.ts} +3 -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.d.mts +21 -5
- package/dist/index.d.ts +21 -5
- package/dist/index.js +120 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +120 -17
- 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 +1829 -0
- package/dist/protocols/index.js.map +1 -1
- package/dist/protocols/index.mjs +1829 -1
- 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 +128 -13
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +128 -13
- 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.map +1 -1
- 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 +120 -17
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +120 -17
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,734 @@
|
|
|
1
|
+
import { h as CreateVoucherParams, L as LazyMintVoucher, g as NFTMetadata, T as TxResult, j as ListingParams, i as NFT, B as BuyParams, k as Listing, o as Tip, S as SubscriptionPlan, a as Subscription, E as EarningsBreakdown, t as EarningsResponse, P as PayoutHistoryResponse, u as BreakdownResponse, v as PlatformFeeResponse, w as ClaimResult, R as RevenueSplit } from './index-CTyZlHKg.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ZubariNFTProtocol - NFT creation and marketplace operations
|
|
5
|
+
*
|
|
6
|
+
* Handles lazy minting via EIP-712 signatures, NFT listing,
|
|
7
|
+
* and marketplace operations on Ethereum network.
|
|
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
|
|
86
|
+
*
|
|
87
|
+
* Handles NFT listings, purchases, and marketplace management
|
|
88
|
+
* with support for ETH and ERC-20 payment tokens.
|
|
89
|
+
*/
|
|
90
|
+
declare class ZubariMarketProtocol {
|
|
91
|
+
private readonly contractAddress;
|
|
92
|
+
private readonly chainId;
|
|
93
|
+
private readonly abi;
|
|
94
|
+
constructor(contractAddress: string, chainId: number);
|
|
95
|
+
/**
|
|
96
|
+
* Get the contract ABI
|
|
97
|
+
*/
|
|
98
|
+
getAbi(): ({
|
|
99
|
+
inputs: {
|
|
100
|
+
internalType: string;
|
|
101
|
+
name: string;
|
|
102
|
+
type: string;
|
|
103
|
+
}[];
|
|
104
|
+
stateMutability: string;
|
|
105
|
+
type: string;
|
|
106
|
+
name?: undefined;
|
|
107
|
+
anonymous?: undefined;
|
|
108
|
+
outputs?: undefined;
|
|
109
|
+
} | {
|
|
110
|
+
inputs: {
|
|
111
|
+
internalType: string;
|
|
112
|
+
name: string;
|
|
113
|
+
type: string;
|
|
114
|
+
}[];
|
|
115
|
+
name: string;
|
|
116
|
+
type: string;
|
|
117
|
+
stateMutability?: undefined;
|
|
118
|
+
anonymous?: undefined;
|
|
119
|
+
outputs?: undefined;
|
|
120
|
+
} | {
|
|
121
|
+
anonymous: boolean;
|
|
122
|
+
inputs: {
|
|
123
|
+
indexed: boolean;
|
|
124
|
+
internalType: string;
|
|
125
|
+
name: string;
|
|
126
|
+
type: string;
|
|
127
|
+
}[];
|
|
128
|
+
name: string;
|
|
129
|
+
type: string;
|
|
130
|
+
stateMutability?: undefined;
|
|
131
|
+
outputs?: undefined;
|
|
132
|
+
} | {
|
|
133
|
+
inputs: {
|
|
134
|
+
internalType: string;
|
|
135
|
+
name: string;
|
|
136
|
+
type: string;
|
|
137
|
+
}[];
|
|
138
|
+
name: string;
|
|
139
|
+
outputs: {
|
|
140
|
+
components: {
|
|
141
|
+
internalType: string;
|
|
142
|
+
name: string;
|
|
143
|
+
type: string;
|
|
144
|
+
}[];
|
|
145
|
+
internalType: string;
|
|
146
|
+
name: string;
|
|
147
|
+
type: string;
|
|
148
|
+
}[];
|
|
149
|
+
stateMutability: string;
|
|
150
|
+
type: string;
|
|
151
|
+
anonymous?: undefined;
|
|
152
|
+
} | {
|
|
153
|
+
inputs: {
|
|
154
|
+
internalType: string;
|
|
155
|
+
name: string;
|
|
156
|
+
type: string;
|
|
157
|
+
}[];
|
|
158
|
+
name: string;
|
|
159
|
+
outputs: {
|
|
160
|
+
internalType: string;
|
|
161
|
+
name: string;
|
|
162
|
+
type: string;
|
|
163
|
+
}[];
|
|
164
|
+
stateMutability: string;
|
|
165
|
+
type: string;
|
|
166
|
+
anonymous?: undefined;
|
|
167
|
+
})[];
|
|
168
|
+
/**
|
|
169
|
+
* Get the contract address
|
|
170
|
+
*/
|
|
171
|
+
getAddress(): string;
|
|
172
|
+
/**
|
|
173
|
+
* List an NFT for sale
|
|
174
|
+
* @param params Listing parameters
|
|
175
|
+
* @param signer Wallet signer with sendTransaction method
|
|
176
|
+
*/
|
|
177
|
+
listItem(params: ListingParams, signer: {
|
|
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: {
|
|
188
|
+
sendTransaction: (tx: object) => Promise<{
|
|
189
|
+
hash: string;
|
|
190
|
+
}>;
|
|
191
|
+
}): Promise<TxResult>;
|
|
192
|
+
/**
|
|
193
|
+
* Cancel a listing
|
|
194
|
+
* @param listingId The listing ID to cancel
|
|
195
|
+
* @param signer Wallet signer
|
|
196
|
+
*/
|
|
197
|
+
cancelListing(listingId: string, signer: {
|
|
198
|
+
sendTransaction: (tx: object) => Promise<{
|
|
199
|
+
hash: string;
|
|
200
|
+
}>;
|
|
201
|
+
}): Promise<TxResult>;
|
|
202
|
+
/**
|
|
203
|
+
* Update listing price
|
|
204
|
+
* @param listingId The listing ID
|
|
205
|
+
* @param newPrice New price
|
|
206
|
+
* @param signer Wallet signer
|
|
207
|
+
*/
|
|
208
|
+
updatePrice(listingId: string, newPrice: bigint, signer: {
|
|
209
|
+
sendTransaction: (tx: object) => Promise<{
|
|
210
|
+
hash: string;
|
|
211
|
+
}>;
|
|
212
|
+
}): Promise<TxResult>;
|
|
213
|
+
/**
|
|
214
|
+
* Get listing details
|
|
215
|
+
* @param listingId The listing ID
|
|
216
|
+
* @param provider JSON-RPC provider
|
|
217
|
+
*/
|
|
218
|
+
getListing(listingId: string, provider: {
|
|
219
|
+
call: (tx: object) => Promise<string>;
|
|
220
|
+
}): Promise<Listing | null>;
|
|
221
|
+
/**
|
|
222
|
+
* Check if a payment token is supported
|
|
223
|
+
* @param token Token address
|
|
224
|
+
* @param provider JSON-RPC provider
|
|
225
|
+
*/
|
|
226
|
+
isTokenSupported(token: string, provider: {
|
|
227
|
+
call: (tx: object) => Promise<string>;
|
|
228
|
+
}): Promise<boolean>;
|
|
229
|
+
/**
|
|
230
|
+
* Calculate platform fee for a given price
|
|
231
|
+
* Platform keeps 10%, Creator/Seller receives 90%
|
|
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
|
|
332
|
+
* @param signer Wallet signer with sendTransaction method
|
|
333
|
+
* @param value ETH amount to tip (in wei)
|
|
334
|
+
*/
|
|
335
|
+
tipETH(recipient: string, message: string, signer: {
|
|
336
|
+
sendTransaction: (tx: object) => Promise<{
|
|
337
|
+
hash: string;
|
|
338
|
+
}>;
|
|
339
|
+
}, value: bigint): Promise<TxResult>;
|
|
340
|
+
/**
|
|
341
|
+
* Send ERC-20 token tip to a creator
|
|
342
|
+
* @param recipient The recipient address
|
|
343
|
+
* @param token The ERC-20 token address
|
|
344
|
+
* @param amount The amount of tokens to tip
|
|
345
|
+
* @param message Optional tip message
|
|
346
|
+
* @param signer Wallet signer
|
|
347
|
+
*/
|
|
348
|
+
tipToken(recipient: string, token: string, amount: bigint, message: string, signer: {
|
|
349
|
+
sendTransaction: (tx: object) => Promise<{
|
|
350
|
+
hash: string;
|
|
351
|
+
}>;
|
|
352
|
+
}): Promise<TxResult>;
|
|
353
|
+
/**
|
|
354
|
+
* Send batch tips to multiple creators in a single transaction
|
|
355
|
+
* @param recipients Array of recipient addresses
|
|
356
|
+
* @param amounts Array of tip amounts (in wei)
|
|
357
|
+
* @param messages Array of tip messages
|
|
358
|
+
* @param signer Wallet signer
|
|
359
|
+
* @param value Total ETH to send
|
|
360
|
+
*/
|
|
361
|
+
sendBatchTips(recipients: string[], amounts: bigint[], messages: string[], signer: {
|
|
362
|
+
sendTransaction: (tx: object) => Promise<{
|
|
363
|
+
hash: string;
|
|
364
|
+
}>;
|
|
365
|
+
}, value: bigint): Promise<TxResult>;
|
|
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>;
|
|
382
|
+
/**
|
|
383
|
+
* Get platform fee in basis points
|
|
384
|
+
* @param provider JSON-RPC provider
|
|
385
|
+
*/
|
|
386
|
+
getPlatformFeeBps(provider: {
|
|
387
|
+
call: (tx: object) => Promise<string>;
|
|
388
|
+
}): Promise<number>;
|
|
389
|
+
/**
|
|
390
|
+
* Get current tip counter
|
|
391
|
+
* @param provider JSON-RPC provider
|
|
392
|
+
*/
|
|
393
|
+
getTipCounter(provider: {
|
|
394
|
+
call: (tx: object) => Promise<string>;
|
|
395
|
+
}): Promise<bigint>;
|
|
396
|
+
/**
|
|
397
|
+
* Get treasury address
|
|
398
|
+
* @param provider JSON-RPC provider
|
|
399
|
+
*/
|
|
400
|
+
getTreasury(provider: {
|
|
401
|
+
call: (tx: object) => Promise<string>;
|
|
402
|
+
}): Promise<string>;
|
|
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>;
|
|
523
|
+
/**
|
|
524
|
+
* Subscribe to a creator's plan
|
|
525
|
+
* @param planId The plan ID to subscribe to
|
|
526
|
+
* @param months Number of months to subscribe
|
|
527
|
+
* @param signer Wallet signer
|
|
528
|
+
* @param value ETH value to send (if paying with ETH)
|
|
529
|
+
*/
|
|
530
|
+
subscribe(planId: string, months: number, signer: {
|
|
531
|
+
sendTransaction: (tx: object) => Promise<{
|
|
532
|
+
hash: string;
|
|
533
|
+
}>;
|
|
534
|
+
}, value?: bigint): Promise<TxResult>;
|
|
535
|
+
/**
|
|
536
|
+
* Cancel an active subscription
|
|
537
|
+
* @param subscriptionId The subscription ID to cancel
|
|
538
|
+
* @param signer Wallet signer
|
|
539
|
+
*/
|
|
540
|
+
cancel(subscriptionId: string, signer: {
|
|
541
|
+
sendTransaction: (tx: object) => Promise<{
|
|
542
|
+
hash: string;
|
|
543
|
+
}>;
|
|
544
|
+
}): Promise<TxResult>;
|
|
545
|
+
/**
|
|
546
|
+
* Set auto-renew for a subscription
|
|
547
|
+
* @param subscriptionId The subscription ID
|
|
548
|
+
* @param autoRenew Whether to enable auto-renew
|
|
549
|
+
* @param signer Wallet signer
|
|
550
|
+
*/
|
|
551
|
+
setAutoRenew(subscriptionId: string, autoRenew: boolean, signer: {
|
|
552
|
+
sendTransaction: (tx: object) => Promise<{
|
|
553
|
+
hash: string;
|
|
554
|
+
}>;
|
|
555
|
+
}): Promise<TxResult>;
|
|
556
|
+
/**
|
|
557
|
+
* Check if an address is subscribed to a creator
|
|
558
|
+
* @param subscriber The subscriber address
|
|
559
|
+
* @param creator The creator address
|
|
560
|
+
* @param provider JSON-RPC provider
|
|
561
|
+
*/
|
|
562
|
+
isSubscribed(subscriber: string, creator: string, provider: {
|
|
563
|
+
call: (tx: object) => Promise<string>;
|
|
564
|
+
}): Promise<boolean>;
|
|
565
|
+
/**
|
|
566
|
+
* Get the active subscription ID between subscriber and creator
|
|
567
|
+
* @param subscriber The subscriber address
|
|
568
|
+
* @param creator The creator address
|
|
569
|
+
* @param provider JSON-RPC provider
|
|
570
|
+
*/
|
|
571
|
+
getActiveSubscriptionId(subscriber: string, creator: string, provider: {
|
|
572
|
+
call: (tx: object) => Promise<string>;
|
|
573
|
+
}): Promise<string | null>;
|
|
574
|
+
/**
|
|
575
|
+
* Get subscription details by ID
|
|
576
|
+
* @param subscriptionId The subscription ID
|
|
577
|
+
* @param provider JSON-RPC provider
|
|
578
|
+
*/
|
|
579
|
+
getSubscription(subscriptionId: string, provider: {
|
|
580
|
+
call: (tx: object) => Promise<string>;
|
|
581
|
+
}): Promise<Subscription | null>;
|
|
582
|
+
/**
|
|
583
|
+
* Get a specific plan by ID
|
|
584
|
+
* @param planId The plan ID
|
|
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
|
|
593
|
+
* @param provider JSON-RPC provider
|
|
594
|
+
*/
|
|
595
|
+
getCreatorPlanIds(creator: string, provider: {
|
|
596
|
+
call: (tx: object) => Promise<string>;
|
|
597
|
+
}): 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
|
+
/**
|
|
607
|
+
* Get platform fee in basis points
|
|
608
|
+
* @param provider JSON-RPC provider
|
|
609
|
+
*/
|
|
610
|
+
getPlatformFeeBps(provider: {
|
|
611
|
+
call: (tx: object) => Promise<string>;
|
|
612
|
+
}): Promise<number>;
|
|
613
|
+
/**
|
|
614
|
+
* Calculate the total cost for a subscription
|
|
615
|
+
* @param planPrice The plan price per period
|
|
616
|
+
* @param months Number of months
|
|
617
|
+
*/
|
|
618
|
+
calculateSubscriptionCost(planPrice: bigint, months: number): bigint;
|
|
619
|
+
/**
|
|
620
|
+
* Calculate platform fee for a given amount
|
|
621
|
+
* @param amount The amount
|
|
622
|
+
* @param feeBps Fee in basis points (default: 1000 = 10%)
|
|
623
|
+
* Platform keeps 10%, Creator receives 90%
|
|
624
|
+
*/
|
|
625
|
+
calculateFee(amount: bigint, feeBps?: number): {
|
|
626
|
+
fee: bigint;
|
|
627
|
+
creatorAmount: bigint;
|
|
628
|
+
};
|
|
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
|
+
/**
|
|
718
|
+
* Convert earnings to stablecoin (USDT) via swap
|
|
719
|
+
* This will be implemented when SwapService is complete
|
|
720
|
+
*/
|
|
721
|
+
convertToStable(token: string, amount: bigint, swapService?: {
|
|
722
|
+
executeSwap: (params: object) => Promise<TxResult>;
|
|
723
|
+
}): Promise<TxResult>;
|
|
724
|
+
/**
|
|
725
|
+
* Get the contract address
|
|
726
|
+
*/
|
|
727
|
+
getContractAddress(): string;
|
|
728
|
+
/**
|
|
729
|
+
* Get the chain ID
|
|
730
|
+
*/
|
|
731
|
+
getChainId(): number;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
export { ZubariNFTProtocol as Z, ZubariMarketProtocol as a, ZubariTipsProtocol as b, ZubariSubscriptionProtocol as c, ZubariPayoutsProtocol as d };
|