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