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.
Files changed (62) hide show
  1. package/README.md +405 -0
  2. package/dist/api/index.d.mts +321 -0
  3. package/dist/api/index.d.ts +321 -0
  4. package/dist/api/index.js +312 -0
  5. package/dist/api/index.js.map +1 -0
  6. package/dist/api/index.mjs +306 -0
  7. package/dist/api/index.mjs.map +1 -0
  8. package/dist/automation/index.d.mts +140 -0
  9. package/dist/automation/index.d.ts +140 -0
  10. package/dist/automation/index.js +331 -0
  11. package/dist/automation/index.js.map +1 -0
  12. package/dist/automation/index.mjs +326 -0
  13. package/dist/automation/index.mjs.map +1 -0
  14. package/dist/campaigns/index.d.mts +286 -0
  15. package/dist/campaigns/index.d.ts +286 -0
  16. package/dist/campaigns/index.js +652 -0
  17. package/dist/campaigns/index.js.map +1 -0
  18. package/dist/campaigns/index.mjs +645 -0
  19. package/dist/campaigns/index.mjs.map +1 -0
  20. package/dist/claims/index.d.mts +190 -0
  21. package/dist/claims/index.d.ts +190 -0
  22. package/dist/claims/index.js +414 -0
  23. package/dist/claims/index.js.map +1 -0
  24. package/dist/claims/index.mjs +409 -0
  25. package/dist/claims/index.mjs.map +1 -0
  26. package/dist/index-BTG0TRJt.d.mts +555 -0
  27. package/dist/index-BTG0TRJt.d.ts +555 -0
  28. package/dist/index.d.mts +170 -0
  29. package/dist/index.d.ts +170 -0
  30. package/dist/index.js +2926 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/index.mjs +2888 -0
  33. package/dist/index.mjs.map +1 -0
  34. package/dist/marketplace/index.d.mts +225 -0
  35. package/dist/marketplace/index.d.ts +225 -0
  36. package/dist/marketplace/index.js +529 -0
  37. package/dist/marketplace/index.js.map +1 -0
  38. package/dist/marketplace/index.mjs +524 -0
  39. package/dist/marketplace/index.mjs.map +1 -0
  40. package/dist/react/index.d.mts +185 -0
  41. package/dist/react/index.d.ts +185 -0
  42. package/dist/react/index.js +340 -0
  43. package/dist/react/index.js.map +1 -0
  44. package/dist/react/index.mjs +333 -0
  45. package/dist/react/index.mjs.map +1 -0
  46. package/dist/staking/index.d.mts +158 -0
  47. package/dist/staking/index.d.ts +158 -0
  48. package/dist/staking/index.js +359 -0
  49. package/dist/staking/index.js.map +1 -0
  50. package/dist/staking/index.mjs +354 -0
  51. package/dist/staking/index.mjs.map +1 -0
  52. package/package.json +106 -0
  53. package/src/api/index.ts +577 -0
  54. package/src/automation/index.ts +436 -0
  55. package/src/campaigns/index.ts +835 -0
  56. package/src/claims/index.ts +530 -0
  57. package/src/client.ts +518 -0
  58. package/src/index.ts +101 -0
  59. package/src/marketplace/index.ts +730 -0
  60. package/src/react/index.ts +498 -0
  61. package/src/staking/index.ts +449 -0
  62. package/src/types/index.ts +631 -0
@@ -0,0 +1,286 @@
1
+ import { PublicClient, WalletClient, Address, Hex } from 'viem';
2
+ import { I as InstantAirdropParams, T as TransactionResult, V as VestedAirdropParams, L as LockParams, a as VestingParams, C as CampaignInfo } from '../index-BTG0TRJt.js';
3
+
4
+ /**
5
+ * Campaign Creation Module
6
+ *
7
+ * Provides methods for creating all campaign types:
8
+ * - Instant Airdrops (Kind.INSTANT = 0)
9
+ * - Vested Airdrops (Kind.VESTED = 1)
10
+ * - Token Locks (Kind.LOCK = 2)
11
+ * - Vesting Streams (Kind.VESTING = 3)
12
+ */
13
+
14
+ /**
15
+ * Campaign Kind enum matching the contract
16
+ */
17
+ declare enum CampaignKind {
18
+ INSTANT = 0,
19
+ VESTED = 1,
20
+ LOCK = 2,
21
+ VESTING = 3
22
+ }
23
+ /**
24
+ * Change policy enum matching the contract
25
+ */
26
+ declare enum ChangePolicy {
27
+ ONLY_RECIPIENT = 0,
28
+ ONLY_CREATOR = 1,
29
+ BOTH = 2,
30
+ NO_ONE = 3
31
+ }
32
+ /**
33
+ * CreateArgs struct matching the contract
34
+ */
35
+ interface CreateArgs {
36
+ kind: number;
37
+ token: Address;
38
+ start: bigint;
39
+ end: bigint;
40
+ step: bigint;
41
+ cliffReleaseTime: bigint;
42
+ cliffBps: number;
43
+ autoClaimIncentiveBps: number;
44
+ cancelable: boolean;
45
+ claimOnce: boolean;
46
+ changePolicy: number;
47
+ claimGrace: bigint;
48
+ recipients: Address[];
49
+ amounts: bigint[];
50
+ feeBuffer: bigint;
51
+ attachDefaultRegistry: boolean;
52
+ unwrapWETH: boolean;
53
+ weth: Address;
54
+ }
55
+ /**
56
+ * Campaigns module for creating and managing token distribution campaigns
57
+ */
58
+ declare class CampaignsModule {
59
+ private readonly publicClient;
60
+ private readonly walletClient;
61
+ private readonly diamondAddress;
62
+ constructor(publicClient: PublicClient, walletClient: WalletClient | undefined, diamondAddress: Address);
63
+ /**
64
+ * Create an Instant Airdrop campaign
65
+ *
66
+ * Tokens are immediately claimable by recipients after funding.
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * const result = await sdk.campaigns.createInstantAirdrop({
71
+ * token: '0x...',
72
+ * recipients: [
73
+ * { address: '0x...', amount: parseEther('100') },
74
+ * { address: '0x...', amount: parseEther('50') },
75
+ * ],
76
+ * });
77
+ * console.log('Campaign created, tx:', result.hash);
78
+ * ```
79
+ */
80
+ createInstantAirdrop(params: InstantAirdropParams): Promise<TransactionResult>;
81
+ /**
82
+ * Create a Vested Airdrop campaign
83
+ *
84
+ * Tokens vest linearly over time with optional cliff period.
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const result = await sdk.campaigns.createVestedAirdrop({
89
+ * token: '0x...',
90
+ * recipients: [
91
+ * { address: '0x...', amount: parseEther('1000') },
92
+ * ],
93
+ * startTime: Math.floor(Date.now() / 1000), // Start now
94
+ * duration: 365 * 24 * 60 * 60, // 1 year
95
+ * cliffDuration: 90 * 24 * 60 * 60, // 3 month cliff
96
+ * steps: 12, // Monthly releases
97
+ * });
98
+ * ```
99
+ */
100
+ createVestedAirdrop(params: VestedAirdropParams): Promise<TransactionResult>;
101
+ /**
102
+ * Create a Token Lock
103
+ *
104
+ * Tokens are locked until a specific unlock time, then fully releasable.
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * const result = await sdk.campaigns.createLock({
109
+ * token: '0x...',
110
+ * recipient: '0x...',
111
+ * amount: parseEther('1000000'),
112
+ * unlockTime: Math.floor(Date.now() / 1000) + 180 * 24 * 60 * 60, // 6 months
113
+ * });
114
+ * ```
115
+ */
116
+ createLock(params: LockParams): Promise<TransactionResult>;
117
+ /**
118
+ * Create a Vesting Stream (Payment)
119
+ *
120
+ * Single-recipient vesting with optional automation.
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * const result = await sdk.campaigns.createVesting({
125
+ * token: '0x...',
126
+ * recipient: '0x...',
127
+ * amount: parseEther('120000'), // 120k tokens
128
+ * startTime: Math.floor(Date.now() / 1000),
129
+ * duration: 365 * 24 * 60 * 60, // 1 year
130
+ * cliffDuration: 0, // No cliff
131
+ * steps: 12, // Monthly
132
+ * });
133
+ * ```
134
+ */
135
+ createVesting(params: VestingParams): Promise<TransactionResult>;
136
+ /**
137
+ * Create a campaign with raw CreateArgs
138
+ *
139
+ * Low-level function for full control over campaign parameters.
140
+ */
141
+ createCampaign(args: CreateArgs): Promise<TransactionResult>;
142
+ /**
143
+ * Fund a campaign using EIP-2612 Permit (gasless approval)
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * const result = await sdk.campaigns.fundWithPermit({
148
+ * campaignId,
149
+ * amount: parseEther('1000'),
150
+ * deadline: Math.floor(Date.now() / 1000) + 3600,
151
+ * v: 28,
152
+ * r: '0x...',
153
+ * s: '0x...',
154
+ * });
155
+ * ```
156
+ */
157
+ fundWithPermit(params: {
158
+ campaignId: bigint;
159
+ amount: bigint;
160
+ deadline: bigint;
161
+ v: number;
162
+ r: Hex;
163
+ s: Hex;
164
+ }): Promise<TransactionResult>;
165
+ /**
166
+ * Fund a campaign using Permit2 (gasless approval)
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * const result = await sdk.campaigns.fundWithPermit2({
171
+ * campaignId,
172
+ * from: userAddress,
173
+ * amount: parseEther('1000'),
174
+ * permit2Data: encodedPermit2Data,
175
+ * });
176
+ * ```
177
+ */
178
+ fundWithPermit2(params: {
179
+ campaignId: bigint;
180
+ from: Address;
181
+ amount: bigint;
182
+ permit2Data: Hex;
183
+ }): Promise<TransactionResult>;
184
+ /**
185
+ * Return leftover tokens to creator
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * const result = await sdk.campaigns.returnLeftover(campaignId, parseEther('100'));
190
+ * ```
191
+ */
192
+ returnLeftover(campaignId: bigint, amountToReturn: bigint): Promise<TransactionResult>;
193
+ /**
194
+ * Add native tips to a campaign for automation
195
+ */
196
+ addNativeTips(campaignId: bigint, tipAmount: bigint): Promise<TransactionResult>;
197
+ /**
198
+ * Get campaign summary by ID
199
+ *
200
+ * Returns full campaign configuration and state.
201
+ *
202
+ * @example
203
+ * ```typescript
204
+ * const campaign = await sdk.campaigns.getCampaign(1n);
205
+ * console.log('Campaign token:', campaign.token);
206
+ * console.log('Total claimed:', campaign.totalClaimed);
207
+ * ```
208
+ */
209
+ getCampaign(campaignId: bigint): Promise<CampaignInfo>;
210
+ /**
211
+ * Get campaign configuration only
212
+ */
213
+ getCampaignConfig(campaignId: bigint): Promise<{
214
+ kind: number;
215
+ cancelable: boolean;
216
+ claimOnce: boolean;
217
+ canceled: boolean;
218
+ changePolicy: number;
219
+ token: Address;
220
+ creator: Address;
221
+ cliffBps: number;
222
+ autoClaimIncentiveBps: number;
223
+ start: number;
224
+ end: number;
225
+ step: number;
226
+ canceledAt: number;
227
+ cliffReleaseTime: number;
228
+ claimGrace: number;
229
+ unwrapWETH: boolean;
230
+ weth: Address;
231
+ }>;
232
+ /**
233
+ * Get campaign state (totals and accounting)
234
+ */
235
+ getCampaignState(campaignId: bigint): Promise<{
236
+ totalAllocated: bigint;
237
+ totalClaimed: bigint;
238
+ nativeTips: bigint;
239
+ returned: bigint;
240
+ feeBuffer: bigint;
241
+ feeLoss: bigint;
242
+ totalFunded: bigint;
243
+ statusBits: number;
244
+ uniqueRecipients: bigint;
245
+ }>;
246
+ /**
247
+ * Get campaign status bits
248
+ */
249
+ getCampaignStatus(campaignId: bigint): Promise<number>;
250
+ /**
251
+ * Pause a campaign (creator or admin only)
252
+ *
253
+ * @param campaignId - Campaign ID
254
+ * @param reason - Pause reason as status bits (e.g., 1 for creator pause)
255
+ */
256
+ pause(campaignId: bigint, reason?: number): Promise<TransactionResult>;
257
+ /**
258
+ * Resume a paused campaign
259
+ *
260
+ * @param campaignId - Campaign ID
261
+ * @param clearBits - Status bits to clear (e.g., 1 for creator pause)
262
+ */
263
+ resume(campaignId: bigint, clearBits?: number): Promise<TransactionResult>;
264
+ /**
265
+ * Finalize a campaign (no more claims possible)
266
+ */
267
+ finalize(campaignId: bigint): Promise<TransactionResult>;
268
+ /**
269
+ * Cancel a campaign and return funds to creator
270
+ */
271
+ cancel(campaignId: bigint): Promise<TransactionResult>;
272
+ /**
273
+ * Change a recipient address (for blocked recipients)
274
+ */
275
+ changeRecipient(campaignId: bigint, fromAddress: Address, toAddress: Address): Promise<TransactionResult>;
276
+ /**
277
+ * Add recipients to an existing campaign
278
+ */
279
+ addRecipients(campaignId: bigint, recipients: Address[], amounts: bigint[], additionalBuffer?: bigint): Promise<TransactionResult>;
280
+ private requireWallet;
281
+ private changePolicyToEnum;
282
+ private parseCampaignSummary;
283
+ private createTransactionResult;
284
+ }
285
+
286
+ export { CampaignKind, CampaignsModule, ChangePolicy, CampaignsModule as default };