@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,724 @@
1
+ import { PublicKey, Transaction, TransactionInstruction, SystemProgram, } from '@solana/web3.js';
2
+ import { TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, createAssociatedTokenAccountInstruction, } from '@solana/spl-token';
3
+ /**
4
+ * Native Solana Program instruction data structures
5
+ */
6
+ // Instruction data encoding functions
7
+ function encodeInitialize(usdcMint) {
8
+ const data = Buffer.alloc(1 + 32);
9
+ data.writeUInt8(InstructionType.Initialize, 0);
10
+ usdcMint.toBuffer().copy(data, 1);
11
+ return data;
12
+ }
13
+ function encodeSend(to, subject, body, revenueShareToReceiver, resolveSenderToName = false) {
14
+ const subjectBytes = Buffer.from(subject, 'utf8');
15
+ const bodyBytes = Buffer.from(body, 'utf8');
16
+ const data = Buffer.alloc(1 + 32 + 4 + subjectBytes.length + 4 + bodyBytes.length + 1 + 1);
17
+ let offset = 0;
18
+ data.writeUInt8(InstructionType.Send, offset);
19
+ offset += 1;
20
+ to.toBuffer().copy(data, offset);
21
+ offset += 32;
22
+ data.writeUInt32LE(subjectBytes.length, offset);
23
+ offset += 4;
24
+ subjectBytes.copy(data, offset);
25
+ offset += subjectBytes.length;
26
+ data.writeUInt32LE(bodyBytes.length, offset);
27
+ offset += 4;
28
+ bodyBytes.copy(data, offset);
29
+ offset += bodyBytes.length;
30
+ data.writeUInt8(revenueShareToReceiver ? 1 : 0, offset);
31
+ offset += 1;
32
+ data.writeUInt8(resolveSenderToName ? 1 : 0, offset);
33
+ return data;
34
+ }
35
+ function encodeSendToEmail(toEmail, subject, body) {
36
+ const emailBytes = Buffer.from(toEmail, 'utf8');
37
+ const subjectBytes = Buffer.from(subject, 'utf8');
38
+ const bodyBytes = Buffer.from(body, 'utf8');
39
+ const data = Buffer.alloc(1 + 4 + emailBytes.length + 4 + subjectBytes.length + 4 + bodyBytes.length);
40
+ let offset = 0;
41
+ data.writeUInt8(InstructionType.SendToEmail, offset);
42
+ offset += 1;
43
+ data.writeUInt32LE(emailBytes.length, offset);
44
+ offset += 4;
45
+ emailBytes.copy(data, offset);
46
+ offset += emailBytes.length;
47
+ data.writeUInt32LE(subjectBytes.length, offset);
48
+ offset += 4;
49
+ subjectBytes.copy(data, offset);
50
+ offset += subjectBytes.length;
51
+ data.writeUInt32LE(bodyBytes.length, offset);
52
+ offset += 4;
53
+ bodyBytes.copy(data, offset);
54
+ return data;
55
+ }
56
+ function encodeSendPreparedToEmail(toEmail, mailId) {
57
+ const emailBytes = Buffer.from(toEmail, 'utf8');
58
+ const mailIdBytes = Buffer.from(mailId, 'utf8');
59
+ const data = Buffer.alloc(1 + 4 + emailBytes.length + 4 + mailIdBytes.length);
60
+ let offset = 0;
61
+ data.writeUInt8(InstructionType.SendPreparedToEmail, offset);
62
+ offset += 1;
63
+ data.writeUInt32LE(emailBytes.length, offset);
64
+ offset += 4;
65
+ emailBytes.copy(data, offset);
66
+ offset += emailBytes.length;
67
+ data.writeUInt32LE(mailIdBytes.length, offset);
68
+ offset += 4;
69
+ mailIdBytes.copy(data, offset);
70
+ return data;
71
+ }
72
+ function encodeSimpleInstruction(instructionType) {
73
+ const data = Buffer.alloc(1);
74
+ data.writeUInt8(instructionType, 0);
75
+ return data;
76
+ }
77
+ function encodeSetFee(newFee) {
78
+ const data = Buffer.alloc(1 + 8);
79
+ data.writeUInt8(InstructionType.SetFee, 0);
80
+ data.writeBigUInt64LE(newFee, 1);
81
+ return data;
82
+ }
83
+ function encodeSetDelegationFee(newFee) {
84
+ const data = Buffer.alloc(1 + 8);
85
+ data.writeUInt8(InstructionType.SetDelegationFee, 0);
86
+ data.writeBigUInt64LE(newFee, 1);
87
+ return data;
88
+ }
89
+ function encodeDelegateTo(delegate) {
90
+ if (!delegate) {
91
+ // Clear delegation - just send the instruction type and a null option
92
+ const data = Buffer.alloc(1 + 1);
93
+ data.writeUInt8(InstructionType.DelegateTo, 0);
94
+ data.writeUInt8(0, 1); // Option::None
95
+ return data;
96
+ }
97
+ else {
98
+ // Set delegation - send instruction type, Some option, and pubkey
99
+ const data = Buffer.alloc(1 + 1 + 32);
100
+ data.writeUInt8(InstructionType.DelegateTo, 0);
101
+ data.writeUInt8(1, 1); // Option::Some
102
+ delegate.toBuffer().copy(data, 2);
103
+ return data;
104
+ }
105
+ }
106
+ // Account data parsing functions
107
+ function parseMailerState(data) {
108
+ let offset = 0;
109
+ const owner = new PublicKey(data.slice(offset, offset + 32));
110
+ offset += 32;
111
+ const usdcMint = new PublicKey(data.slice(offset, offset + 32));
112
+ offset += 32;
113
+ const sendFee = data.readBigUInt64LE(offset);
114
+ offset += 8;
115
+ const delegationFee = data.readBigUInt64LE(offset);
116
+ offset += 8;
117
+ const ownerClaimable = data.readBigUInt64LE(offset);
118
+ offset += 8;
119
+ const paused = data.readUInt8(offset) === 1;
120
+ offset += 1;
121
+ const bump = data.readUInt8(offset);
122
+ return {
123
+ owner,
124
+ usdc_mint: usdcMint,
125
+ send_fee: sendFee,
126
+ delegation_fee: delegationFee,
127
+ owner_claimable: ownerClaimable,
128
+ paused,
129
+ bump,
130
+ };
131
+ }
132
+ function parseRecipientClaim(data) {
133
+ let offset = 0;
134
+ const recipient = new PublicKey(data.slice(offset, offset + 32));
135
+ offset += 32;
136
+ const amount = data.readBigUInt64LE(offset);
137
+ offset += 8;
138
+ const timestamp = data.readBigInt64LE(offset);
139
+ offset += 8;
140
+ const bump = data.readUInt8(offset);
141
+ return {
142
+ recipient,
143
+ amount,
144
+ timestamp,
145
+ bump,
146
+ };
147
+ }
148
+ function parseDelegation(data) {
149
+ let offset = 0;
150
+ const delegator = new PublicKey(data.slice(offset, offset + 32));
151
+ offset += 32;
152
+ const hasDelegate = data.readUInt8(offset) === 1;
153
+ offset += 1;
154
+ const delegate = hasDelegate
155
+ ? new PublicKey(data.slice(offset, offset + 32))
156
+ : null;
157
+ if (hasDelegate)
158
+ offset += 32;
159
+ const bump = data.readUInt8(offset);
160
+ return {
161
+ delegator,
162
+ delegate,
163
+ bump,
164
+ };
165
+ }
166
+ /**
167
+ * Instruction types for the native Solana program
168
+ */
169
+ var InstructionType;
170
+ (function (InstructionType) {
171
+ InstructionType[InstructionType["Initialize"] = 0] = "Initialize";
172
+ InstructionType[InstructionType["Send"] = 1] = "Send";
173
+ InstructionType[InstructionType["SendToEmail"] = 2] = "SendToEmail";
174
+ InstructionType[InstructionType["SendPreparedToEmail"] = 3] = "SendPreparedToEmail";
175
+ InstructionType[InstructionType["ClaimRecipientShare"] = 4] = "ClaimRecipientShare";
176
+ InstructionType[InstructionType["ClaimOwnerShare"] = 5] = "ClaimOwnerShare";
177
+ InstructionType[InstructionType["SetFee"] = 6] = "SetFee";
178
+ InstructionType[InstructionType["DelegateTo"] = 7] = "DelegateTo";
179
+ InstructionType[InstructionType["RejectDelegation"] = 8] = "RejectDelegation";
180
+ InstructionType[InstructionType["SetDelegationFee"] = 9] = "SetDelegationFee";
181
+ InstructionType[InstructionType["Pause"] = 10] = "Pause";
182
+ InstructionType[InstructionType["Unpause"] = 11] = "Unpause";
183
+ InstructionType[InstructionType["DistributeClaimableFunds"] = 12] = "DistributeClaimableFunds";
184
+ InstructionType[InstructionType["EmergencyUnpause"] = 13] = "EmergencyUnpause";
185
+ })(InstructionType || (InstructionType = {}));
186
+ /**
187
+ * @class MailerClient
188
+ * @description Native Solana program client for the Mailer program
189
+ * @notice Provides easy-to-use methods for sending messages with USDC fees and revenue sharing
190
+ *
191
+ * ## Key Features:
192
+ * - **Priority Messages**: Full fee (0.1 USDC) with 90% revenue share to recipient
193
+ * - **Standard Messages**: 10% fee only (0.01 USDC) with no revenue share
194
+ * - **Revenue Claims**: 60-day claim period for priority message revenue shares
195
+ * - **Delegation Management**: Delegate message handling with rejection capability
196
+ *
197
+ * ## Usage Examples:
198
+ * ```typescript
199
+ * // Connect to existing deployed program
200
+ * const connection = new Connection('https://api.devnet.solana.com');
201
+ * const wallet = new WalletAdapter(keypair);
202
+ * const programId = new PublicKey('9FLkBDGpZBcR8LMsQ7MwwV6X9P4TDFgN3DeRh5qYyHJF');
203
+ * const usdcMint = new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');
204
+ * const client = new MailerClient(connection, wallet, programId, usdcMint);
205
+ *
206
+ * // Send message with revenue sharing to recipient
207
+ * await client.send('recipient-address', 'Subject', 'Message body', true);
208
+ *
209
+ * // Claim your revenue share within 60 days (as recipient)
210
+ * await client.claimRecipientShare();
211
+ *
212
+ * // Check claimable amount
213
+ * const info = await client.getRecipientClaimable();
214
+ * if (info) console.log(`Claimable: ${formatUSDC(info.amount)} USDC`);
215
+ * ```
216
+ *
217
+ * @author Mailer Team
218
+ * @version 2.0.0 - Native Solana Program (no Anchor)
219
+ */
220
+ export class MailerClient {
221
+ constructor(connection, wallet, programId, usdcMint) {
222
+ this.connection = connection;
223
+ this.wallet = wallet;
224
+ this.programId = programId;
225
+ this.usdcMint = usdcMint;
226
+ // Derive the mailer state PDA
227
+ const [mailerPda, bump] = PublicKey.findProgramAddressSync([Buffer.from('mailer')], this.programId);
228
+ this.mailerStatePda = mailerPda;
229
+ this.mailerBump = bump;
230
+ }
231
+ /**
232
+ * Initialize the mailer program (owner only)
233
+ */
234
+ async initialize() {
235
+ const instruction = new TransactionInstruction({
236
+ keys: [
237
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
238
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: true },
239
+ { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
240
+ ],
241
+ programId: this.programId,
242
+ data: encodeInitialize(this.usdcMint),
243
+ });
244
+ const transaction = new Transaction().add(instruction);
245
+ return await this.sendTransaction(transaction);
246
+ }
247
+ /**
248
+ * Send a message with optional revenue sharing
249
+ * @param to Recipient's public key or address string who receives message and potential revenue share
250
+ * @param subject Message subject
251
+ * @param body Message body
252
+ * @param revenueShareToReceiver If true, recipient gets 90% revenue share; if false, no revenue share
253
+ * @param resolveSenderToName If true, resolve sender address to name via off-chain service
254
+ * @returns Transaction signature
255
+ */
256
+ async send(to, subject, body, revenueShareToReceiver = false, resolveSenderToName = false) {
257
+ const recipientKey = typeof to === 'string' ? new PublicKey(to) : to;
258
+ // Derive recipient claim PDA
259
+ const [recipientClaimPda] = PublicKey.findProgramAddressSync([Buffer.from('claim'), recipientKey.toBuffer()], this.programId);
260
+ // Get associated token accounts
261
+ const senderTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
262
+ const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
263
+ // Check if accounts need to be created
264
+ const instructions = [];
265
+ // Check if mailer token account exists
266
+ const mailerTokenInfo = await this.connection.getAccountInfo(mailerTokenAccount);
267
+ if (!mailerTokenInfo) {
268
+ instructions.push(createAssociatedTokenAccountInstruction(this.wallet.publicKey, mailerTokenAccount, this.mailerStatePda, this.usdcMint));
269
+ }
270
+ // Add the send instruction
271
+ const sendInstruction = new TransactionInstruction({
272
+ keys: [
273
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
274
+ { pubkey: recipientClaimPda, isSigner: false, isWritable: true },
275
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: false },
276
+ { pubkey: senderTokenAccount, isSigner: false, isWritable: true },
277
+ { pubkey: mailerTokenAccount, isSigner: false, isWritable: true },
278
+ { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
279
+ { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
280
+ ],
281
+ programId: this.programId,
282
+ data: encodeSend(recipientKey, subject, body, revenueShareToReceiver, resolveSenderToName),
283
+ });
284
+ instructions.push(sendInstruction);
285
+ const transaction = new Transaction().add(...instructions);
286
+ return await this.sendTransaction(transaction);
287
+ }
288
+ /**
289
+ * Claim recipient share of revenue
290
+ * @returns Transaction signature
291
+ */
292
+ async claimRecipientShare() {
293
+ const [recipientClaimPda] = PublicKey.findProgramAddressSync([Buffer.from('claim'), this.wallet.publicKey.toBuffer()], this.programId);
294
+ const recipientTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
295
+ const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
296
+ const instruction = new TransactionInstruction({
297
+ keys: [
298
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
299
+ { pubkey: recipientClaimPda, isSigner: false, isWritable: true },
300
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: false },
301
+ { pubkey: recipientTokenAccount, isSigner: false, isWritable: true },
302
+ { pubkey: mailerTokenAccount, isSigner: false, isWritable: true },
303
+ { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
304
+ ],
305
+ programId: this.programId,
306
+ data: encodeSimpleInstruction(InstructionType.ClaimRecipientShare),
307
+ });
308
+ const transaction = new Transaction().add(instruction);
309
+ return await this.sendTransaction(transaction);
310
+ }
311
+ /**
312
+ * Claim owner share of fees (owner only)
313
+ * @returns Transaction signature
314
+ */
315
+ async claimOwnerShare() {
316
+ const ownerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
317
+ const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
318
+ const instruction = new TransactionInstruction({
319
+ keys: [
320
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
321
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: true },
322
+ { pubkey: ownerTokenAccount, isSigner: false, isWritable: true },
323
+ { pubkey: mailerTokenAccount, isSigner: false, isWritable: true },
324
+ { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
325
+ ],
326
+ programId: this.programId,
327
+ data: encodeSimpleInstruction(InstructionType.ClaimOwnerShare),
328
+ });
329
+ const transaction = new Transaction().add(instruction);
330
+ return await this.sendTransaction(transaction);
331
+ }
332
+ /**
333
+ * Delegate message handling to another address
334
+ * @param delegate Address to delegate to, or null to clear delegation
335
+ * @returns Transaction signature
336
+ */
337
+ async delegateTo(delegate) {
338
+ const delegateKey = delegate
339
+ ? typeof delegate === 'string'
340
+ ? new PublicKey(delegate)
341
+ : delegate
342
+ : null;
343
+ const [delegationPda] = PublicKey.findProgramAddressSync([Buffer.from('delegation'), this.wallet.publicKey.toBuffer()], this.programId);
344
+ const delegatorTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
345
+ const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
346
+ const instruction = new TransactionInstruction({
347
+ keys: [
348
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
349
+ { pubkey: delegationPda, isSigner: false, isWritable: true },
350
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: false },
351
+ { pubkey: delegatorTokenAccount, isSigner: false, isWritable: true },
352
+ { pubkey: mailerTokenAccount, isSigner: false, isWritable: true },
353
+ { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
354
+ { pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
355
+ ],
356
+ programId: this.programId,
357
+ data: encodeDelegateTo(delegateKey),
358
+ });
359
+ const transaction = new Transaction().add(instruction);
360
+ return await this.sendTransaction(transaction);
361
+ }
362
+ /**
363
+ * Reject a delegation made to you
364
+ * @param delegator Address that delegated to you
365
+ * @returns Transaction signature
366
+ */
367
+ async rejectDelegation(delegator) {
368
+ const delegatorKey = typeof delegator === 'string' ? new PublicKey(delegator) : delegator;
369
+ const [delegationPda] = PublicKey.findProgramAddressSync([Buffer.from('delegation'), delegatorKey.toBuffer()], this.programId);
370
+ const instruction = new TransactionInstruction({
371
+ keys: [
372
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
373
+ { pubkey: delegationPda, isSigner: false, isWritable: true },
374
+ ],
375
+ programId: this.programId,
376
+ data: encodeSimpleInstruction(InstructionType.RejectDelegation),
377
+ });
378
+ const transaction = new Transaction().add(instruction);
379
+ return await this.sendTransaction(transaction);
380
+ }
381
+ /**
382
+ * Set the send fee (owner only)
383
+ * @param newFee New fee in USDC micro-units (6 decimals)
384
+ * @returns Transaction signature
385
+ */
386
+ async setFee(newFee) {
387
+ const instruction = new TransactionInstruction({
388
+ keys: [
389
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
390
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: true },
391
+ ],
392
+ programId: this.programId,
393
+ data: encodeSetFee(typeof newFee === 'bigint' ? newFee : BigInt(newFee)),
394
+ });
395
+ const transaction = new Transaction().add(instruction);
396
+ return await this.sendTransaction(transaction);
397
+ }
398
+ /**
399
+ * Set the delegation fee (owner only)
400
+ * @param newFee New delegation fee in USDC micro-units (6 decimals)
401
+ * @returns Transaction signature
402
+ */
403
+ async setDelegationFee(newFee) {
404
+ const instruction = new TransactionInstruction({
405
+ keys: [
406
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
407
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: true },
408
+ ],
409
+ programId: this.programId,
410
+ data: encodeSetDelegationFee(typeof newFee === 'bigint' ? newFee : BigInt(newFee)),
411
+ });
412
+ const transaction = new Transaction().add(instruction);
413
+ return await this.sendTransaction(transaction);
414
+ }
415
+ /**
416
+ * Get current fees from the mailer state
417
+ * @returns MailerFees object with current fees
418
+ */
419
+ async getFees() {
420
+ const accountInfo = await this.connection.getAccountInfo(this.mailerStatePda);
421
+ if (!accountInfo) {
422
+ throw new Error('Mailer state account not found - program not initialized');
423
+ }
424
+ const stateData = parseMailerState(accountInfo.data);
425
+ return {
426
+ sendFee: Number(stateData.send_fee),
427
+ delegationFee: Number(stateData.delegation_fee),
428
+ };
429
+ }
430
+ /**
431
+ * Get recipient claimable information
432
+ * @param recipient Optional recipient address, defaults to wallet address
433
+ * @returns ClaimableInfo or null if no claimable amount
434
+ */
435
+ async getRecipientClaimable(recipient) {
436
+ const recipientKey = recipient || this.wallet.publicKey;
437
+ const [recipientClaimPda] = PublicKey.findProgramAddressSync([Buffer.from('claim'), recipientKey.toBuffer()], this.programId);
438
+ const accountInfo = await this.connection.getAccountInfo(recipientClaimPda);
439
+ if (!accountInfo) {
440
+ return null;
441
+ }
442
+ const claimData = parseRecipientClaim(accountInfo.data);
443
+ // Check if claim period has expired (60 days)
444
+ const now = Math.floor(Date.now() / 1000);
445
+ const isExpired = now > Number(claimData.timestamp) + 60 * 24 * 60 * 60;
446
+ return {
447
+ amount: Number(claimData.amount),
448
+ timestamp: Number(claimData.timestamp),
449
+ recipient: recipientKey.toBase58(),
450
+ isExpired,
451
+ };
452
+ }
453
+ /**
454
+ * Get owner claimable amount
455
+ * @returns Owner claimable amount in USDC micro-units
456
+ */
457
+ async getOwnerClaimable() {
458
+ const accountInfo = await this.connection.getAccountInfo(this.mailerStatePda);
459
+ if (!accountInfo) {
460
+ throw new Error('Mailer state account not found');
461
+ }
462
+ const stateData = parseMailerState(accountInfo.data);
463
+ return Number(stateData.owner_claimable);
464
+ }
465
+ /**
466
+ * Get delegation information for an address
467
+ * @param delegator Address to check delegation for, defaults to wallet address
468
+ * @returns Delegation info or null if no delegation
469
+ */
470
+ async getDelegation(delegator) {
471
+ const delegatorKey = delegator || this.wallet.publicKey;
472
+ const [delegationPda] = PublicKey.findProgramAddressSync([Buffer.from('delegation'), delegatorKey.toBuffer()], this.programId);
473
+ const accountInfo = await this.connection.getAccountInfo(delegationPda);
474
+ if (!accountInfo) {
475
+ return null;
476
+ }
477
+ const delegationData = parseDelegation(accountInfo.data);
478
+ return {
479
+ delegator: delegatorKey.toBase58(),
480
+ delegate: delegationData.delegate
481
+ ? delegationData.delegate.toBase58()
482
+ : null,
483
+ };
484
+ }
485
+ /**
486
+ * Get the mailer state PDA address
487
+ * @returns PublicKey of the mailer state PDA
488
+ */
489
+ getMailerStatePda() {
490
+ return this.mailerStatePda;
491
+ }
492
+ /**
493
+ * Send a message to an email address (no wallet known)
494
+ * Charges only 10% owner fee since recipient wallet is unknown
495
+ * @param toEmail Email address of the recipient
496
+ * @param subject Message subject
497
+ * @param body Message body
498
+ * @param options Transaction confirm options
499
+ * @returns Transaction signature
500
+ */
501
+ async sendToEmail(toEmail, subject, body, options) {
502
+ // Get associated token accounts
503
+ const senderTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
504
+ const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
505
+ // Check if accounts need to be created
506
+ const instructions = [];
507
+ // Check if mailer token account exists
508
+ const mailerTokenInfo = await this.connection.getAccountInfo(mailerTokenAccount);
509
+ if (!mailerTokenInfo) {
510
+ instructions.push(createAssociatedTokenAccountInstruction(this.wallet.publicKey, mailerTokenAccount, this.mailerStatePda, this.usdcMint));
511
+ }
512
+ // Encode instruction data for SendToEmail
513
+ const instructionData = encodeSendToEmail(toEmail, subject, body);
514
+ // Create send instruction
515
+ instructions.push(new TransactionInstruction({
516
+ keys: [
517
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
518
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: true },
519
+ { pubkey: senderTokenAccount, isSigner: false, isWritable: true },
520
+ { pubkey: mailerTokenAccount, isSigner: false, isWritable: true },
521
+ { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
522
+ ],
523
+ programId: this.programId,
524
+ data: instructionData,
525
+ }));
526
+ const transaction = new Transaction().add(...instructions);
527
+ return this.sendTransaction(transaction, options);
528
+ }
529
+ /**
530
+ * Send a prepared message to an email address (no wallet known)
531
+ * Charges only 10% owner fee since recipient wallet is unknown
532
+ * @param toEmail Email address of the recipient
533
+ * @param mailId Pre-prepared message ID
534
+ * @param options Transaction confirm options
535
+ * @returns Transaction signature
536
+ */
537
+ async sendPreparedToEmail(toEmail, mailId, options) {
538
+ // Get associated token accounts
539
+ const senderTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
540
+ const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
541
+ // Check if accounts need to be created
542
+ const instructions = [];
543
+ // Check if mailer token account exists
544
+ const mailerTokenInfo = await this.connection.getAccountInfo(mailerTokenAccount);
545
+ if (!mailerTokenInfo) {
546
+ instructions.push(createAssociatedTokenAccountInstruction(this.wallet.publicKey, mailerTokenAccount, this.mailerStatePda, this.usdcMint));
547
+ }
548
+ // Encode instruction data for SendPreparedToEmail
549
+ const instructionData = encodeSendPreparedToEmail(toEmail, mailId);
550
+ // Create send instruction
551
+ instructions.push(new TransactionInstruction({
552
+ keys: [
553
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
554
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: true },
555
+ { pubkey: senderTokenAccount, isSigner: false, isWritable: true },
556
+ { pubkey: mailerTokenAccount, isSigner: false, isWritable: true },
557
+ { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
558
+ ],
559
+ programId: this.programId,
560
+ data: instructionData,
561
+ }));
562
+ const transaction = new Transaction().add(...instructions);
563
+ return this.sendTransaction(transaction, options);
564
+ }
565
+ /**
566
+ * Send a prepared message using a mailId (to match EVM behavior)
567
+ * @param to Recipient's public key or address string
568
+ * @param mailId Pre-prepared message identifier
569
+ * @param revenueShareToReceiver If true, recipient gets 90% revenue share
570
+ * @param resolveSenderToName If true, resolve sender address to name
571
+ * @returns Transaction signature
572
+ */
573
+ async sendPrepared(to, mailId, revenueShareToReceiver = false, resolveSenderToName = false) {
574
+ // For Solana, we send the mailId as both subject and body to indicate it's a prepared message
575
+ return this.send(to, mailId, '', revenueShareToReceiver, resolveSenderToName);
576
+ }
577
+ /**
578
+ * Pause the contract and distribute owner claimable funds (owner only)
579
+ * @param options Transaction confirm options
580
+ * @returns Transaction signature
581
+ */
582
+ async pause(options) {
583
+ const ownerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
584
+ const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
585
+ const instruction = new TransactionInstruction({
586
+ keys: [
587
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
588
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: true },
589
+ { pubkey: ownerTokenAccount, isSigner: false, isWritable: true },
590
+ { pubkey: mailerTokenAccount, isSigner: false, isWritable: true },
591
+ { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
592
+ ],
593
+ programId: this.programId,
594
+ data: encodeSimpleInstruction(InstructionType.Pause),
595
+ });
596
+ const transaction = new Transaction().add(instruction);
597
+ return await this.sendTransaction(transaction, options);
598
+ }
599
+ /**
600
+ * Unpause the contract (owner only)
601
+ * @param options Transaction confirm options
602
+ * @returns Transaction signature
603
+ */
604
+ async unpause(options) {
605
+ const instruction = new TransactionInstruction({
606
+ keys: [
607
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
608
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: true },
609
+ ],
610
+ programId: this.programId,
611
+ data: encodeSimpleInstruction(InstructionType.Unpause),
612
+ });
613
+ const transaction = new Transaction().add(instruction);
614
+ return await this.sendTransaction(transaction, options);
615
+ }
616
+ /**
617
+ * Emergency unpause without fund distribution (owner only)
618
+ * @param options Transaction confirm options
619
+ * @returns Transaction signature
620
+ */
621
+ async emergencyUnpause(options) {
622
+ const instruction = new TransactionInstruction({
623
+ keys: [
624
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
625
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: true },
626
+ ],
627
+ programId: this.programId,
628
+ data: encodeSimpleInstruction(InstructionType.EmergencyUnpause),
629
+ });
630
+ const transaction = new Transaction().add(instruction);
631
+ return await this.sendTransaction(transaction, options);
632
+ }
633
+ /**
634
+ * Distribute claimable funds to a recipient when contract is paused
635
+ * @param recipient Recipient address to distribute funds for
636
+ * @param options Transaction confirm options
637
+ * @returns Transaction signature
638
+ */
639
+ async distributeClaimableFunds(recipient, options) {
640
+ const recipientKey = typeof recipient === 'string' ? new PublicKey(recipient) : recipient;
641
+ const [recipientClaimPda] = PublicKey.findProgramAddressSync([Buffer.from('claim'), recipientKey.toBuffer()], this.programId);
642
+ const recipientTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, recipientKey);
643
+ const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
644
+ // Encode the recipient parameter
645
+ const data = Buffer.alloc(1 + 32);
646
+ data.writeUInt8(InstructionType.DistributeClaimableFunds, 0);
647
+ recipientKey.toBuffer().copy(data, 1);
648
+ const instruction = new TransactionInstruction({
649
+ keys: [
650
+ { pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
651
+ { pubkey: this.mailerStatePda, isSigner: false, isWritable: false },
652
+ { pubkey: recipientClaimPda, isSigner: false, isWritable: true },
653
+ { pubkey: recipientTokenAccount, isSigner: false, isWritable: true },
654
+ { pubkey: mailerTokenAccount, isSigner: false, isWritable: true },
655
+ { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
656
+ ],
657
+ programId: this.programId,
658
+ data,
659
+ });
660
+ const transaction = new Transaction().add(instruction);
661
+ return await this.sendTransaction(transaction, options);
662
+ }
663
+ /**
664
+ * Get the current send fee
665
+ * @returns Send fee in USDC micro-units (6 decimals)
666
+ */
667
+ async getSendFee() {
668
+ const fees = await this.getFees();
669
+ return BigInt(fees.sendFee);
670
+ }
671
+ /**
672
+ * Check if contract is currently paused
673
+ * @returns True if contract is paused, false otherwise
674
+ */
675
+ async isPaused() {
676
+ const accountInfo = await this.connection.getAccountInfo(this.mailerStatePda);
677
+ if (!accountInfo) {
678
+ throw new Error('Mailer state account not found - program not initialized');
679
+ }
680
+ const stateData = parseMailerState(accountInfo.data);
681
+ // paused field is at offset: 32 + 32 + 8 + 8 + 8 = 88 bytes
682
+ return stateData.paused;
683
+ }
684
+ /**
685
+ * Send and confirm a transaction
686
+ * @param transaction Transaction to send
687
+ * @param options Confirm options
688
+ * @returns Transaction signature
689
+ */
690
+ async sendTransaction(transaction, options) {
691
+ // Get recent blockhash
692
+ const { blockhash } = await this.connection.getLatestBlockhash();
693
+ transaction.recentBlockhash = blockhash;
694
+ transaction.feePayer = this.wallet.publicKey;
695
+ // Sign transaction
696
+ const signedTx = await this.wallet.signTransaction(transaction);
697
+ // Send and confirm
698
+ const signature = await this.connection.sendRawTransaction(signedTx.serialize());
699
+ await this.connection.confirmTransaction(signature, options?.commitment || 'confirmed');
700
+ return signature;
701
+ }
702
+ /**
703
+ * Create a simple wallet from a keypair for testing
704
+ * @param keypair Solana keypair
705
+ * @returns Wallet interface implementation
706
+ */
707
+ static createWallet(keypair) {
708
+ return {
709
+ publicKey: keypair.publicKey,
710
+ async signTransaction(transaction) {
711
+ transaction.partialSign(keypair);
712
+ return transaction;
713
+ },
714
+ async signAllTransactions(transactions) {
715
+ return transactions.map((tx) => {
716
+ tx.partialSign(keypair);
717
+ return tx;
718
+ });
719
+ },
720
+ };
721
+ }
722
+ }
723
+ // Wallet interface is exported above
724
+ //# sourceMappingURL=mailer-client.js.map