pepay-streams-sdk 0.1.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/README.md +405 -0
- package/dist/api/index.d.mts +321 -0
- package/dist/api/index.d.ts +321 -0
- package/dist/api/index.js +312 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/index.mjs +306 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/automation/index.d.mts +140 -0
- package/dist/automation/index.d.ts +140 -0
- package/dist/automation/index.js +331 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/automation/index.mjs +326 -0
- package/dist/automation/index.mjs.map +1 -0
- package/dist/campaigns/index.d.mts +286 -0
- package/dist/campaigns/index.d.ts +286 -0
- package/dist/campaigns/index.js +652 -0
- package/dist/campaigns/index.js.map +1 -0
- package/dist/campaigns/index.mjs +645 -0
- package/dist/campaigns/index.mjs.map +1 -0
- package/dist/claims/index.d.mts +190 -0
- package/dist/claims/index.d.ts +190 -0
- package/dist/claims/index.js +414 -0
- package/dist/claims/index.js.map +1 -0
- package/dist/claims/index.mjs +409 -0
- package/dist/claims/index.mjs.map +1 -0
- package/dist/index-BTG0TRJt.d.mts +555 -0
- package/dist/index-BTG0TRJt.d.ts +555 -0
- package/dist/index.d.mts +170 -0
- package/dist/index.d.ts +170 -0
- package/dist/index.js +2926 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2888 -0
- package/dist/index.mjs.map +1 -0
- package/dist/marketplace/index.d.mts +225 -0
- package/dist/marketplace/index.d.ts +225 -0
- package/dist/marketplace/index.js +529 -0
- package/dist/marketplace/index.js.map +1 -0
- package/dist/marketplace/index.mjs +524 -0
- package/dist/marketplace/index.mjs.map +1 -0
- package/dist/react/index.d.mts +185 -0
- package/dist/react/index.d.ts +185 -0
- package/dist/react/index.js +340 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/index.mjs +333 -0
- package/dist/react/index.mjs.map +1 -0
- package/dist/staking/index.d.mts +158 -0
- package/dist/staking/index.d.ts +158 -0
- package/dist/staking/index.js +359 -0
- package/dist/staking/index.js.map +1 -0
- package/dist/staking/index.mjs +354 -0
- package/dist/staking/index.mjs.map +1 -0
- package/package.json +106 -0
- package/src/api/index.ts +577 -0
- package/src/automation/index.ts +436 -0
- package/src/campaigns/index.ts +835 -0
- package/src/claims/index.ts +530 -0
- package/src/client.ts +518 -0
- package/src/index.ts +101 -0
- package/src/marketplace/index.ts +730 -0
- package/src/react/index.ts +498 -0
- package/src/staking/index.ts +449 -0
- package/src/types/index.ts +631 -0
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types for Pepay Streams SDK
|
|
3
|
+
*/
|
|
4
|
+
import type { Address, Hash, Hex } from 'viem';
|
|
5
|
+
|
|
6
|
+
// Re-export shared types
|
|
7
|
+
export {
|
|
8
|
+
CampaignKind,
|
|
9
|
+
DeliveryKind,
|
|
10
|
+
OrderStatus,
|
|
11
|
+
ChangePolicy,
|
|
12
|
+
StartMode,
|
|
13
|
+
Visibility,
|
|
14
|
+
StatusBits,
|
|
15
|
+
type CampaignKindString,
|
|
16
|
+
type DeliveryKindString,
|
|
17
|
+
type OrderStatusString,
|
|
18
|
+
type ChangePolicyString,
|
|
19
|
+
} from '@pepay-streams/shared';
|
|
20
|
+
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Core SDK Types
|
|
23
|
+
// ============================================================================
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* SDK configuration options
|
|
27
|
+
*/
|
|
28
|
+
export interface PepayStreamsConfig {
|
|
29
|
+
/** RPC URL for blockchain connection */
|
|
30
|
+
rpcUrl: string;
|
|
31
|
+
/** Diamond contract address */
|
|
32
|
+
diamondAddress: Address;
|
|
33
|
+
/** Chain ID (e.g., 1 for Ethereum, 56 for BSC, 31337 for local) */
|
|
34
|
+
chainId: number;
|
|
35
|
+
/** API base URL for indexed data (optional) */
|
|
36
|
+
apiBaseUrl?: string;
|
|
37
|
+
/** WETH address (auto-detected if not provided) */
|
|
38
|
+
wethAddress?: Address;
|
|
39
|
+
/** Permit2 address (canonical if not provided) */
|
|
40
|
+
permit2Address?: Address;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Transaction result from SDK operations
|
|
45
|
+
*/
|
|
46
|
+
export interface TransactionResult {
|
|
47
|
+
/** Transaction hash */
|
|
48
|
+
hash: Hash;
|
|
49
|
+
/** Wait for transaction confirmation */
|
|
50
|
+
wait: () => Promise<TransactionReceipt>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Transaction receipt after confirmation
|
|
55
|
+
*/
|
|
56
|
+
export interface TransactionReceipt {
|
|
57
|
+
/** Block number */
|
|
58
|
+
blockNumber: bigint;
|
|
59
|
+
/** Transaction hash */
|
|
60
|
+
transactionHash: Hash;
|
|
61
|
+
/** Gas used */
|
|
62
|
+
gasUsed: bigint;
|
|
63
|
+
/** Status (1 = success, 0 = failed) */
|
|
64
|
+
status: 'success' | 'reverted';
|
|
65
|
+
/** Decoded logs/events */
|
|
66
|
+
logs: unknown[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// ============================================================================
|
|
70
|
+
// Recipient Types
|
|
71
|
+
// ============================================================================
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Recipient allocation in a campaign
|
|
75
|
+
*/
|
|
76
|
+
export interface Recipient {
|
|
77
|
+
/** Recipient wallet address */
|
|
78
|
+
address: Address;
|
|
79
|
+
/** Allocated amount in wei */
|
|
80
|
+
amount: bigint;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Recipient with cliff override for vested campaigns
|
|
85
|
+
*/
|
|
86
|
+
export interface RecipientWithCliff extends Recipient {
|
|
87
|
+
/** Optional cliff duration override in seconds */
|
|
88
|
+
cliffDuration?: number;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Recipient status from contract
|
|
93
|
+
*/
|
|
94
|
+
export interface RecipientStatus {
|
|
95
|
+
/** Total allocated to recipient */
|
|
96
|
+
allocated: bigint;
|
|
97
|
+
/** Amount already claimed */
|
|
98
|
+
claimed: bigint;
|
|
99
|
+
/** Amount currently due (claimable now) */
|
|
100
|
+
due: bigint;
|
|
101
|
+
/** Whether recipient is blocked */
|
|
102
|
+
blocked: boolean;
|
|
103
|
+
/** Whether recipient has claimed all */
|
|
104
|
+
fullyVested: boolean;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ============================================================================
|
|
108
|
+
// Campaign Types
|
|
109
|
+
// ============================================================================
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Base parameters for all campaign types
|
|
113
|
+
*/
|
|
114
|
+
export interface BaseCampaignParams {
|
|
115
|
+
/** Token to distribute */
|
|
116
|
+
token: Address;
|
|
117
|
+
/** Campaign name (max 32 bytes) - not stored on-chain */
|
|
118
|
+
name?: string;
|
|
119
|
+
/** Fee buffer for fee-on-transfer tokens in wei */
|
|
120
|
+
feeBuffer?: bigint;
|
|
121
|
+
/** Change policy for recipient updates */
|
|
122
|
+
changePolicy?: 'only_recipient' | 'only_creator' | 'both' | 'no_one';
|
|
123
|
+
/** Enable trading on marketplace */
|
|
124
|
+
attachDefaultRegistry?: boolean;
|
|
125
|
+
/** Whether campaign can be canceled */
|
|
126
|
+
cancelable?: boolean;
|
|
127
|
+
/** Whether recipients can only claim once */
|
|
128
|
+
claimOnce?: boolean;
|
|
129
|
+
/** Auto-claim incentive in basis points (for keepers) */
|
|
130
|
+
autoClaimIncentiveBps?: number;
|
|
131
|
+
/** Claim grace period in seconds */
|
|
132
|
+
claimGrace?: number;
|
|
133
|
+
/** Whether to unwrap WETH to native on claim */
|
|
134
|
+
unwrapWETH?: boolean;
|
|
135
|
+
/** WETH contract address (for unwrap feature) */
|
|
136
|
+
weth?: Address;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Parameters for creating an Instant Airdrop
|
|
141
|
+
*/
|
|
142
|
+
export interface InstantAirdropParams extends BaseCampaignParams {
|
|
143
|
+
/** List of recipients and amounts */
|
|
144
|
+
recipients: Recipient[];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Parameters for creating a Vested Airdrop
|
|
149
|
+
*/
|
|
150
|
+
export interface VestedAirdropParams extends BaseCampaignParams {
|
|
151
|
+
/** List of recipients and amounts */
|
|
152
|
+
recipients: RecipientWithCliff[];
|
|
153
|
+
/** Vesting start timestamp (Unix seconds) */
|
|
154
|
+
startTime: number;
|
|
155
|
+
/** Total vesting duration in seconds */
|
|
156
|
+
duration: number;
|
|
157
|
+
/** Cliff duration in seconds (tokens locked until cliff passes) */
|
|
158
|
+
cliffDuration?: number;
|
|
159
|
+
/** Number of vesting steps (releases are linear between steps) */
|
|
160
|
+
steps?: number;
|
|
161
|
+
/** Cliff release percentage in basis points (0-10000) */
|
|
162
|
+
cliffBps?: number;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Parameters for creating a Token Lock
|
|
167
|
+
*/
|
|
168
|
+
export interface LockParams extends BaseCampaignParams {
|
|
169
|
+
/** Recipient of the locked tokens */
|
|
170
|
+
recipient: Address;
|
|
171
|
+
/** Amount to lock in wei */
|
|
172
|
+
amount: bigint;
|
|
173
|
+
/** Unlock timestamp (Unix seconds) */
|
|
174
|
+
unlockTime: number;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Parameters for creating a Vesting stream (Payment)
|
|
179
|
+
*/
|
|
180
|
+
export interface VestingParams extends BaseCampaignParams {
|
|
181
|
+
/** Recipient of the vesting stream */
|
|
182
|
+
recipient: Address;
|
|
183
|
+
/** Total amount to vest in wei */
|
|
184
|
+
amount: bigint;
|
|
185
|
+
/** Vesting start timestamp (Unix seconds) */
|
|
186
|
+
startTime: number;
|
|
187
|
+
/** Total vesting duration in seconds */
|
|
188
|
+
duration: number;
|
|
189
|
+
/** Cliff duration in seconds */
|
|
190
|
+
cliffDuration?: number;
|
|
191
|
+
/** Number of vesting steps */
|
|
192
|
+
steps?: number;
|
|
193
|
+
/** Cliff release percentage in basis points (0-10000) */
|
|
194
|
+
cliffBps?: number;
|
|
195
|
+
/** Enable auto-withdraw automation */
|
|
196
|
+
enableAutoWithdraw?: boolean;
|
|
197
|
+
/** Auto-withdraw frequency in seconds */
|
|
198
|
+
autoWithdrawFrequency?: number;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Campaign info from contract
|
|
203
|
+
*/
|
|
204
|
+
export interface CampaignInfo {
|
|
205
|
+
/** Campaign ID */
|
|
206
|
+
id: bigint;
|
|
207
|
+
/** Campaign kind/type */
|
|
208
|
+
kind: 'instant_airdrop' | 'vested_airdrop' | 'lock' | 'vesting';
|
|
209
|
+
/** Token being distributed */
|
|
210
|
+
token: Address;
|
|
211
|
+
/** Campaign creator */
|
|
212
|
+
creator: Address;
|
|
213
|
+
/** Campaign name (not stored on-chain, may be empty) */
|
|
214
|
+
name: string;
|
|
215
|
+
/** Total allocated amount */
|
|
216
|
+
totalAllocated: bigint;
|
|
217
|
+
/** Total funded amount */
|
|
218
|
+
totalFunded: bigint;
|
|
219
|
+
/** Total claimed amount */
|
|
220
|
+
totalClaimed: bigint;
|
|
221
|
+
/** Total returned to creator */
|
|
222
|
+
totalReturned: bigint;
|
|
223
|
+
/** Fee loss from transfers */
|
|
224
|
+
feeLoss: bigint;
|
|
225
|
+
/** Fee buffer remaining */
|
|
226
|
+
feeBuffer: bigint;
|
|
227
|
+
/** Vesting start time */
|
|
228
|
+
startTime: number;
|
|
229
|
+
/** Vesting end time */
|
|
230
|
+
endTime: number;
|
|
231
|
+
/** Cliff end time */
|
|
232
|
+
cliffTime: number;
|
|
233
|
+
/** Number of vesting steps */
|
|
234
|
+
steps: number;
|
|
235
|
+
/** Number of recipients */
|
|
236
|
+
recipientCount: number;
|
|
237
|
+
/** Status bits (paused, finalized, etc.) */
|
|
238
|
+
statusBits: number;
|
|
239
|
+
/** Change policy */
|
|
240
|
+
changePolicy: number;
|
|
241
|
+
/** Whether automation is enabled */
|
|
242
|
+
hasAutomation: boolean;
|
|
243
|
+
/** Whether campaign has a trading registry attached */
|
|
244
|
+
hasRegistry?: boolean;
|
|
245
|
+
/** Merkle root for merkle-based campaigns */
|
|
246
|
+
merkleRoot?: Hex;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// ============================================================================
|
|
250
|
+
// Staking Types
|
|
251
|
+
// ============================================================================
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Parameters for creating a staking pool
|
|
255
|
+
*/
|
|
256
|
+
export interface CreatePoolParams {
|
|
257
|
+
/** Token users stake */
|
|
258
|
+
stakeToken: Address;
|
|
259
|
+
/** Token users earn as rewards */
|
|
260
|
+
rewardToken: Address;
|
|
261
|
+
/** Total reward budget in wei */
|
|
262
|
+
rewardBudget: bigint;
|
|
263
|
+
/** Pool duration in seconds */
|
|
264
|
+
duration: number;
|
|
265
|
+
/** Minimum stake amount (optional) */
|
|
266
|
+
minStake?: bigint;
|
|
267
|
+
/** Maximum stake per user (optional, 0 = unlimited) */
|
|
268
|
+
maxStake?: bigint;
|
|
269
|
+
/** Pool name for identification */
|
|
270
|
+
name?: string;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Staking pool info from contract
|
|
275
|
+
*/
|
|
276
|
+
export interface PoolInfo {
|
|
277
|
+
/** Pool ID */
|
|
278
|
+
id: bigint;
|
|
279
|
+
/** Token being staked */
|
|
280
|
+
stakeToken: Address;
|
|
281
|
+
/** Reward token */
|
|
282
|
+
rewardToken: Address;
|
|
283
|
+
/** Pool creator */
|
|
284
|
+
creator: Address;
|
|
285
|
+
/** Total staked amount */
|
|
286
|
+
totalStaked: bigint;
|
|
287
|
+
/** Total reward budget */
|
|
288
|
+
rewardBudget: bigint;
|
|
289
|
+
/** Rewards distributed so far */
|
|
290
|
+
rewardsDistributed: bigint;
|
|
291
|
+
/** Pool start time */
|
|
292
|
+
startTime: number;
|
|
293
|
+
/** Pool end time */
|
|
294
|
+
endTime: number;
|
|
295
|
+
/** Minimum stake amount */
|
|
296
|
+
minStake: bigint;
|
|
297
|
+
/** Maximum stake per user */
|
|
298
|
+
maxStake: bigint;
|
|
299
|
+
/** Number of stakers */
|
|
300
|
+
stakerCount: number;
|
|
301
|
+
/** Whether pool is active */
|
|
302
|
+
isActive: boolean;
|
|
303
|
+
/** Whether pool is finalized */
|
|
304
|
+
isFinalized: boolean;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* User stake info
|
|
309
|
+
*/
|
|
310
|
+
export interface UserStake {
|
|
311
|
+
/** Amount staked */
|
|
312
|
+
amount: bigint;
|
|
313
|
+
/** Pending rewards */
|
|
314
|
+
pendingRewards: bigint;
|
|
315
|
+
/** Last claim timestamp */
|
|
316
|
+
lastClaimTime: number;
|
|
317
|
+
/** Stake start time */
|
|
318
|
+
stakeTime: number;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// ============================================================================
|
|
322
|
+
// Marketplace Types
|
|
323
|
+
// ============================================================================
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Order type for marketplace
|
|
327
|
+
*/
|
|
328
|
+
export type OrderType = 'instant' | 'vested' | 'tradable';
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Parameters for creating an INSTANT order
|
|
332
|
+
*/
|
|
333
|
+
export interface CreateInstantOrderParams {
|
|
334
|
+
/** Token to sell */
|
|
335
|
+
sellToken: Address;
|
|
336
|
+
/** Amount to sell in wei */
|
|
337
|
+
sellAmount: bigint;
|
|
338
|
+
/** Token to receive as payment */
|
|
339
|
+
payToken: Address;
|
|
340
|
+
/** Price per token in pay token wei */
|
|
341
|
+
pricePerToken: bigint;
|
|
342
|
+
/** Private buyers (empty = public) */
|
|
343
|
+
privateBuyers?: Address[];
|
|
344
|
+
/** Order expiry TTL in seconds */
|
|
345
|
+
expiryTTL?: number;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Parameters for creating a VESTED order
|
|
350
|
+
*/
|
|
351
|
+
export interface CreateVestedOrderParams extends CreateInstantOrderParams {
|
|
352
|
+
/** Vesting duration in seconds */
|
|
353
|
+
vestingDuration: number;
|
|
354
|
+
/** Cliff duration in seconds */
|
|
355
|
+
cliffDuration?: number;
|
|
356
|
+
/** Start mode: when vesting starts */
|
|
357
|
+
startMode?: 'upon_fill' | 'fixed_timestamp';
|
|
358
|
+
/** Fixed start timestamp (if startMode is fixed_timestamp) */
|
|
359
|
+
fixedStartTime?: number;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Parameters for creating a TRADABLE order (listing unvested position)
|
|
364
|
+
*/
|
|
365
|
+
export interface CreateTradableOrderParams {
|
|
366
|
+
/** Campaign ID to list position from */
|
|
367
|
+
campaignId: bigint;
|
|
368
|
+
/** Price per token in pay token wei */
|
|
369
|
+
pricePerToken: bigint;
|
|
370
|
+
/** Token to receive as payment (use zero address for native) */
|
|
371
|
+
payToken: Address;
|
|
372
|
+
/** Private buyers (empty = public) */
|
|
373
|
+
privateBuyers?: Address[];
|
|
374
|
+
/** Order expiry TTL in seconds */
|
|
375
|
+
expiryTTL?: number;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Marketplace order info
|
|
380
|
+
*/
|
|
381
|
+
export interface OrderInfo {
|
|
382
|
+
/** Order ID */
|
|
383
|
+
id: bigint;
|
|
384
|
+
/** Order type */
|
|
385
|
+
orderType: OrderType;
|
|
386
|
+
/** Seller address */
|
|
387
|
+
seller: Address;
|
|
388
|
+
/** Token being sold */
|
|
389
|
+
sellToken: Address;
|
|
390
|
+
/** Amount being sold */
|
|
391
|
+
sellAmount: bigint;
|
|
392
|
+
/** Payment token */
|
|
393
|
+
payToken: Address;
|
|
394
|
+
/** Total price */
|
|
395
|
+
totalPrice: bigint;
|
|
396
|
+
/** Price per token */
|
|
397
|
+
pricePerToken: bigint;
|
|
398
|
+
/** Order status */
|
|
399
|
+
status: 'open' | 'filled' | 'canceled' | 'expired';
|
|
400
|
+
/** Buyer (if filled) */
|
|
401
|
+
buyer?: Address;
|
|
402
|
+
/** Creation timestamp */
|
|
403
|
+
createdAt: number;
|
|
404
|
+
/** Expiry timestamp */
|
|
405
|
+
expiresAt: number;
|
|
406
|
+
/** Associated campaign ID (for tradable) */
|
|
407
|
+
campaignId?: bigint;
|
|
408
|
+
/** Vesting params (for vested orders) */
|
|
409
|
+
vestingDuration?: number;
|
|
410
|
+
cliffDuration?: number;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Quote for filling an order
|
|
415
|
+
*/
|
|
416
|
+
export interface OrderQuote {
|
|
417
|
+
/** Order ID */
|
|
418
|
+
orderId: bigint;
|
|
419
|
+
/** Total price to pay */
|
|
420
|
+
totalPrice: bigint;
|
|
421
|
+
/** Protocol fee */
|
|
422
|
+
protocolFee: bigint;
|
|
423
|
+
/** Amount buyer receives */
|
|
424
|
+
buyerReceives: bigint;
|
|
425
|
+
/** Amount seller receives after fees */
|
|
426
|
+
sellerReceives: bigint;
|
|
427
|
+
/** Whether order is still valid */
|
|
428
|
+
isValid: boolean;
|
|
429
|
+
/** Expiry timestamp */
|
|
430
|
+
expiresAt: number;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// ============================================================================
|
|
434
|
+
// Automation Types
|
|
435
|
+
// ============================================================================
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Parameters for enabling auto-withdraw
|
|
439
|
+
*/
|
|
440
|
+
export interface EnableAutoWithdrawParams {
|
|
441
|
+
/** Campaign ID */
|
|
442
|
+
campaignId: bigint;
|
|
443
|
+
/** Frequency in seconds between auto-withdraws */
|
|
444
|
+
frequency: number;
|
|
445
|
+
/** Tip amount in native wei for keeper */
|
|
446
|
+
tipAmount?: bigint;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Parameters for enabling auto-release (locks)
|
|
451
|
+
*/
|
|
452
|
+
export interface EnableAutoReleaseParams {
|
|
453
|
+
/** Campaign ID (must be a Lock) */
|
|
454
|
+
campaignId: bigint;
|
|
455
|
+
/** Tip amount in native wei for keeper */
|
|
456
|
+
tipAmount?: bigint;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Automation status for a campaign
|
|
461
|
+
*/
|
|
462
|
+
export interface AutomationStatus {
|
|
463
|
+
/** Whether automation is enabled */
|
|
464
|
+
enabled: boolean;
|
|
465
|
+
/** Last run timestamp */
|
|
466
|
+
lastRun: number;
|
|
467
|
+
/** Next eligible run timestamp */
|
|
468
|
+
nextRun: number;
|
|
469
|
+
/** Frequency between runs */
|
|
470
|
+
frequency: number;
|
|
471
|
+
/** Remaining tip balance */
|
|
472
|
+
tipBalance: bigint;
|
|
473
|
+
/** Number of recipients processed */
|
|
474
|
+
recipientsProcessed: number;
|
|
475
|
+
/** Total recipients */
|
|
476
|
+
totalRecipients: number;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// ============================================================================
|
|
480
|
+
// Claim Types
|
|
481
|
+
// ============================================================================
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Claim parameters
|
|
485
|
+
*
|
|
486
|
+
* For direct campaigns, allocation should be 0n and proof should be empty [].
|
|
487
|
+
* For merkle campaigns, provide allocation and proof.
|
|
488
|
+
*/
|
|
489
|
+
export interface ClaimParams {
|
|
490
|
+
/** Campaign ID */
|
|
491
|
+
campaignId: bigint;
|
|
492
|
+
/** Allocation amount for merkle claims (0 for direct campaigns) */
|
|
493
|
+
allocation?: bigint;
|
|
494
|
+
/** Merkle proof (empty array for direct campaigns) */
|
|
495
|
+
proof?: Hex[];
|
|
496
|
+
/** Claim to specific address (optional, defaults to caller) */
|
|
497
|
+
claimTo?: Address;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Batch claim parameters - claims for multiple recipients in a single campaign
|
|
502
|
+
*/
|
|
503
|
+
export interface BatchClaimParams {
|
|
504
|
+
/** Campaign ID */
|
|
505
|
+
campaignId: bigint;
|
|
506
|
+
/** List of recipients to claim for */
|
|
507
|
+
recipients: Address[];
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Meta-transaction claim parameters (gasless)
|
|
512
|
+
*
|
|
513
|
+
* All fields from the ClaimAuth struct required for signature verification.
|
|
514
|
+
*/
|
|
515
|
+
export interface MetaClaimParams {
|
|
516
|
+
/** Campaign ID */
|
|
517
|
+
campaignId: bigint;
|
|
518
|
+
/** Claimant address (who is claiming) */
|
|
519
|
+
claimant: Address;
|
|
520
|
+
/** Payout destination (optional, defaults to claimant) */
|
|
521
|
+
payoutTo?: Address;
|
|
522
|
+
/** Allocation amount */
|
|
523
|
+
allocation: bigint;
|
|
524
|
+
/** Merkle proof (empty array for direct campaigns) */
|
|
525
|
+
proof: Hex[];
|
|
526
|
+
/** EIP-712 signature from claimant */
|
|
527
|
+
signature: Hex;
|
|
528
|
+
/** Signature deadline timestamp (Unix seconds) */
|
|
529
|
+
deadline: number;
|
|
530
|
+
/** Nonce for replay protection */
|
|
531
|
+
nonce: bigint;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Merkle claim parameters
|
|
536
|
+
*/
|
|
537
|
+
export interface MerkleClaimParams {
|
|
538
|
+
/** Campaign ID */
|
|
539
|
+
campaignId: bigint;
|
|
540
|
+
/** Claimable amount */
|
|
541
|
+
amount: bigint;
|
|
542
|
+
/** Merkle proof */
|
|
543
|
+
proof: Hex[];
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Claim result
|
|
548
|
+
*/
|
|
549
|
+
export interface ClaimResult {
|
|
550
|
+
/** Transaction hash */
|
|
551
|
+
hash: Hash;
|
|
552
|
+
/** Amount claimed (gross) */
|
|
553
|
+
grossAmount: bigint;
|
|
554
|
+
/** Amount received (net, after any token fees) */
|
|
555
|
+
netAmount: bigint;
|
|
556
|
+
/** Whether fee was waived due to token issues */
|
|
557
|
+
feeWaived: boolean;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// ============================================================================
|
|
561
|
+
// API Response Types
|
|
562
|
+
// ============================================================================
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Paginated response wrapper
|
|
566
|
+
*/
|
|
567
|
+
export interface PaginatedResponse<T> {
|
|
568
|
+
/** Data items */
|
|
569
|
+
data: T[];
|
|
570
|
+
/** Total count */
|
|
571
|
+
total: number;
|
|
572
|
+
/** Current page */
|
|
573
|
+
page: number;
|
|
574
|
+
/** Items per page */
|
|
575
|
+
pageSize: number;
|
|
576
|
+
/** Whether more pages exist */
|
|
577
|
+
hasMore: boolean;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* API campaign response (from indexed data)
|
|
582
|
+
*/
|
|
583
|
+
export interface ApiCampaign {
|
|
584
|
+
id: string;
|
|
585
|
+
chainId: number;
|
|
586
|
+
kind: string;
|
|
587
|
+
token: Address;
|
|
588
|
+
creator: Address;
|
|
589
|
+
name: string;
|
|
590
|
+
totalAllocated: string;
|
|
591
|
+
totalClaimed: string;
|
|
592
|
+
recipientCount: number;
|
|
593
|
+
startTime: string;
|
|
594
|
+
endTime: string;
|
|
595
|
+
createdAt: string;
|
|
596
|
+
status: string;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* API order response (from indexed data)
|
|
601
|
+
*/
|
|
602
|
+
export interface ApiOrder {
|
|
603
|
+
id: string;
|
|
604
|
+
chainId: number;
|
|
605
|
+
orderType: string;
|
|
606
|
+
seller: Address;
|
|
607
|
+
sellToken: Address;
|
|
608
|
+
sellAmount: string;
|
|
609
|
+
payToken: Address;
|
|
610
|
+
totalPrice: string;
|
|
611
|
+
status: string;
|
|
612
|
+
createdAt: string;
|
|
613
|
+
expiresAt: string;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* API staking pool response (from indexed data)
|
|
618
|
+
*/
|
|
619
|
+
export interface ApiStakingPool {
|
|
620
|
+
id: string;
|
|
621
|
+
chainId: number;
|
|
622
|
+
stakeToken: Address;
|
|
623
|
+
rewardToken: Address;
|
|
624
|
+
creator: Address;
|
|
625
|
+
totalStaked: string;
|
|
626
|
+
rewardBudget: string;
|
|
627
|
+
startTime: string;
|
|
628
|
+
endTime: string;
|
|
629
|
+
isActive: boolean;
|
|
630
|
+
stakerCount: number;
|
|
631
|
+
}
|