@sudobility/contracts 1.11.1 → 1.11.2

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 (58) hide show
  1. package/artifacts/contracts/Mailer.sol/Mailer.d.ts +120 -2
  2. package/artifacts/contracts/Mailer.sol/Mailer.dbg.json +1 -1
  3. package/artifacts/contracts/Mailer.sol/Mailer.json +120 -2
  4. package/artifacts/contracts/MockUSDC.sol/MockUSDC.dbg.json +1 -1
  5. package/artifacts/contracts/interfaces/IERC20.sol/IERC20.dbg.json +1 -1
  6. package/dist/evm/src/evm/mailer-client.d.ts +890 -190
  7. package/dist/evm/src/evm/mailer-client.d.ts.map +1 -1
  8. package/dist/evm/src/evm/mailer-client.js +169 -237
  9. package/dist/evm/src/evm/mailer-client.js.map +1 -1
  10. package/dist/evm/typechain-types/Mailer.d.ts +81 -11
  11. package/dist/evm/typechain-types/Mailer.d.ts.map +1 -1
  12. package/dist/evm/typechain-types/factories/Mailer__factory.d.ts +93 -1
  13. package/dist/evm/typechain-types/factories/Mailer__factory.d.ts.map +1 -1
  14. package/dist/evm/typechain-types/factories/Mailer__factory.js +119 -1
  15. package/dist/evm/typechain-types/factories/Mailer__factory.js.map +1 -1
  16. package/dist/solana/solana/mailer-client.d.ts +4 -0
  17. package/dist/solana/solana/mailer-client.d.ts.map +1 -1
  18. package/dist/solana/solana/mailer-client.js +181 -18
  19. package/dist/solana/solana/mailer-client.js.map +1 -1
  20. package/dist/unified/src/evm/mailer-client.d.ts +890 -190
  21. package/dist/unified/src/evm/mailer-client.d.ts.map +1 -1
  22. package/dist/unified/src/evm/mailer-client.js +169 -237
  23. package/dist/unified/src/evm/mailer-client.js.map +1 -1
  24. package/dist/unified/src/solana/mailer-client.d.ts +4 -0
  25. package/dist/unified/src/solana/mailer-client.d.ts.map +1 -1
  26. package/dist/unified/src/solana/mailer-client.js +181 -18
  27. package/dist/unified/src/solana/mailer-client.js.map +1 -1
  28. package/dist/unified/src/unified/onchain-mailer-client.d.ts +25 -0
  29. package/dist/unified/src/unified/onchain-mailer-client.d.ts.map +1 -1
  30. package/dist/unified/src/unified/onchain-mailer-client.js +147 -4
  31. package/dist/unified/src/unified/onchain-mailer-client.js.map +1 -1
  32. package/dist/unified/typechain-types/Mailer.d.ts +81 -11
  33. package/dist/unified/typechain-types/Mailer.d.ts.map +1 -1
  34. package/dist/unified/typechain-types/factories/Mailer__factory.d.ts +93 -1
  35. package/dist/unified/typechain-types/factories/Mailer__factory.d.ts.map +1 -1
  36. package/dist/unified/typechain-types/factories/Mailer__factory.js +119 -1
  37. package/dist/unified/typechain-types/factories/Mailer__factory.js.map +1 -1
  38. package/dist/unified-esm/src/evm/mailer-client.d.ts +890 -190
  39. package/dist/unified-esm/src/evm/mailer-client.d.ts.map +1 -1
  40. package/dist/unified-esm/src/evm/mailer-client.js +171 -239
  41. package/dist/unified-esm/src/evm/mailer-client.js.map +1 -1
  42. package/dist/unified-esm/src/solana/mailer-client.d.ts +4 -0
  43. package/dist/unified-esm/src/solana/mailer-client.d.ts.map +1 -1
  44. package/dist/unified-esm/src/solana/mailer-client.js +181 -18
  45. package/dist/unified-esm/src/solana/mailer-client.js.map +1 -1
  46. package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts +25 -0
  47. package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts.map +1 -1
  48. package/dist/unified-esm/src/unified/onchain-mailer-client.js +147 -4
  49. package/dist/unified-esm/src/unified/onchain-mailer-client.js.map +1 -1
  50. package/dist/unified-esm/typechain-types/Mailer.d.ts +81 -11
  51. package/dist/unified-esm/typechain-types/Mailer.d.ts.map +1 -1
  52. package/dist/unified-esm/typechain-types/factories/Mailer__factory.d.ts +93 -1
  53. package/dist/unified-esm/typechain-types/factories/Mailer__factory.d.ts.map +1 -1
  54. package/dist/unified-esm/typechain-types/factories/Mailer__factory.js +119 -1
  55. package/dist/unified-esm/typechain-types/factories/Mailer__factory.js.map +1 -1
  56. package/package.json +1 -1
  57. package/typechain-types/Mailer.ts +137 -9
  58. package/typechain-types/factories/Mailer__factory.ts +119 -1
@@ -1,210 +1,910 @@
1
- import { Account, Address, Hash, PublicClient, WalletClient } from "viem";
1
+ import { Account, Address, Hash, PublicClient, WalletClient } from 'viem';
2
+ type RecipientClaim = {
3
+ amount: bigint;
4
+ expiresAt: bigint;
5
+ isExpired: boolean;
6
+ };
2
7
  /**
3
- * @class MailerClient
4
- * @description High-level TypeScript client for the Mailer contract using viem
5
- * @notice Provides easy-to-use methods for sending messages with USDC fees and revenue sharing
6
- *
7
- * ## Key Features:
8
- * - **Delegation Management**: Delegate mail handling with rejection capability
9
- * - **Priority Messages**: Full fee (0.1 USDC) with 90% revenue share to recipient
10
- * - **Standard Messages**: 10% fee only (0.01 USDC) with no revenue share
11
- * - **Revenue Claims**: 60-day claim period for priority message revenue shares
12
- *
13
- * ## Usage Examples:
14
- * ```typescript
15
- * // Connect to existing contract
16
- * import { createPublicClient, createWalletClient, http } from 'viem';
17
- * import { mainnet } from 'viem/chains';
18
- *
19
- * const publicClient = createPublicClient({
20
- * chain: mainnet,
21
- * transport: http()
22
- * });
23
- *
24
- * const mailer = new MailerClient('CONTRACT_ADDRESS', publicClient);
25
- *
26
- * // Send message with revenue sharing to recipient
27
- * const walletClient = createWalletClient({
28
- * chain: mainnet,
29
- * transport: http()
30
- * });
31
- *
32
- * await mailer.send('0x...', 'Subject', 'Body', true, walletClient, account);
33
- *
34
- * // Claim your revenue share (as recipient)
35
- * await mailer.claimRecipientShare(walletClient, account);
36
- * ```
8
+ * High-level client for interacting with the EVM Mailer contract.
9
+ * Exposes every callable contract function with type-safe wrappers.
37
10
  */
38
11
  export declare class MailerClient {
39
- private contractAddress;
40
- private publicClient;
12
+ static readonly abi: readonly [{
13
+ readonly inputs: readonly [{
14
+ readonly internalType: "address";
15
+ readonly name: "_usdcToken";
16
+ readonly type: "address";
17
+ }, {
18
+ readonly internalType: "address";
19
+ readonly name: "_owner";
20
+ readonly type: "address";
21
+ }];
22
+ readonly stateMutability: "nonpayable";
23
+ readonly type: "constructor";
24
+ }, {
25
+ readonly inputs: readonly [];
26
+ readonly name: "ClaimPeriodNotExpired";
27
+ readonly type: "error";
28
+ }, {
29
+ readonly inputs: readonly [];
30
+ readonly name: "ContractIsPaused";
31
+ readonly type: "error";
32
+ }, {
33
+ readonly inputs: readonly [];
34
+ readonly name: "ContractNotPaused";
35
+ readonly type: "error";
36
+ }, {
37
+ readonly inputs: readonly [];
38
+ readonly name: "FeePaymentRequired";
39
+ readonly type: "error";
40
+ }, {
41
+ readonly inputs: readonly [];
42
+ readonly name: "InvalidAddress";
43
+ readonly type: "error";
44
+ }, {
45
+ readonly inputs: readonly [];
46
+ readonly name: "InvalidPercentage";
47
+ readonly type: "error";
48
+ }, {
49
+ readonly inputs: readonly [];
50
+ readonly name: "MathOverflow";
51
+ readonly type: "error";
52
+ }, {
53
+ readonly inputs: readonly [];
54
+ readonly name: "NoClaimableAmount";
55
+ readonly type: "error";
56
+ }, {
57
+ readonly inputs: readonly [];
58
+ readonly name: "OnlyOwner";
59
+ readonly type: "error";
60
+ }, {
61
+ readonly inputs: readonly [];
62
+ readonly name: "ReentrancyGuard";
63
+ readonly type: "error";
64
+ }, {
65
+ readonly inputs: readonly [];
66
+ readonly name: "TransferFailed";
67
+ readonly type: "error";
68
+ }, {
69
+ readonly inputs: readonly [];
70
+ readonly name: "UnpermittedPayer";
71
+ readonly type: "error";
72
+ }, {
73
+ readonly anonymous: false;
74
+ readonly inputs: readonly [];
75
+ readonly name: "ContractPaused";
76
+ readonly type: "event";
77
+ }, {
78
+ readonly anonymous: false;
79
+ readonly inputs: readonly [];
80
+ readonly name: "ContractUnpaused";
81
+ readonly type: "event";
82
+ }, {
83
+ readonly anonymous: false;
84
+ readonly inputs: readonly [{
85
+ readonly indexed: true;
86
+ readonly internalType: "address";
87
+ readonly name: "account";
88
+ readonly type: "address";
89
+ }, {
90
+ readonly indexed: false;
91
+ readonly internalType: "uint256";
92
+ readonly name: "percentage";
93
+ readonly type: "uint256";
94
+ }];
95
+ readonly name: "CustomFeePercentageSet";
96
+ readonly type: "event";
97
+ }, {
98
+ readonly anonymous: false;
99
+ readonly inputs: readonly [{
100
+ readonly indexed: false;
101
+ readonly internalType: "uint256";
102
+ readonly name: "oldFee";
103
+ readonly type: "uint256";
104
+ }, {
105
+ readonly indexed: false;
106
+ readonly internalType: "uint256";
107
+ readonly name: "newFee";
108
+ readonly type: "uint256";
109
+ }];
110
+ readonly name: "DelegationFeeUpdated";
111
+ readonly type: "event";
112
+ }, {
113
+ readonly anonymous: false;
114
+ readonly inputs: readonly [{
115
+ readonly indexed: true;
116
+ readonly internalType: "address";
117
+ readonly name: "delegator";
118
+ readonly type: "address";
119
+ }, {
120
+ readonly indexed: true;
121
+ readonly internalType: "address";
122
+ readonly name: "delegate";
123
+ readonly type: "address";
124
+ }];
125
+ readonly name: "DelegationSet";
126
+ readonly type: "event";
127
+ }, {
128
+ readonly anonymous: false;
129
+ readonly inputs: readonly [];
130
+ readonly name: "EmergencyUnpaused";
131
+ readonly type: "event";
132
+ }, {
133
+ readonly anonymous: false;
134
+ readonly inputs: readonly [{
135
+ readonly indexed: true;
136
+ readonly internalType: "address";
137
+ readonly name: "recipient";
138
+ readonly type: "address";
139
+ }, {
140
+ readonly indexed: false;
141
+ readonly internalType: "uint256";
142
+ readonly name: "amount";
143
+ readonly type: "uint256";
144
+ }];
145
+ readonly name: "ExpiredSharesClaimed";
146
+ readonly type: "event";
147
+ }, {
148
+ readonly anonymous: false;
149
+ readonly inputs: readonly [{
150
+ readonly indexed: false;
151
+ readonly internalType: "uint256";
152
+ readonly name: "oldFee";
153
+ readonly type: "uint256";
154
+ }, {
155
+ readonly indexed: false;
156
+ readonly internalType: "uint256";
157
+ readonly name: "newFee";
158
+ readonly type: "uint256";
159
+ }];
160
+ readonly name: "FeeUpdated";
161
+ readonly type: "event";
162
+ }, {
163
+ readonly anonymous: false;
164
+ readonly inputs: readonly [{
165
+ readonly indexed: true;
166
+ readonly internalType: "address";
167
+ readonly name: "recipient";
168
+ readonly type: "address";
169
+ }, {
170
+ readonly indexed: false;
171
+ readonly internalType: "uint256";
172
+ readonly name: "amount";
173
+ readonly type: "uint256";
174
+ }];
175
+ readonly name: "FundsDistributed";
176
+ readonly type: "event";
177
+ }, {
178
+ readonly anonymous: false;
179
+ readonly inputs: readonly [{
180
+ readonly indexed: true;
181
+ readonly internalType: "address";
182
+ readonly name: "from";
183
+ readonly type: "address";
184
+ }, {
185
+ readonly indexed: true;
186
+ readonly internalType: "address";
187
+ readonly name: "to";
188
+ readonly type: "address";
189
+ }, {
190
+ readonly indexed: false;
191
+ readonly internalType: "string";
192
+ readonly name: "subject";
193
+ readonly type: "string";
194
+ }, {
195
+ readonly indexed: false;
196
+ readonly internalType: "string";
197
+ readonly name: "body";
198
+ readonly type: "string";
199
+ }, {
200
+ readonly indexed: false;
201
+ readonly internalType: "bool";
202
+ readonly name: "revenueShareToReceiver";
203
+ readonly type: "bool";
204
+ }, {
205
+ readonly indexed: false;
206
+ readonly internalType: "bool";
207
+ readonly name: "resolveSenderToName";
208
+ readonly type: "bool";
209
+ }];
210
+ readonly name: "MailSent";
211
+ readonly type: "event";
212
+ }, {
213
+ readonly anonymous: false;
214
+ readonly inputs: readonly [{
215
+ readonly indexed: true;
216
+ readonly internalType: "address";
217
+ readonly name: "from";
218
+ readonly type: "address";
219
+ }, {
220
+ readonly indexed: false;
221
+ readonly internalType: "string";
222
+ readonly name: "toEmail";
223
+ readonly type: "string";
224
+ }, {
225
+ readonly indexed: false;
226
+ readonly internalType: "string";
227
+ readonly name: "subject";
228
+ readonly type: "string";
229
+ }, {
230
+ readonly indexed: false;
231
+ readonly internalType: "string";
232
+ readonly name: "body";
233
+ readonly type: "string";
234
+ }];
235
+ readonly name: "MailSentToEmail";
236
+ readonly type: "event";
237
+ }, {
238
+ readonly anonymous: false;
239
+ readonly inputs: readonly [{
240
+ readonly indexed: false;
241
+ readonly internalType: "uint256";
242
+ readonly name: "amount";
243
+ readonly type: "uint256";
244
+ }];
245
+ readonly name: "OwnerClaimed";
246
+ readonly type: "event";
247
+ }, {
248
+ readonly anonymous: false;
249
+ readonly inputs: readonly [{
250
+ readonly indexed: true;
251
+ readonly internalType: "address";
252
+ readonly name: "contractAddress";
253
+ readonly type: "address";
254
+ }, {
255
+ readonly indexed: true;
256
+ readonly internalType: "address";
257
+ readonly name: "wallet";
258
+ readonly type: "address";
259
+ }];
260
+ readonly name: "PermissionGranted";
261
+ readonly type: "event";
262
+ }, {
263
+ readonly anonymous: false;
264
+ readonly inputs: readonly [{
265
+ readonly indexed: true;
266
+ readonly internalType: "address";
267
+ readonly name: "contractAddress";
268
+ readonly type: "address";
269
+ }, {
270
+ readonly indexed: true;
271
+ readonly internalType: "address";
272
+ readonly name: "wallet";
273
+ readonly type: "address";
274
+ }];
275
+ readonly name: "PermissionRevoked";
276
+ readonly type: "event";
277
+ }, {
278
+ readonly anonymous: false;
279
+ readonly inputs: readonly [{
280
+ readonly indexed: true;
281
+ readonly internalType: "address";
282
+ readonly name: "from";
283
+ readonly type: "address";
284
+ }, {
285
+ readonly indexed: true;
286
+ readonly internalType: "address";
287
+ readonly name: "to";
288
+ readonly type: "address";
289
+ }, {
290
+ readonly indexed: true;
291
+ readonly internalType: "string";
292
+ readonly name: "mailId";
293
+ readonly type: "string";
294
+ }, {
295
+ readonly indexed: false;
296
+ readonly internalType: "bool";
297
+ readonly name: "revenueShareToReceiver";
298
+ readonly type: "bool";
299
+ }, {
300
+ readonly indexed: false;
301
+ readonly internalType: "bool";
302
+ readonly name: "resolveSenderToName";
303
+ readonly type: "bool";
304
+ }];
305
+ readonly name: "PreparedMailSent";
306
+ readonly type: "event";
307
+ }, {
308
+ readonly anonymous: false;
309
+ readonly inputs: readonly [{
310
+ readonly indexed: true;
311
+ readonly internalType: "address";
312
+ readonly name: "from";
313
+ readonly type: "address";
314
+ }, {
315
+ readonly indexed: false;
316
+ readonly internalType: "string";
317
+ readonly name: "toEmail";
318
+ readonly type: "string";
319
+ }, {
320
+ readonly indexed: true;
321
+ readonly internalType: "string";
322
+ readonly name: "mailId";
323
+ readonly type: "string";
324
+ }];
325
+ readonly name: "PreparedMailSentToEmail";
326
+ readonly type: "event";
327
+ }, {
328
+ readonly anonymous: false;
329
+ readonly inputs: readonly [{
330
+ readonly indexed: true;
331
+ readonly internalType: "address";
332
+ readonly name: "recipient";
333
+ readonly type: "address";
334
+ }, {
335
+ readonly indexed: false;
336
+ readonly internalType: "uint256";
337
+ readonly name: "amount";
338
+ readonly type: "uint256";
339
+ }];
340
+ readonly name: "RecipientClaimed";
341
+ readonly type: "event";
342
+ }, {
343
+ readonly anonymous: false;
344
+ readonly inputs: readonly [{
345
+ readonly indexed: true;
346
+ readonly internalType: "address";
347
+ readonly name: "recipient";
348
+ readonly type: "address";
349
+ }, {
350
+ readonly indexed: false;
351
+ readonly internalType: "uint256";
352
+ readonly name: "recipientAmount";
353
+ readonly type: "uint256";
354
+ }, {
355
+ readonly indexed: false;
356
+ readonly internalType: "uint256";
357
+ readonly name: "ownerAmount";
358
+ readonly type: "uint256";
359
+ }];
360
+ readonly name: "SharesRecorded";
361
+ readonly type: "event";
362
+ }, {
363
+ readonly anonymous: false;
364
+ readonly inputs: readonly [{
365
+ readonly indexed: true;
366
+ readonly internalType: "address";
367
+ readonly name: "from";
368
+ readonly type: "address";
369
+ }, {
370
+ readonly indexed: true;
371
+ readonly internalType: "address";
372
+ readonly name: "to";
373
+ readonly type: "address";
374
+ }, {
375
+ readonly indexed: true;
376
+ readonly internalType: "string";
377
+ readonly name: "webhookId";
378
+ readonly type: "string";
379
+ }, {
380
+ readonly indexed: false;
381
+ readonly internalType: "bool";
382
+ readonly name: "revenueShareToReceiver";
383
+ readonly type: "bool";
384
+ }, {
385
+ readonly indexed: false;
386
+ readonly internalType: "bool";
387
+ readonly name: "resolveSenderToName";
388
+ readonly type: "bool";
389
+ }];
390
+ readonly name: "WebhookMailSent";
391
+ readonly type: "event";
392
+ }, {
393
+ readonly inputs: readonly [];
394
+ readonly name: "CLAIM_PERIOD";
395
+ readonly outputs: readonly [{
396
+ readonly internalType: "uint256";
397
+ readonly name: "";
398
+ readonly type: "uint256";
399
+ }];
400
+ readonly stateMutability: "view";
401
+ readonly type: "function";
402
+ }, {
403
+ readonly inputs: readonly [];
404
+ readonly name: "OWNER_SHARE";
405
+ readonly outputs: readonly [{
406
+ readonly internalType: "uint256";
407
+ readonly name: "";
408
+ readonly type: "uint256";
409
+ }];
410
+ readonly stateMutability: "view";
411
+ readonly type: "function";
412
+ }, {
413
+ readonly inputs: readonly [];
414
+ readonly name: "RECIPIENT_SHARE";
415
+ readonly outputs: readonly [{
416
+ readonly internalType: "uint256";
417
+ readonly name: "";
418
+ readonly type: "uint256";
419
+ }];
420
+ readonly stateMutability: "view";
421
+ readonly type: "function";
422
+ }, {
423
+ readonly inputs: readonly [{
424
+ readonly internalType: "address";
425
+ readonly name: "recipient";
426
+ readonly type: "address";
427
+ }];
428
+ readonly name: "claimExpiredShares";
429
+ readonly outputs: readonly [];
430
+ readonly stateMutability: "nonpayable";
431
+ readonly type: "function";
432
+ }, {
433
+ readonly inputs: readonly [];
434
+ readonly name: "claimOwnerShare";
435
+ readonly outputs: readonly [];
436
+ readonly stateMutability: "nonpayable";
437
+ readonly type: "function";
438
+ }, {
439
+ readonly inputs: readonly [];
440
+ readonly name: "claimRecipientShare";
441
+ readonly outputs: readonly [];
442
+ readonly stateMutability: "nonpayable";
443
+ readonly type: "function";
444
+ }, {
445
+ readonly inputs: readonly [{
446
+ readonly internalType: "address";
447
+ readonly name: "account";
448
+ readonly type: "address";
449
+ }];
450
+ readonly name: "clearCustomFeePercentage";
451
+ readonly outputs: readonly [];
452
+ readonly stateMutability: "nonpayable";
453
+ readonly type: "function";
454
+ }, {
455
+ readonly inputs: readonly [{
456
+ readonly internalType: "address";
457
+ readonly name: "";
458
+ readonly type: "address";
459
+ }];
460
+ readonly name: "customFeeDiscount";
461
+ readonly outputs: readonly [{
462
+ readonly internalType: "uint256";
463
+ readonly name: "";
464
+ readonly type: "uint256";
465
+ }];
466
+ readonly stateMutability: "view";
467
+ readonly type: "function";
468
+ }, {
469
+ readonly inputs: readonly [{
470
+ readonly internalType: "address";
471
+ readonly name: "delegate";
472
+ readonly type: "address";
473
+ }];
474
+ readonly name: "delegateTo";
475
+ readonly outputs: readonly [];
476
+ readonly stateMutability: "nonpayable";
477
+ readonly type: "function";
478
+ }, {
479
+ readonly inputs: readonly [];
480
+ readonly name: "delegationFee";
481
+ readonly outputs: readonly [{
482
+ readonly internalType: "uint256";
483
+ readonly name: "";
484
+ readonly type: "uint256";
485
+ }];
486
+ readonly stateMutability: "view";
487
+ readonly type: "function";
488
+ }, {
489
+ readonly inputs: readonly [{
490
+ readonly internalType: "address";
491
+ readonly name: "recipient";
492
+ readonly type: "address";
493
+ }];
494
+ readonly name: "distributeClaimableFunds";
495
+ readonly outputs: readonly [];
496
+ readonly stateMutability: "nonpayable";
497
+ readonly type: "function";
498
+ }, {
499
+ readonly inputs: readonly [];
500
+ readonly name: "emergencyUnpause";
501
+ readonly outputs: readonly [];
502
+ readonly stateMutability: "nonpayable";
503
+ readonly type: "function";
504
+ }, {
505
+ readonly inputs: readonly [{
506
+ readonly internalType: "address";
507
+ readonly name: "account";
508
+ readonly type: "address";
509
+ }];
510
+ readonly name: "getCustomFeePercentage";
511
+ readonly outputs: readonly [{
512
+ readonly internalType: "uint256";
513
+ readonly name: "";
514
+ readonly type: "uint256";
515
+ }];
516
+ readonly stateMutability: "view";
517
+ readonly type: "function";
518
+ }, {
519
+ readonly inputs: readonly [];
520
+ readonly name: "getDelegationFee";
521
+ readonly outputs: readonly [{
522
+ readonly internalType: "uint256";
523
+ readonly name: "";
524
+ readonly type: "uint256";
525
+ }];
526
+ readonly stateMutability: "view";
527
+ readonly type: "function";
528
+ }, {
529
+ readonly inputs: readonly [];
530
+ readonly name: "getFee";
531
+ readonly outputs: readonly [{
532
+ readonly internalType: "uint256";
533
+ readonly name: "";
534
+ readonly type: "uint256";
535
+ }];
536
+ readonly stateMutability: "view";
537
+ readonly type: "function";
538
+ }, {
539
+ readonly inputs: readonly [];
540
+ readonly name: "getOwnerClaimable";
541
+ readonly outputs: readonly [{
542
+ readonly internalType: "uint256";
543
+ readonly name: "";
544
+ readonly type: "uint256";
545
+ }];
546
+ readonly stateMutability: "view";
547
+ readonly type: "function";
548
+ }, {
549
+ readonly inputs: readonly [{
550
+ readonly internalType: "address";
551
+ readonly name: "recipient";
552
+ readonly type: "address";
553
+ }];
554
+ readonly name: "getRecipientClaimable";
555
+ readonly outputs: readonly [{
556
+ readonly internalType: "uint256";
557
+ readonly name: "amount";
558
+ readonly type: "uint256";
559
+ }, {
560
+ readonly internalType: "uint256";
561
+ readonly name: "expiresAt";
562
+ readonly type: "uint256";
563
+ }, {
564
+ readonly internalType: "bool";
565
+ readonly name: "isExpired";
566
+ readonly type: "bool";
567
+ }];
568
+ readonly stateMutability: "view";
569
+ readonly type: "function";
570
+ }, {
571
+ readonly inputs: readonly [];
572
+ readonly name: "isPaused";
573
+ readonly outputs: readonly [{
574
+ readonly internalType: "bool";
575
+ readonly name: "";
576
+ readonly type: "bool";
577
+ }];
578
+ readonly stateMutability: "view";
579
+ readonly type: "function";
580
+ }, {
581
+ readonly inputs: readonly [];
582
+ readonly name: "owner";
583
+ readonly outputs: readonly [{
584
+ readonly internalType: "address";
585
+ readonly name: "";
586
+ readonly type: "address";
587
+ }];
588
+ readonly stateMutability: "view";
589
+ readonly type: "function";
590
+ }, {
591
+ readonly inputs: readonly [];
592
+ readonly name: "ownerClaimable";
593
+ readonly outputs: readonly [{
594
+ readonly internalType: "uint256";
595
+ readonly name: "";
596
+ readonly type: "uint256";
597
+ }];
598
+ readonly stateMutability: "view";
599
+ readonly type: "function";
600
+ }, {
601
+ readonly inputs: readonly [];
602
+ readonly name: "pause";
603
+ readonly outputs: readonly [];
604
+ readonly stateMutability: "nonpayable";
605
+ readonly type: "function";
606
+ }, {
607
+ readonly inputs: readonly [];
608
+ readonly name: "paused";
609
+ readonly outputs: readonly [{
610
+ readonly internalType: "bool";
611
+ readonly name: "";
612
+ readonly type: "bool";
613
+ }];
614
+ readonly stateMutability: "view";
615
+ readonly type: "function";
616
+ }, {
617
+ readonly inputs: readonly [{
618
+ readonly internalType: "address";
619
+ readonly name: "";
620
+ readonly type: "address";
621
+ }, {
622
+ readonly internalType: "address";
623
+ readonly name: "";
624
+ readonly type: "address";
625
+ }];
626
+ readonly name: "permissions";
627
+ readonly outputs: readonly [{
628
+ readonly internalType: "bool";
629
+ readonly name: "";
630
+ readonly type: "bool";
631
+ }];
632
+ readonly stateMutability: "view";
633
+ readonly type: "function";
634
+ }, {
635
+ readonly inputs: readonly [{
636
+ readonly internalType: "address";
637
+ readonly name: "";
638
+ readonly type: "address";
639
+ }];
640
+ readonly name: "recipientClaims";
641
+ readonly outputs: readonly [{
642
+ readonly internalType: "uint256";
643
+ readonly name: "amount";
644
+ readonly type: "uint256";
645
+ }, {
646
+ readonly internalType: "uint256";
647
+ readonly name: "timestamp";
648
+ readonly type: "uint256";
649
+ }];
650
+ readonly stateMutability: "view";
651
+ readonly type: "function";
652
+ }, {
653
+ readonly inputs: readonly [{
654
+ readonly internalType: "address";
655
+ readonly name: "delegatingAddress";
656
+ readonly type: "address";
657
+ }];
658
+ readonly name: "rejectDelegation";
659
+ readonly outputs: readonly [];
660
+ readonly stateMutability: "nonpayable";
661
+ readonly type: "function";
662
+ }, {
663
+ readonly inputs: readonly [{
664
+ readonly internalType: "address";
665
+ readonly name: "contractAddress";
666
+ readonly type: "address";
667
+ }];
668
+ readonly name: "removePermission";
669
+ readonly outputs: readonly [];
670
+ readonly stateMutability: "nonpayable";
671
+ readonly type: "function";
672
+ }, {
673
+ readonly inputs: readonly [{
674
+ readonly internalType: "address";
675
+ readonly name: "to";
676
+ readonly type: "address";
677
+ }, {
678
+ readonly internalType: "string";
679
+ readonly name: "subject";
680
+ readonly type: "string";
681
+ }, {
682
+ readonly internalType: "string";
683
+ readonly name: "body";
684
+ readonly type: "string";
685
+ }, {
686
+ readonly internalType: "address";
687
+ readonly name: "payer";
688
+ readonly type: "address";
689
+ }, {
690
+ readonly internalType: "bool";
691
+ readonly name: "revenueShareToReceiver";
692
+ readonly type: "bool";
693
+ }, {
694
+ readonly internalType: "bool";
695
+ readonly name: "resolveSenderToName";
696
+ readonly type: "bool";
697
+ }];
698
+ readonly name: "send";
699
+ readonly outputs: readonly [];
700
+ readonly stateMutability: "nonpayable";
701
+ readonly type: "function";
702
+ }, {
703
+ readonly inputs: readonly [];
704
+ readonly name: "sendFee";
705
+ readonly outputs: readonly [{
706
+ readonly internalType: "uint256";
707
+ readonly name: "";
708
+ readonly type: "uint256";
709
+ }];
710
+ readonly stateMutability: "view";
711
+ readonly type: "function";
712
+ }, {
713
+ readonly inputs: readonly [{
714
+ readonly internalType: "address";
715
+ readonly name: "to";
716
+ readonly type: "address";
717
+ }, {
718
+ readonly internalType: "string";
719
+ readonly name: "mailId";
720
+ readonly type: "string";
721
+ }, {
722
+ readonly internalType: "address";
723
+ readonly name: "payer";
724
+ readonly type: "address";
725
+ }, {
726
+ readonly internalType: "bool";
727
+ readonly name: "revenueShareToReceiver";
728
+ readonly type: "bool";
729
+ }, {
730
+ readonly internalType: "bool";
731
+ readonly name: "resolveSenderToName";
732
+ readonly type: "bool";
733
+ }];
734
+ readonly name: "sendPrepared";
735
+ readonly outputs: readonly [];
736
+ readonly stateMutability: "nonpayable";
737
+ readonly type: "function";
738
+ }, {
739
+ readonly inputs: readonly [{
740
+ readonly internalType: "string";
741
+ readonly name: "toEmail";
742
+ readonly type: "string";
743
+ }, {
744
+ readonly internalType: "string";
745
+ readonly name: "mailId";
746
+ readonly type: "string";
747
+ }, {
748
+ readonly internalType: "address";
749
+ readonly name: "payer";
750
+ readonly type: "address";
751
+ }];
752
+ readonly name: "sendPreparedToEmailAddress";
753
+ readonly outputs: readonly [];
754
+ readonly stateMutability: "nonpayable";
755
+ readonly type: "function";
756
+ }, {
757
+ readonly inputs: readonly [{
758
+ readonly internalType: "address";
759
+ readonly name: "to";
760
+ readonly type: "address";
761
+ }, {
762
+ readonly internalType: "string";
763
+ readonly name: "webhookId";
764
+ readonly type: "string";
765
+ }, {
766
+ readonly internalType: "address";
767
+ readonly name: "payer";
768
+ readonly type: "address";
769
+ }, {
770
+ readonly internalType: "bool";
771
+ readonly name: "revenueShareToReceiver";
772
+ readonly type: "bool";
773
+ }, {
774
+ readonly internalType: "bool";
775
+ readonly name: "resolveSenderToName";
776
+ readonly type: "bool";
777
+ }];
778
+ readonly name: "sendThroughWebhook";
779
+ readonly outputs: readonly [];
780
+ readonly stateMutability: "nonpayable";
781
+ readonly type: "function";
782
+ }, {
783
+ readonly inputs: readonly [{
784
+ readonly internalType: "string";
785
+ readonly name: "toEmail";
786
+ readonly type: "string";
787
+ }, {
788
+ readonly internalType: "string";
789
+ readonly name: "subject";
790
+ readonly type: "string";
791
+ }, {
792
+ readonly internalType: "string";
793
+ readonly name: "body";
794
+ readonly type: "string";
795
+ }, {
796
+ readonly internalType: "address";
797
+ readonly name: "payer";
798
+ readonly type: "address";
799
+ }];
800
+ readonly name: "sendToEmailAddress";
801
+ readonly outputs: readonly [];
802
+ readonly stateMutability: "nonpayable";
803
+ readonly type: "function";
804
+ }, {
805
+ readonly inputs: readonly [{
806
+ readonly internalType: "address";
807
+ readonly name: "account";
808
+ readonly type: "address";
809
+ }, {
810
+ readonly internalType: "uint256";
811
+ readonly name: "percentage";
812
+ readonly type: "uint256";
813
+ }];
814
+ readonly name: "setCustomFeePercentage";
815
+ readonly outputs: readonly [];
816
+ readonly stateMutability: "nonpayable";
817
+ readonly type: "function";
818
+ }, {
819
+ readonly inputs: readonly [{
820
+ readonly internalType: "uint256";
821
+ readonly name: "usdcAmount";
822
+ readonly type: "uint256";
823
+ }];
824
+ readonly name: "setDelegationFee";
825
+ readonly outputs: readonly [];
826
+ readonly stateMutability: "nonpayable";
827
+ readonly type: "function";
828
+ }, {
829
+ readonly inputs: readonly [{
830
+ readonly internalType: "uint256";
831
+ readonly name: "usdcAmount";
832
+ readonly type: "uint256";
833
+ }];
834
+ readonly name: "setFee";
835
+ readonly outputs: readonly [];
836
+ readonly stateMutability: "nonpayable";
837
+ readonly type: "function";
838
+ }, {
839
+ readonly inputs: readonly [{
840
+ readonly internalType: "address";
841
+ readonly name: "contractAddress";
842
+ readonly type: "address";
843
+ }];
844
+ readonly name: "setPermission";
845
+ readonly outputs: readonly [];
846
+ readonly stateMutability: "nonpayable";
847
+ readonly type: "function";
848
+ }, {
849
+ readonly inputs: readonly [];
850
+ readonly name: "unpause";
851
+ readonly outputs: readonly [];
852
+ readonly stateMutability: "nonpayable";
853
+ readonly type: "function";
854
+ }, {
855
+ readonly inputs: readonly [];
856
+ readonly name: "usdcToken";
857
+ readonly outputs: readonly [{
858
+ readonly internalType: "contract IERC20";
859
+ readonly name: "";
860
+ readonly type: "address";
861
+ }];
862
+ readonly stateMutability: "view";
863
+ readonly type: "function";
864
+ }];
865
+ static readonly bytecode: `0x${string}`;
866
+ private readonly contractAddress;
867
+ private readonly publicClient;
868
+ constructor(contractAddress: string | Address, publicClient: PublicClient);
41
869
  /**
42
- * @description Creates a new MailerClient instance
43
- * @param contractAddress The deployed Mailer contract address
44
- * @param publicClient Viem public client for reading blockchain state
870
+ * Deploy a fresh Mailer contract instance.
45
871
  */
46
- constructor(contractAddress: string, publicClient: PublicClient);
47
- /**
48
- * @description Deploy a new Mailer contract and return a client instance
49
- * @param walletClient Viem wallet client with deployment permissions
50
- * @param account Account to deploy from
51
- * @param usdcTokenAddress Address of the USDC token contract
52
- * @param ownerAddress Address that will own the deployed contract
53
- * @returns Promise resolving to a MailerClient instance
54
- */
55
- static deploy(walletClient: WalletClient, publicClient: PublicClient, account: Account | Address, usdcTokenAddress: string, ownerAddress: string): Promise<MailerClient>;
56
- /**
57
- * @description Send a message with optional revenue sharing
58
- * @notice Two modes:
59
- * - revenueShareToReceiver=true: Sender pays 0.1 USDC, recipient gets 90% claimable
60
- * - revenueShareToReceiver=false: Sender pays 0.01 USDC only
61
- * @param to Recipient address who receives the message and potential revenue share
62
- * @param subject Message subject line
63
- * @param body Message content
64
- * @param revenueShareToReceiver If true, recipient gets 90% revenue share; if false, no revenue share
65
- * @param resolveSenderToName If true, resolve sender address to name via off-chain service
66
- * @param walletClient Viem wallet client for transaction
67
- * @param account Account to send from
68
- * @returns Promise resolving to transaction hash
69
- * @example
70
- * ```typescript
71
- * // Send with revenue share to recipient
72
- * const hash = await mailer.send('0x...', 'Subject', 'Priority message', true, false, walletClient, account);
73
- * // Send standard message (no revenue share)
74
- * const hash2 = await mailer.send('0x...', 'Subject', 'Standard message', false, false, walletClient, account);
75
- * await publicClient.waitForTransactionReceipt({ hash });
76
- * ```
77
- */
78
- send(to: Address, subject: string, body: string, revenueShareToReceiver: boolean, resolveSenderToName: boolean | undefined, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
872
+ static deploy(walletClient: WalletClient, publicClient: PublicClient, account: Account | Address, usdcTokenAddress: string | Address, ownerAddress: string | Address): Promise<MailerClient>;
873
+ getAddress(): Address;
79
874
  /**
80
- * @description Send a message using a pre-prepared mail ID with optional revenue sharing
81
- * @notice Two modes:
82
- * - revenueShareToReceiver=true: Sender pays 0.1 USDC, recipient gets 90% claimable
83
- * - revenueShareToReceiver=false: Sender pays 0.01 USDC only
84
- * @param to Recipient address who receives the message and potential revenue share
85
- * @param mailId Pre-prepared message identifier
86
- * @param revenueShareToReceiver If true, recipient gets 90% revenue share; if false, no revenue share
87
- * @param resolveSenderToName If true, resolve sender address to name via off-chain service
88
- * @param walletClient Viem wallet client for transaction
89
- * @param account Account to send from
90
- * @returns Promise resolving to transaction hash
875
+ * Core message send with explicit payer control.
91
876
  */
92
- sendPrepared(to: Address, mailId: string, revenueShareToReceiver: boolean, resolveSenderToName: boolean | undefined, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
877
+ send(to: Address | string, subject: string, body: string, payer: Address | string, revenueShareToReceiver: boolean, resolveSenderToName: boolean, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
878
+ sendPrepared(to: Address | string, mailId: string, payer: Address | string, revenueShareToReceiver: boolean, resolveSenderToName: boolean, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
879
+ sendThroughWebhook(to: Address | string, webhookId: string, payer: Address | string, revenueShareToReceiver: boolean, resolveSenderToName: boolean, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
880
+ sendToEmailAddress(toEmail: string, subject: string, body: string, payer: Address | string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
881
+ sendPreparedToEmailAddress(toEmail: string, mailId: string, payer: Address | string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
882
+ getFee(): Promise<bigint>;
93
883
  getSendFee(): Promise<bigint>;
884
+ setFee(newFee: bigint, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
94
885
  getUsdcToken(): Promise<Address>;
95
- getAddress(): Address;
886
+ getOwner(): Promise<Address>;
96
887
  claimRecipientShare(walletClient: WalletClient, account: Account | Address): Promise<Hash>;
97
888
  claimOwnerShare(walletClient: WalletClient, account: Account | Address): Promise<Hash>;
98
- claimExpiredShares(recipient: string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
99
- getRecipientClaimable(recipient: string): Promise<{
100
- amount: bigint;
101
- expiresAt: bigint;
102
- isExpired: boolean;
103
- }>;
889
+ claimExpiredShares(recipient: Address | string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
890
+ getRecipientClaimable(recipient: Address | string): Promise<RecipientClaim>;
104
891
  getOwnerClaimable(): Promise<bigint>;
105
- /**
106
- * Delegate mail handling to another address
107
- * @param delegate Address to delegate to (or 0x0 to clear delegation)
108
- * @param walletClient Connected wallet client
109
- * @param account Account to send transaction from
110
- * @returns Transaction hash
111
- */
112
- delegateTo(delegate: string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
113
- /**
114
- * Reject a delegation made to you by another address
115
- * @param delegatingAddress Address that delegated to you
116
- * @param walletClient Connected wallet client
117
- * @param account Account to send transaction from
118
- * @returns Transaction hash
119
- */
120
- rejectDelegation(delegatingAddress: string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
121
- /**
122
- * Get current delegation fee in USDC (6 decimals)
123
- * @returns Delegation fee amount
124
- */
892
+ delegateTo(delegate: Address | string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
893
+ rejectDelegation(delegatingAddress: Address | string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
125
894
  getDelegationFee(): Promise<bigint>;
126
- /**
127
- * Update delegation fee (owner only)
128
- * @param newFee New fee amount in USDC (6 decimals)
129
- * @param walletClient Connected wallet client
130
- * @param account Account to send transaction from
131
- * @returns Transaction hash
132
- */
133
895
  setDelegationFee(newFee: bigint, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
134
- /**
135
- * @description Send a message to an email address (no wallet known)
136
- * @notice Charges only 10% owner fee since recipient wallet is unknown
137
- * @param toEmail Email address of the recipient
138
- * @param subject Message subject line
139
- * @param body Message content
140
- * @param walletClient Viem wallet client for transaction
141
- * @param account Account to send from
142
- * @returns Promise resolving to transaction hash
143
- * @example
144
- * ```typescript
145
- * // Send to email address
146
- * const hash = await mailer.sendToEmailAddress('user@example.com', 'Subject', 'Body', walletClient, account);
147
- * await publicClient.waitForTransactionReceipt({ hash });
148
- * ```
149
- */
150
- sendToEmailAddress(toEmail: string, subject: string, body: string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
151
- /**
152
- * @description Send a pre-prepared message to an email address (no wallet known)
153
- * @notice Charges only 10% owner fee since recipient wallet is unknown
154
- * @param toEmail Email address of the recipient
155
- * @param mailId Pre-prepared message identifier
156
- * @param walletClient Viem wallet client for transaction
157
- * @param account Account to send from
158
- * @returns Promise resolving to transaction hash
159
- */
160
- sendPreparedToEmailAddress(toEmail: string, mailId: string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
161
- /**
162
- * Set the send fee (owner only)
163
- * @param newFee New fee amount in USDC (6 decimals)
164
- * @param walletClient Viem wallet client for transaction
165
- * @param account Account to send from (must be owner)
166
- * @returns Promise resolving to transaction hash
167
- */
168
- setFee(newFee: bigint, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
169
- /**
170
- * Get the current send fee
171
- * @returns Current send fee in USDC (6 decimals)
172
- */
173
- getFee(): Promise<bigint>;
174
- /**
175
- * Pause the contract and distribute all claimable funds (owner only)
176
- * @param walletClient Viem wallet client for transaction
177
- * @param account Account to send from (must be owner)
178
- * @returns Promise resolving to transaction hash
179
- */
896
+ setCustomFeePercentage(target: Address | string, percentage: number, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
897
+ clearCustomFeePercentage(target: Address | string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
898
+ getCustomFeePercentage(target: Address | string): Promise<number>;
899
+ getCustomFeeDiscount(target: Address | string): Promise<number>;
900
+ setPermission(contractAddress: Address | string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
901
+ removePermission(contractAddress: Address | string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
902
+ hasPermission(contractAddress: Address | string, wallet: Address | string): Promise<boolean>;
180
903
  pause(walletClient: WalletClient, account: Account | Address): Promise<Hash>;
181
- /**
182
- * Unpause the contract (owner only)
183
- * @param walletClient Viem wallet client for transaction
184
- * @param account Account to send from (must be owner)
185
- * @returns Promise resolving to transaction hash
186
- */
187
904
  unpause(walletClient: WalletClient, account: Account | Address): Promise<Hash>;
188
- /**
189
- * Emergency unpause without fund distribution (owner only)
190
- * @param walletClient Viem wallet client for transaction
191
- * @param account Account to send from (must be owner)
192
- * @returns Promise resolving to transaction hash
193
- */
194
905
  emergencyUnpause(walletClient: WalletClient, account: Account | Address): Promise<Hash>;
195
- /**
196
- * Check if contract is currently paused
197
- * @returns True if contract is paused, false otherwise
198
- */
199
906
  isPaused(): Promise<boolean>;
200
- /**
201
- * Distribute a specific recipient's claimable funds during pause
202
- * Anyone can call this function when contract is paused
203
- * @param recipient Address to distribute funds for
204
- * @param walletClient Viem wallet client for transaction
205
- * @param account Account to send from
206
- * @returns Promise resolving to transaction hash
207
- */
208
- distributeClaimableFunds(recipient: string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
907
+ distributeClaimableFunds(recipient: Address | string, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
209
908
  }
909
+ export {};
210
910
  //# sourceMappingURL=mailer-client.d.ts.map