@sudobility/contracts 0.15.1 → 1.9.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 (171) hide show
  1. package/README.md +2 -3
  2. package/artifacts/contracts/Mailer.sol/Mailer.dbg.json +1 -1
  3. package/artifacts/contracts/Mailer.sol/Mailer.json +2 -278
  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/index.d.ts +1 -1
  7. package/dist/evm/src/evm/index.d.ts.map +1 -1
  8. package/dist/evm/src/evm/index.js +4 -4
  9. package/dist/evm/src/evm/index.js.map +1 -1
  10. package/dist/evm/src/evm/mailer-client.d.ts +210 -0
  11. package/dist/evm/src/evm/mailer-client.d.ts.map +1 -0
  12. package/dist/evm/src/evm/mailer-client.js +417 -0
  13. package/dist/evm/src/evm/mailer-client.js.map +1 -0
  14. package/dist/evm/typechain-types/Mailer.d.ts +10 -177
  15. package/dist/evm/typechain-types/Mailer.d.ts.map +1 -1
  16. package/dist/evm/typechain-types/factories/Mailer__factory.d.ts +1 -216
  17. package/dist/evm/typechain-types/factories/Mailer__factory.d.ts.map +1 -1
  18. package/dist/evm/typechain-types/factories/Mailer__factory.js +1 -277
  19. package/dist/evm/typechain-types/factories/Mailer__factory.js.map +1 -1
  20. package/dist/solana/solana/index.d.ts +1 -1
  21. package/dist/solana/solana/index.d.ts.map +1 -1
  22. package/dist/solana/solana/index.js +1 -4
  23. package/dist/solana/solana/index.js.map +1 -1
  24. package/dist/solana/solana/mailer-client.d.ts +209 -0
  25. package/dist/solana/solana/mailer-client.d.ts.map +1 -0
  26. package/dist/solana/solana/mailer-client.js +728 -0
  27. package/dist/solana/solana/mailer-client.js.map +1 -0
  28. package/dist/solana/solana/types.d.ts +2 -3
  29. package/dist/solana/solana/types.d.ts.map +1 -1
  30. package/dist/solana/solana/types.js.map +1 -1
  31. package/dist/unified/src/evm/index.d.ts +1 -1
  32. package/dist/unified/src/evm/index.d.ts.map +1 -1
  33. package/dist/unified/src/evm/index.js +4 -4
  34. package/dist/unified/src/evm/index.js.map +1 -1
  35. package/dist/unified/src/evm/mailer-client.d.ts +210 -0
  36. package/dist/unified/src/evm/mailer-client.d.ts.map +1 -0
  37. package/dist/unified/src/evm/mailer-client.js +417 -0
  38. package/dist/unified/src/evm/mailer-client.js.map +1 -0
  39. package/dist/unified/src/react/context/MailerProvider.d.ts +20 -26
  40. package/dist/unified/src/react/context/MailerProvider.d.ts.map +1 -1
  41. package/dist/unified/src/react/context/MailerProvider.js +26 -26
  42. package/dist/unified/src/react/context/MailerProvider.js.map +1 -1
  43. package/dist/unified/src/react/hooks/useMailerMutations.d.ts +192 -225
  44. package/dist/unified/src/react/hooks/useMailerMutations.d.ts.map +1 -1
  45. package/dist/unified/src/react/hooks/useMailerMutations.js +266 -263
  46. package/dist/unified/src/react/hooks/useMailerMutations.js.map +1 -1
  47. package/dist/unified/src/react/hooks/useMailerQueries.d.ts +63 -117
  48. package/dist/unified/src/react/hooks/useMailerQueries.d.ts.map +1 -1
  49. package/dist/unified/src/react/hooks/useMailerQueries.js +104 -239
  50. package/dist/unified/src/react/hooks/useMailerQueries.js.map +1 -1
  51. package/dist/unified/src/react/index.d.ts +3 -5
  52. package/dist/unified/src/react/index.d.ts.map +1 -1
  53. package/dist/unified/src/react/index.js +26 -41
  54. package/dist/unified/src/react/index.js.map +1 -1
  55. package/dist/unified/src/solana/index.d.ts +1 -1
  56. package/dist/unified/src/solana/index.d.ts.map +1 -1
  57. package/dist/unified/src/solana/index.js +1 -4
  58. package/dist/unified/src/solana/index.js.map +1 -1
  59. package/dist/unified/src/solana/mailer-client.d.ts +209 -0
  60. package/dist/unified/src/solana/mailer-client.d.ts.map +1 -0
  61. package/dist/unified/src/solana/mailer-client.js +728 -0
  62. package/dist/unified/src/solana/mailer-client.js.map +1 -0
  63. package/dist/unified/src/solana/types.d.ts +2 -3
  64. package/dist/unified/src/solana/types.d.ts.map +1 -1
  65. package/dist/unified/src/solana/types.js.map +1 -1
  66. package/dist/unified/src/unified/index.d.ts +1 -1
  67. package/dist/unified/src/unified/index.d.ts.map +1 -1
  68. package/dist/unified/src/unified/onchain-mailer-client.d.ts +247 -192
  69. package/dist/unified/src/unified/onchain-mailer-client.d.ts.map +1 -1
  70. package/dist/unified/src/unified/onchain-mailer-client.js +1462 -551
  71. package/dist/unified/src/unified/onchain-mailer-client.js.map +1 -1
  72. package/dist/unified/src/unified/types.d.ts +6 -23
  73. package/dist/unified/src/unified/types.d.ts.map +1 -1
  74. package/dist/unified/src/utils/chain-config.d.ts +2 -4
  75. package/dist/unified/src/utils/chain-config.d.ts.map +1 -1
  76. package/dist/unified/src/utils/chain-config.js +36 -46
  77. package/dist/unified/src/utils/chain-config.js.map +1 -1
  78. package/dist/unified/typechain-types/Mailer.d.ts +10 -177
  79. package/dist/unified/typechain-types/Mailer.d.ts.map +1 -1
  80. package/dist/unified/typechain-types/factories/Mailer__factory.d.ts +1 -216
  81. package/dist/unified/typechain-types/factories/Mailer__factory.d.ts.map +1 -1
  82. package/dist/unified/typechain-types/factories/Mailer__factory.js +1 -277
  83. package/dist/unified/typechain-types/factories/Mailer__factory.js.map +1 -1
  84. package/dist/unified-esm/src/evm/index.d.ts +1 -1
  85. package/dist/unified-esm/src/evm/index.d.ts.map +1 -1
  86. package/dist/unified-esm/src/evm/index.js +2 -2
  87. package/dist/unified-esm/src/evm/index.js.map +1 -1
  88. package/dist/unified-esm/src/evm/mailer-client.d.ts +210 -0
  89. package/dist/unified-esm/src/evm/mailer-client.d.ts.map +1 -0
  90. package/dist/unified-esm/src/evm/mailer-client.js +413 -0
  91. package/dist/unified-esm/src/evm/mailer-client.js.map +1 -0
  92. package/dist/unified-esm/src/react/context/MailerProvider.d.ts +20 -26
  93. package/dist/unified-esm/src/react/context/MailerProvider.d.ts.map +1 -1
  94. package/dist/unified-esm/src/react/context/MailerProvider.js +26 -25
  95. package/dist/unified-esm/src/react/context/MailerProvider.js.map +1 -1
  96. package/dist/unified-esm/src/react/hooks/useMailerMutations.d.ts +192 -225
  97. package/dist/unified-esm/src/react/hooks/useMailerMutations.d.ts.map +1 -1
  98. package/dist/unified-esm/src/react/hooks/useMailerMutations.js +262 -254
  99. package/dist/unified-esm/src/react/hooks/useMailerMutations.js.map +1 -1
  100. package/dist/unified-esm/src/react/hooks/useMailerQueries.d.ts +63 -117
  101. package/dist/unified-esm/src/react/hooks/useMailerQueries.d.ts.map +1 -1
  102. package/dist/unified-esm/src/react/hooks/useMailerQueries.js +102 -232
  103. package/dist/unified-esm/src/react/hooks/useMailerQueries.js.map +1 -1
  104. package/dist/unified-esm/src/react/index.d.ts +3 -5
  105. package/dist/unified-esm/src/react/index.d.ts.map +1 -1
  106. package/dist/unified-esm/src/react/index.js +5 -9
  107. package/dist/unified-esm/src/react/index.js.map +1 -1
  108. package/dist/unified-esm/src/solana/index.d.ts +1 -1
  109. package/dist/unified-esm/src/solana/index.d.ts.map +1 -1
  110. package/dist/unified-esm/src/solana/index.js +1 -2
  111. package/dist/unified-esm/src/solana/index.js.map +1 -1
  112. package/dist/unified-esm/src/solana/mailer-client.d.ts +209 -0
  113. package/dist/unified-esm/src/solana/mailer-client.d.ts.map +1 -0
  114. package/dist/unified-esm/src/solana/mailer-client.js +724 -0
  115. package/dist/unified-esm/src/solana/mailer-client.js.map +1 -0
  116. package/dist/unified-esm/src/solana/types.d.ts +2 -3
  117. package/dist/unified-esm/src/solana/types.d.ts.map +1 -1
  118. package/dist/unified-esm/src/solana/types.js.map +1 -1
  119. package/dist/unified-esm/src/unified/index.d.ts +1 -1
  120. package/dist/unified-esm/src/unified/index.d.ts.map +1 -1
  121. package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts +247 -192
  122. package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts.map +1 -1
  123. package/dist/unified-esm/src/unified/onchain-mailer-client.js +1462 -551
  124. package/dist/unified-esm/src/unified/onchain-mailer-client.js.map +1 -1
  125. package/dist/unified-esm/src/unified/types.d.ts +6 -23
  126. package/dist/unified-esm/src/unified/types.d.ts.map +1 -1
  127. package/dist/unified-esm/src/utils/chain-config.d.ts +2 -4
  128. package/dist/unified-esm/src/utils/chain-config.d.ts.map +1 -1
  129. package/dist/unified-esm/src/utils/chain-config.js +35 -46
  130. package/dist/unified-esm/src/utils/chain-config.js.map +1 -1
  131. package/dist/unified-esm/typechain-types/Mailer.d.ts +10 -177
  132. package/dist/unified-esm/typechain-types/Mailer.d.ts.map +1 -1
  133. package/dist/unified-esm/typechain-types/factories/Mailer__factory.d.ts +1 -216
  134. package/dist/unified-esm/typechain-types/factories/Mailer__factory.d.ts.map +1 -1
  135. package/dist/unified-esm/typechain-types/factories/Mailer__factory.js +1 -277
  136. package/dist/unified-esm/typechain-types/factories/Mailer__factory.js.map +1 -1
  137. package/package.json +11 -22
  138. package/programs/mailer/src/lib.rs +171 -1026
  139. package/programs/mailer/tests/integration_tests.rs +65 -586
  140. package/typechain-types/Mailer.ts +8 -319
  141. package/typechain-types/factories/Mailer__factory.ts +1 -277
  142. package/artifacts/contracts/Mailer.sol/Mailer.d.ts +0 -1146
  143. package/artifacts/contracts/Mailer.sol/artifacts.d.ts +0 -21
  144. package/artifacts/contracts/MockUSDC.sol/MockUSDC.d.ts +0 -284
  145. package/artifacts/contracts/MockUSDC.sol/artifacts.d.ts +0 -21
  146. package/artifacts/contracts/interfaces/IERC20.sol/IERC20.d.ts +0 -157
  147. package/artifacts/contracts/interfaces/IERC20.sol/artifacts.d.ts +0 -21
  148. package/dist/evm/src/evm/evm-mailer-client.d.ts +0 -1062
  149. package/dist/evm/src/evm/evm-mailer-client.d.ts.map +0 -1
  150. package/dist/evm/src/evm/evm-mailer-client.js +0 -924
  151. package/dist/evm/src/evm/evm-mailer-client.js.map +0 -1
  152. package/dist/solana/solana/solana-mailer-client.d.ts +0 -209
  153. package/dist/solana/solana/solana-mailer-client.d.ts.map +0 -1
  154. package/dist/solana/solana/solana-mailer-client.js +0 -1004
  155. package/dist/solana/solana/solana-mailer-client.js.map +0 -1
  156. package/dist/unified/src/evm/evm-mailer-client.d.ts +0 -1062
  157. package/dist/unified/src/evm/evm-mailer-client.d.ts.map +0 -1
  158. package/dist/unified/src/evm/evm-mailer-client.js +0 -924
  159. package/dist/unified/src/evm/evm-mailer-client.js.map +0 -1
  160. package/dist/unified/src/solana/solana-mailer-client.d.ts +0 -209
  161. package/dist/unified/src/solana/solana-mailer-client.d.ts.map +0 -1
  162. package/dist/unified/src/solana/solana-mailer-client.js +0 -1004
  163. package/dist/unified/src/solana/solana-mailer-client.js.map +0 -1
  164. package/dist/unified-esm/src/evm/evm-mailer-client.d.ts +0 -1062
  165. package/dist/unified-esm/src/evm/evm-mailer-client.d.ts.map +0 -1
  166. package/dist/unified-esm/src/evm/evm-mailer-client.js +0 -920
  167. package/dist/unified-esm/src/evm/evm-mailer-client.js.map +0 -1
  168. package/dist/unified-esm/src/solana/solana-mailer-client.d.ts +0 -209
  169. package/dist/unified-esm/src/solana/solana-mailer-client.d.ts.map +0 -1
  170. package/dist/unified-esm/src/solana/solana-mailer-client.js +0 -1000
  171. package/dist/unified-esm/src/solana/solana-mailer-client.js.map +0 -1
@@ -0,0 +1,210 @@
1
+ import { Account, Address, Hash, PublicClient, WalletClient } from "viem";
2
+ /**
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
+ * ```
37
+ */
38
+ export declare class MailerClient {
39
+ private contractAddress;
40
+ private publicClient;
41
+ /**
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
45
+ */
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>;
79
+ /**
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
91
+ */
92
+ sendPrepared(to: Address, mailId: string, revenueShareToReceiver: boolean, resolveSenderToName: boolean | undefined, walletClient: WalletClient, account: Account | Address): Promise<Hash>;
93
+ getSendFee(): Promise<bigint>;
94
+ getUsdcToken(): Promise<Address>;
95
+ getAddress(): Address;
96
+ claimRecipientShare(walletClient: WalletClient, account: Account | Address): Promise<Hash>;
97
+ 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
+ }>;
104
+ 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
+ */
125
+ 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
+ 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
+ */
180
+ 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
+ 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
+ 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
+ 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>;
209
+ }
210
+ //# sourceMappingURL=mailer-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mailer-client.d.ts","sourceRoot":"","sources":["../../../../src/evm/mailer-client.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AY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,GAAG,OAAO,GACzB,OAAO,CAAC,IAAI,CAAC;IAWhB;;;;;;OAMG;IACG,MAAM,CACV,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,GAAG,OAAO,GACzB,OAAO,CAAC,IAAI,CAAC;IAWhB;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAS/B;;;;;OAKG;IACG,KAAK,CACT,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,GAAG,OAAO,GACzB,OAAO,CAAC,IAAI,CAAC;IAUhB;;;;;OAKG;IACG,OAAO,CACX,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,GAAG,OAAO,GACzB,OAAO,CAAC,IAAI,CAAC;IAUhB;;;;;OAKG;IACG,gBAAgB,CACpB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,GAAG,OAAO,GACzB,OAAO,CAAC,IAAI,CAAC;IAUhB;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IASlC;;;;;;;OAOG;IACG,wBAAwB,CAC5B,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,GAAG,OAAO,GACzB,OAAO,CAAC,IAAI,CAAC;CAUjB"}
@@ -0,0 +1,413 @@
1
+ import { getAddress } from "viem";
2
+ import { Mailer__factory } from "../../typechain-types/factories/Mailer__factory.js";
3
+ // Get ABI from typechain-generated factories
4
+ const MAILER_ABI = Mailer__factory.abi;
5
+ // Get bytecode from typechain-generated factories
6
+ const MAILER_BYTECODE = Mailer__factory.bytecode;
7
+ /**
8
+ * @class MailerClient
9
+ * @description High-level TypeScript client for the Mailer contract using viem
10
+ * @notice Provides easy-to-use methods for sending messages with USDC fees and revenue sharing
11
+ *
12
+ * ## Key Features:
13
+ * - **Delegation Management**: Delegate mail handling with rejection capability
14
+ * - **Priority Messages**: Full fee (0.1 USDC) with 90% revenue share to recipient
15
+ * - **Standard Messages**: 10% fee only (0.01 USDC) with no revenue share
16
+ * - **Revenue Claims**: 60-day claim period for priority message revenue shares
17
+ *
18
+ * ## Usage Examples:
19
+ * ```typescript
20
+ * // Connect to existing contract
21
+ * import { createPublicClient, createWalletClient, http } from 'viem';
22
+ * import { mainnet } from 'viem/chains';
23
+ *
24
+ * const publicClient = createPublicClient({
25
+ * chain: mainnet,
26
+ * transport: http()
27
+ * });
28
+ *
29
+ * const mailer = new MailerClient('CONTRACT_ADDRESS', publicClient);
30
+ *
31
+ * // Send message with revenue sharing to recipient
32
+ * const walletClient = createWalletClient({
33
+ * chain: mainnet,
34
+ * transport: http()
35
+ * });
36
+ *
37
+ * await mailer.send('0x...', 'Subject', 'Body', true, walletClient, account);
38
+ *
39
+ * // Claim your revenue share (as recipient)
40
+ * await mailer.claimRecipientShare(walletClient, account);
41
+ * ```
42
+ */
43
+ export class MailerClient {
44
+ /**
45
+ * @description Creates a new MailerClient instance
46
+ * @param contractAddress The deployed Mailer contract address
47
+ * @param publicClient Viem public client for reading blockchain state
48
+ */
49
+ constructor(contractAddress, publicClient) {
50
+ this.contractAddress = getAddress(contractAddress);
51
+ this.publicClient = publicClient;
52
+ }
53
+ /**
54
+ * @description Deploy a new Mailer contract and return a client instance
55
+ * @param walletClient Viem wallet client with deployment permissions
56
+ * @param account Account to deploy from
57
+ * @param usdcTokenAddress Address of the USDC token contract
58
+ * @param ownerAddress Address that will own the deployed contract
59
+ * @returns Promise resolving to a MailerClient instance
60
+ */
61
+ static async deploy(walletClient, publicClient, account, usdcTokenAddress, ownerAddress) {
62
+ const hash = await walletClient.deployContract({
63
+ abi: MAILER_ABI,
64
+ bytecode: MAILER_BYTECODE,
65
+ args: [getAddress(usdcTokenAddress), getAddress(ownerAddress)],
66
+ account,
67
+ chain: walletClient.chain,
68
+ });
69
+ const receipt = await publicClient.waitForTransactionReceipt({ hash });
70
+ if (!receipt.contractAddress) {
71
+ throw new Error("Contract deployment failed");
72
+ }
73
+ return new MailerClient(receipt.contractAddress, publicClient);
74
+ }
75
+ /**
76
+ * @description Send a message with optional revenue sharing
77
+ * @notice Two modes:
78
+ * - revenueShareToReceiver=true: Sender pays 0.1 USDC, recipient gets 90% claimable
79
+ * - revenueShareToReceiver=false: Sender pays 0.01 USDC only
80
+ * @param to Recipient address who receives the message and potential revenue share
81
+ * @param subject Message subject line
82
+ * @param body Message content
83
+ * @param revenueShareToReceiver If true, recipient gets 90% revenue share; if false, no revenue share
84
+ * @param resolveSenderToName If true, resolve sender address to name via off-chain service
85
+ * @param walletClient Viem wallet client for transaction
86
+ * @param account Account to send from
87
+ * @returns Promise resolving to transaction hash
88
+ * @example
89
+ * ```typescript
90
+ * // Send with revenue share to recipient
91
+ * const hash = await mailer.send('0x...', 'Subject', 'Priority message', true, false, walletClient, account);
92
+ * // Send standard message (no revenue share)
93
+ * const hash2 = await mailer.send('0x...', 'Subject', 'Standard message', false, false, walletClient, account);
94
+ * await publicClient.waitForTransactionReceipt({ hash });
95
+ * ```
96
+ */
97
+ async send(to, subject, body, revenueShareToReceiver, resolveSenderToName = false, walletClient, account) {
98
+ return await walletClient.writeContract({
99
+ address: this.contractAddress,
100
+ abi: MAILER_ABI,
101
+ functionName: 'send',
102
+ args: [to, subject, body, revenueShareToReceiver, resolveSenderToName],
103
+ account,
104
+ chain: walletClient.chain,
105
+ });
106
+ }
107
+ /**
108
+ * @description Send a message using a pre-prepared mail ID with optional revenue sharing
109
+ * @notice Two modes:
110
+ * - revenueShareToReceiver=true: Sender pays 0.1 USDC, recipient gets 90% claimable
111
+ * - revenueShareToReceiver=false: Sender pays 0.01 USDC only
112
+ * @param to Recipient address who receives the message and potential revenue share
113
+ * @param mailId Pre-prepared message identifier
114
+ * @param revenueShareToReceiver If true, recipient gets 90% revenue share; if false, no revenue share
115
+ * @param resolveSenderToName If true, resolve sender address to name via off-chain service
116
+ * @param walletClient Viem wallet client for transaction
117
+ * @param account Account to send from
118
+ * @returns Promise resolving to transaction hash
119
+ */
120
+ async sendPrepared(to, mailId, revenueShareToReceiver, resolveSenderToName = false, walletClient, account) {
121
+ return await walletClient.writeContract({
122
+ address: this.contractAddress,
123
+ abi: MAILER_ABI,
124
+ functionName: 'sendPrepared',
125
+ args: [to, mailId, revenueShareToReceiver, resolveSenderToName],
126
+ account,
127
+ chain: walletClient.chain,
128
+ });
129
+ }
130
+ async getSendFee() {
131
+ return await this.publicClient.readContract({
132
+ address: this.contractAddress,
133
+ abi: MAILER_ABI,
134
+ functionName: 'sendFee',
135
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
136
+ });
137
+ }
138
+ async getUsdcToken() {
139
+ return await this.publicClient.readContract({
140
+ address: this.contractAddress,
141
+ abi: MAILER_ABI,
142
+ functionName: 'usdcToken',
143
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
144
+ });
145
+ }
146
+ getAddress() {
147
+ return this.contractAddress;
148
+ }
149
+ async claimRecipientShare(walletClient, account) {
150
+ return await walletClient.writeContract({
151
+ address: this.contractAddress,
152
+ abi: MAILER_ABI,
153
+ functionName: 'claimRecipientShare',
154
+ account,
155
+ chain: walletClient.chain,
156
+ });
157
+ }
158
+ async claimOwnerShare(walletClient, account) {
159
+ return await walletClient.writeContract({
160
+ address: this.contractAddress,
161
+ abi: MAILER_ABI,
162
+ functionName: 'claimOwnerShare',
163
+ account,
164
+ chain: walletClient.chain,
165
+ });
166
+ }
167
+ async claimExpiredShares(recipient, walletClient, account) {
168
+ return await walletClient.writeContract({
169
+ address: this.contractAddress,
170
+ abi: MAILER_ABI,
171
+ functionName: 'claimExpiredShares',
172
+ args: [getAddress(recipient)],
173
+ account,
174
+ chain: walletClient.chain,
175
+ });
176
+ }
177
+ async getRecipientClaimable(recipient) {
178
+ const result = await this.publicClient.readContract({
179
+ address: this.contractAddress,
180
+ abi: MAILER_ABI,
181
+ functionName: 'getRecipientClaimable',
182
+ args: [getAddress(recipient)],
183
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
184
+ });
185
+ return {
186
+ amount: result[0],
187
+ expiresAt: result[1],
188
+ isExpired: result[2]
189
+ };
190
+ }
191
+ async getOwnerClaimable() {
192
+ return await this.publicClient.readContract({
193
+ address: this.contractAddress,
194
+ abi: MAILER_ABI,
195
+ functionName: 'getOwnerClaimable'
196
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
197
+ });
198
+ }
199
+ // Delegation functionality
200
+ /**
201
+ * Delegate mail handling to another address
202
+ * @param delegate Address to delegate to (or 0x0 to clear delegation)
203
+ * @param walletClient Connected wallet client
204
+ * @param account Account to send transaction from
205
+ * @returns Transaction hash
206
+ */
207
+ async delegateTo(delegate, walletClient, account) {
208
+ return await walletClient.writeContract({
209
+ address: this.contractAddress,
210
+ abi: MAILER_ABI,
211
+ functionName: 'delegateTo',
212
+ args: [getAddress(delegate)],
213
+ account,
214
+ chain: walletClient.chain,
215
+ });
216
+ }
217
+ /**
218
+ * Reject a delegation made to you by another address
219
+ * @param delegatingAddress Address that delegated to you
220
+ * @param walletClient Connected wallet client
221
+ * @param account Account to send transaction from
222
+ * @returns Transaction hash
223
+ */
224
+ async rejectDelegation(delegatingAddress, walletClient, account) {
225
+ return await walletClient.writeContract({
226
+ address: this.contractAddress,
227
+ abi: MAILER_ABI,
228
+ functionName: 'rejectDelegation',
229
+ args: [getAddress(delegatingAddress)],
230
+ account,
231
+ chain: walletClient.chain,
232
+ });
233
+ }
234
+ /**
235
+ * Get current delegation fee in USDC (6 decimals)
236
+ * @returns Delegation fee amount
237
+ */
238
+ async getDelegationFee() {
239
+ return await this.publicClient.readContract({
240
+ address: this.contractAddress,
241
+ abi: MAILER_ABI,
242
+ functionName: 'getDelegationFee',
243
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
244
+ });
245
+ }
246
+ /**
247
+ * Update delegation fee (owner only)
248
+ * @param newFee New fee amount in USDC (6 decimals)
249
+ * @param walletClient Connected wallet client
250
+ * @param account Account to send transaction from
251
+ * @returns Transaction hash
252
+ */
253
+ async setDelegationFee(newFee, walletClient, account) {
254
+ return await walletClient.writeContract({
255
+ address: this.contractAddress,
256
+ abi: MAILER_ABI,
257
+ functionName: 'setDelegationFee',
258
+ args: [newFee],
259
+ account,
260
+ chain: walletClient.chain,
261
+ });
262
+ }
263
+ /**
264
+ * @description Send a message to an email address (no wallet known)
265
+ * @notice Charges only 10% owner fee since recipient wallet is unknown
266
+ * @param toEmail Email address of the recipient
267
+ * @param subject Message subject line
268
+ * @param body Message content
269
+ * @param walletClient Viem wallet client for transaction
270
+ * @param account Account to send from
271
+ * @returns Promise resolving to transaction hash
272
+ * @example
273
+ * ```typescript
274
+ * // Send to email address
275
+ * const hash = await mailer.sendToEmailAddress('user@example.com', 'Subject', 'Body', walletClient, account);
276
+ * await publicClient.waitForTransactionReceipt({ hash });
277
+ * ```
278
+ */
279
+ async sendToEmailAddress(toEmail, subject, body, walletClient, account) {
280
+ return await walletClient.writeContract({
281
+ address: this.contractAddress,
282
+ abi: MAILER_ABI,
283
+ functionName: 'sendToEmailAddress',
284
+ args: [toEmail, subject, body],
285
+ account,
286
+ chain: walletClient.chain,
287
+ });
288
+ }
289
+ /**
290
+ * @description Send a pre-prepared message to an email address (no wallet known)
291
+ * @notice Charges only 10% owner fee since recipient wallet is unknown
292
+ * @param toEmail Email address of the recipient
293
+ * @param mailId Pre-prepared message identifier
294
+ * @param walletClient Viem wallet client for transaction
295
+ * @param account Account to send from
296
+ * @returns Promise resolving to transaction hash
297
+ */
298
+ async sendPreparedToEmailAddress(toEmail, mailId, walletClient, account) {
299
+ return await walletClient.writeContract({
300
+ address: this.contractAddress,
301
+ abi: MAILER_ABI,
302
+ functionName: 'sendPreparedToEmailAddress',
303
+ args: [toEmail, mailId],
304
+ account,
305
+ chain: walletClient.chain,
306
+ });
307
+ }
308
+ /**
309
+ * Set the send fee (owner only)
310
+ * @param newFee New fee amount in USDC (6 decimals)
311
+ * @param walletClient Viem wallet client for transaction
312
+ * @param account Account to send from (must be owner)
313
+ * @returns Promise resolving to transaction hash
314
+ */
315
+ async setFee(newFee, walletClient, account) {
316
+ return await walletClient.writeContract({
317
+ address: this.contractAddress,
318
+ abi: MAILER_ABI,
319
+ functionName: 'setFee',
320
+ args: [newFee],
321
+ account,
322
+ chain: walletClient.chain,
323
+ });
324
+ }
325
+ /**
326
+ * Get the current send fee
327
+ * @returns Current send fee in USDC (6 decimals)
328
+ */
329
+ async getFee() {
330
+ return await this.publicClient.readContract({
331
+ address: this.contractAddress,
332
+ abi: MAILER_ABI,
333
+ functionName: 'getFee',
334
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
335
+ });
336
+ }
337
+ /**
338
+ * Pause the contract and distribute all claimable funds (owner only)
339
+ * @param walletClient Viem wallet client for transaction
340
+ * @param account Account to send from (must be owner)
341
+ * @returns Promise resolving to transaction hash
342
+ */
343
+ async pause(walletClient, account) {
344
+ return await walletClient.writeContract({
345
+ address: this.contractAddress,
346
+ abi: MAILER_ABI,
347
+ functionName: 'pause',
348
+ account,
349
+ chain: walletClient.chain,
350
+ });
351
+ }
352
+ /**
353
+ * Unpause the contract (owner only)
354
+ * @param walletClient Viem wallet client for transaction
355
+ * @param account Account to send from (must be owner)
356
+ * @returns Promise resolving to transaction hash
357
+ */
358
+ async unpause(walletClient, account) {
359
+ return await walletClient.writeContract({
360
+ address: this.contractAddress,
361
+ abi: MAILER_ABI,
362
+ functionName: 'unpause',
363
+ account,
364
+ chain: walletClient.chain,
365
+ });
366
+ }
367
+ /**
368
+ * Emergency unpause without fund distribution (owner only)
369
+ * @param walletClient Viem wallet client for transaction
370
+ * @param account Account to send from (must be owner)
371
+ * @returns Promise resolving to transaction hash
372
+ */
373
+ async emergencyUnpause(walletClient, account) {
374
+ return await walletClient.writeContract({
375
+ address: this.contractAddress,
376
+ abi: MAILER_ABI,
377
+ functionName: 'emergencyUnpause',
378
+ account,
379
+ chain: walletClient.chain,
380
+ });
381
+ }
382
+ /**
383
+ * Check if contract is currently paused
384
+ * @returns True if contract is paused, false otherwise
385
+ */
386
+ async isPaused() {
387
+ return await this.publicClient.readContract({
388
+ address: this.contractAddress,
389
+ abi: MAILER_ABI,
390
+ functionName: 'isPaused',
391
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
392
+ });
393
+ }
394
+ /**
395
+ * Distribute a specific recipient's claimable funds during pause
396
+ * Anyone can call this function when contract is paused
397
+ * @param recipient Address to distribute funds for
398
+ * @param walletClient Viem wallet client for transaction
399
+ * @param account Account to send from
400
+ * @returns Promise resolving to transaction hash
401
+ */
402
+ async distributeClaimableFunds(recipient, walletClient, account) {
403
+ return await walletClient.writeContract({
404
+ address: this.contractAddress,
405
+ abi: MAILER_ABI,
406
+ functionName: 'distributeClaimableFunds',
407
+ args: [getAddress(recipient)],
408
+ account,
409
+ chain: walletClient.chain,
410
+ });
411
+ }
412
+ }
413
+ //# sourceMappingURL=mailer-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mailer-client.js","sourceRoot":"","sources":["../../../../src/evm/mailer-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,UAAU,EACX,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;AAErF,6CAA6C;AAC7C,MAAM,UAAU,GAAG,eAAe,CAAC,GAAG,CAAC;AAEvC,kDAAkD;AAClD,MAAM,eAAe,GAAG,eAAe,CAAC,QAAyB,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,OAAO,YAAY;IAIvB;;;;OAIG;IACH,YAAY,eAAuB,EAAE,YAA0B;QAC7D,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,YAA0B,EAC1B,YAA0B,EAC1B,OAA0B,EAC1B,gBA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