@sudobility/contracts 0.14.0 → 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.
- package/README.md +2 -3
- package/artifacts/contracts/Mailer.sol/Mailer.dbg.json +1 -1
- package/artifacts/contracts/Mailer.sol/Mailer.json +2 -278
- package/artifacts/contracts/MockUSDC.sol/MockUSDC.dbg.json +1 -1
- package/artifacts/contracts/interfaces/IERC20.sol/IERC20.dbg.json +1 -1
- package/dist/evm/src/evm/index.d.ts +1 -1
- package/dist/evm/src/evm/index.d.ts.map +1 -1
- package/dist/evm/src/evm/index.js +1 -1
- package/dist/evm/src/evm/index.js.map +1 -1
- package/dist/evm/src/evm/mailer-client.d.ts +180 -936
- package/dist/evm/src/evm/mailer-client.d.ts.map +1 -1
- package/dist/evm/src/evm/mailer-client.js +249 -451
- package/dist/evm/src/evm/mailer-client.js.map +1 -1
- package/dist/evm/typechain-types/Mailer.d.ts +10 -177
- package/dist/evm/typechain-types/Mailer.d.ts.map +1 -1
- package/dist/evm/typechain-types/factories/Mailer__factory.d.ts +1 -216
- package/dist/evm/typechain-types/factories/Mailer__factory.d.ts.map +1 -1
- package/dist/evm/typechain-types/factories/Mailer__factory.js +1 -277
- package/dist/evm/typechain-types/factories/Mailer__factory.js.map +1 -1
- package/dist/solana/solana/index.d.ts +1 -1
- package/dist/solana/solana/index.d.ts.map +1 -1
- package/dist/solana/solana/index.js +1 -3
- package/dist/solana/solana/index.js.map +1 -1
- package/dist/solana/solana/mailer-client.d.ts +18 -91
- package/dist/solana/solana/mailer-client.d.ts.map +1 -1
- package/dist/solana/solana/mailer-client.js +55 -316
- package/dist/solana/solana/mailer-client.js.map +1 -1
- package/dist/unified/src/evm/index.d.ts +1 -1
- package/dist/unified/src/evm/index.d.ts.map +1 -1
- package/dist/unified/src/evm/index.js +1 -1
- package/dist/unified/src/evm/index.js.map +1 -1
- package/dist/unified/src/evm/mailer-client.d.ts +180 -936
- package/dist/unified/src/evm/mailer-client.d.ts.map +1 -1
- package/dist/unified/src/evm/mailer-client.js +249 -451
- package/dist/unified/src/evm/mailer-client.js.map +1 -1
- package/dist/unified/src/react/hooks/useMailerMutations.d.ts +1 -1
- package/dist/unified/src/react/hooks/useMailerMutations.js +1 -1
- package/dist/unified/src/solana/index.d.ts +1 -1
- package/dist/unified/src/solana/index.d.ts.map +1 -1
- package/dist/unified/src/solana/index.js +1 -3
- package/dist/unified/src/solana/index.js.map +1 -1
- package/dist/unified/src/solana/mailer-client.d.ts +18 -91
- package/dist/unified/src/solana/mailer-client.d.ts.map +1 -1
- package/dist/unified/src/solana/mailer-client.js +55 -316
- package/dist/unified/src/solana/mailer-client.js.map +1 -1
- package/dist/unified/src/unified/index.d.ts +1 -1
- package/dist/unified/src/unified/index.d.ts.map +1 -1
- package/dist/unified/src/unified/onchain-mailer-client.d.ts +251 -111
- package/dist/unified/src/unified/onchain-mailer-client.d.ts.map +1 -1
- package/dist/unified/src/unified/onchain-mailer-client.js +1375 -744
- package/dist/unified/src/unified/onchain-mailer-client.js.map +1 -1
- package/dist/unified/src/unified/types.d.ts +6 -16
- package/dist/unified/src/unified/types.d.ts.map +1 -1
- package/dist/unified/src/utils/chain-config.d.ts +2 -4
- package/dist/unified/src/utils/chain-config.d.ts.map +1 -1
- package/dist/unified/src/utils/chain-config.js +36 -46
- package/dist/unified/src/utils/chain-config.js.map +1 -1
- package/dist/unified/typechain-types/Mailer.d.ts +10 -177
- package/dist/unified/typechain-types/Mailer.d.ts.map +1 -1
- package/dist/unified/typechain-types/factories/Mailer__factory.d.ts +1 -216
- package/dist/unified/typechain-types/factories/Mailer__factory.d.ts.map +1 -1
- package/dist/unified/typechain-types/factories/Mailer__factory.js +1 -277
- package/dist/unified/typechain-types/factories/Mailer__factory.js.map +1 -1
- package/dist/unified-esm/src/evm/index.d.ts +1 -1
- package/dist/unified-esm/src/evm/index.d.ts.map +1 -1
- package/dist/unified-esm/src/evm/index.js +1 -1
- package/dist/unified-esm/src/evm/index.js.map +1 -1
- package/dist/unified-esm/src/evm/mailer-client.d.ts +180 -936
- package/dist/unified-esm/src/evm/mailer-client.d.ts.map +1 -1
- package/dist/unified-esm/src/evm/mailer-client.js +251 -453
- package/dist/unified-esm/src/evm/mailer-client.js.map +1 -1
- package/dist/unified-esm/src/react/hooks/useMailerMutations.d.ts +1 -1
- package/dist/unified-esm/src/react/hooks/useMailerMutations.js +1 -1
- package/dist/unified-esm/src/solana/index.d.ts +1 -1
- package/dist/unified-esm/src/solana/index.d.ts.map +1 -1
- package/dist/unified-esm/src/solana/index.js +1 -1
- package/dist/unified-esm/src/solana/index.js.map +1 -1
- package/dist/unified-esm/src/solana/mailer-client.d.ts +18 -91
- package/dist/unified-esm/src/solana/mailer-client.d.ts.map +1 -1
- package/dist/unified-esm/src/solana/mailer-client.js +56 -317
- package/dist/unified-esm/src/solana/mailer-client.js.map +1 -1
- package/dist/unified-esm/src/unified/index.d.ts +1 -1
- package/dist/unified-esm/src/unified/index.d.ts.map +1 -1
- package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts +251 -111
- package/dist/unified-esm/src/unified/onchain-mailer-client.d.ts.map +1 -1
- package/dist/unified-esm/src/unified/onchain-mailer-client.js +1379 -748
- package/dist/unified-esm/src/unified/onchain-mailer-client.js.map +1 -1
- package/dist/unified-esm/src/unified/types.d.ts +6 -16
- package/dist/unified-esm/src/unified/types.d.ts.map +1 -1
- package/dist/unified-esm/src/utils/chain-config.d.ts +2 -4
- package/dist/unified-esm/src/utils/chain-config.d.ts.map +1 -1
- package/dist/unified-esm/src/utils/chain-config.js +35 -46
- package/dist/unified-esm/src/utils/chain-config.js.map +1 -1
- package/dist/unified-esm/typechain-types/Mailer.d.ts +10 -177
- package/dist/unified-esm/typechain-types/Mailer.d.ts.map +1 -1
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.d.ts +1 -216
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.d.ts.map +1 -1
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.js +1 -277
- package/dist/unified-esm/typechain-types/factories/Mailer__factory.js.map +1 -1
- package/package.json +9 -20
- package/programs/mailer/src/lib.rs +171 -1026
- package/programs/mailer/tests/integration_tests.rs +65 -586
- package/typechain-types/Mailer.ts +8 -319
- package/typechain-types/factories/Mailer__factory.ts +1 -277
- package/artifacts/contracts/Mailer.sol/Mailer.d.ts +0 -1146
- package/artifacts/contracts/Mailer.sol/artifacts.d.ts +0 -21
- package/artifacts/contracts/MockUSDC.sol/MockUSDC.d.ts +0 -284
- package/artifacts/contracts/MockUSDC.sol/artifacts.d.ts +0 -21
- package/artifacts/contracts/interfaces/IERC20.sol/IERC20.d.ts +0 -157
- package/artifacts/contracts/interfaces/IERC20.sol/artifacts.d.ts +0 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicKey, Transaction, TransactionInstruction, SystemProgram,
|
|
1
|
+
import { PublicKey, Transaction, TransactionInstruction, SystemProgram, } from '@solana/web3.js';
|
|
2
2
|
import { TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, createAssociatedTokenAccountInstruction, } from '@solana/spl-token';
|
|
3
3
|
/**
|
|
4
4
|
* Native Solana Program instruction data structures
|
|
@@ -32,23 +32,6 @@ function encodeSend(to, subject, body, revenueShareToReceiver, resolveSenderToNa
|
|
|
32
32
|
data.writeUInt8(resolveSenderToName ? 1 : 0, offset);
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
-
function encodeSendPrepared(to, mailId, revenueShareToReceiver, resolveSenderToName = false) {
|
|
36
|
-
const mailIdBytes = Buffer.from(mailId, 'utf8');
|
|
37
|
-
const data = Buffer.alloc(1 + 32 + 4 + mailIdBytes.length + 1 + 1);
|
|
38
|
-
let offset = 0;
|
|
39
|
-
data.writeUInt8(InstructionType.SendPrepared, offset);
|
|
40
|
-
offset += 1;
|
|
41
|
-
to.toBuffer().copy(data, offset);
|
|
42
|
-
offset += 32;
|
|
43
|
-
data.writeUInt32LE(mailIdBytes.length, offset);
|
|
44
|
-
offset += 4;
|
|
45
|
-
mailIdBytes.copy(data, offset);
|
|
46
|
-
offset += mailIdBytes.length;
|
|
47
|
-
data.writeUInt8(revenueShareToReceiver ? 1 : 0, offset);
|
|
48
|
-
offset += 1;
|
|
49
|
-
data.writeUInt8(resolveSenderToName ? 1 : 0, offset);
|
|
50
|
-
return data;
|
|
51
|
-
}
|
|
52
35
|
function encodeSendToEmail(toEmail, subject, body) {
|
|
53
36
|
const emailBytes = Buffer.from(toEmail, 'utf8');
|
|
54
37
|
const subjectBytes = Buffer.from(subject, 'utf8');
|
|
@@ -86,23 +69,6 @@ function encodeSendPreparedToEmail(toEmail, mailId) {
|
|
|
86
69
|
mailIdBytes.copy(data, offset);
|
|
87
70
|
return data;
|
|
88
71
|
}
|
|
89
|
-
function encodeSendThroughWebhook(to, webhookId, revenueShareToReceiver, resolveSenderToName = false) {
|
|
90
|
-
const webhookBytes = Buffer.from(webhookId, 'utf8');
|
|
91
|
-
const data = Buffer.alloc(1 + 32 + 4 + webhookBytes.length + 1 + 1);
|
|
92
|
-
let offset = 0;
|
|
93
|
-
data.writeUInt8(InstructionType.SendThroughWebhook, offset);
|
|
94
|
-
offset += 1;
|
|
95
|
-
to.toBuffer().copy(data, offset);
|
|
96
|
-
offset += 32;
|
|
97
|
-
data.writeUInt32LE(webhookBytes.length, offset);
|
|
98
|
-
offset += 4;
|
|
99
|
-
webhookBytes.copy(data, offset);
|
|
100
|
-
offset += webhookBytes.length;
|
|
101
|
-
data.writeUInt8(revenueShareToReceiver ? 1 : 0, offset);
|
|
102
|
-
offset += 1;
|
|
103
|
-
data.writeUInt8(resolveSenderToName ? 1 : 0, offset);
|
|
104
|
-
return data;
|
|
105
|
-
}
|
|
106
72
|
function encodeSimpleInstruction(instructionType) {
|
|
107
73
|
const data = Buffer.alloc(1);
|
|
108
74
|
data.writeUInt8(instructionType, 0);
|
|
@@ -120,19 +86,6 @@ function encodeSetDelegationFee(newFee) {
|
|
|
120
86
|
data.writeBigUInt64LE(newFee, 1);
|
|
121
87
|
return data;
|
|
122
88
|
}
|
|
123
|
-
function encodeSetCustomFeePercentage(account, percentage) {
|
|
124
|
-
const data = Buffer.alloc(1 + 32 + 1);
|
|
125
|
-
data.writeUInt8(InstructionType.SetCustomFeePercentage, 0);
|
|
126
|
-
account.toBuffer().copy(data, 1);
|
|
127
|
-
data.writeUInt8(percentage, 33);
|
|
128
|
-
return data;
|
|
129
|
-
}
|
|
130
|
-
function encodeClearCustomFeePercentage(account) {
|
|
131
|
-
const data = Buffer.alloc(1 + 32);
|
|
132
|
-
data.writeUInt8(InstructionType.ClearCustomFeePercentage, 0);
|
|
133
|
-
account.toBuffer().copy(data, 1);
|
|
134
|
-
return data;
|
|
135
|
-
}
|
|
136
89
|
function encodeDelegateTo(delegate) {
|
|
137
90
|
if (!delegate) {
|
|
138
91
|
// Clear delegation - just send the instruction type and a null option
|
|
@@ -150,12 +103,6 @@ function encodeDelegateTo(delegate) {
|
|
|
150
103
|
return data;
|
|
151
104
|
}
|
|
152
105
|
}
|
|
153
|
-
function encodeClaimExpiredShares(recipient) {
|
|
154
|
-
const data = Buffer.alloc(1 + 32);
|
|
155
|
-
data.writeUInt8(InstructionType.ClaimExpiredShares, 0);
|
|
156
|
-
recipient.toBuffer().copy(data, 1);
|
|
157
|
-
return data;
|
|
158
|
-
}
|
|
159
106
|
// Account data parsing functions
|
|
160
107
|
function parseMailerState(data) {
|
|
161
108
|
let offset = 0;
|
|
@@ -216,40 +163,25 @@ function parseDelegation(data) {
|
|
|
216
163
|
bump,
|
|
217
164
|
};
|
|
218
165
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
offset += 32;
|
|
223
|
-
const discount = data.readUInt8(offset);
|
|
224
|
-
offset += 1;
|
|
225
|
-
const bump = data.readUInt8(offset);
|
|
226
|
-
return {
|
|
227
|
-
account,
|
|
228
|
-
discount,
|
|
229
|
-
bump,
|
|
230
|
-
};
|
|
231
|
-
}
|
|
166
|
+
/**
|
|
167
|
+
* Instruction types for the native Solana program
|
|
168
|
+
*/
|
|
232
169
|
var InstructionType;
|
|
233
170
|
(function (InstructionType) {
|
|
234
171
|
InstructionType[InstructionType["Initialize"] = 0] = "Initialize";
|
|
235
172
|
InstructionType[InstructionType["Send"] = 1] = "Send";
|
|
236
|
-
InstructionType[InstructionType["
|
|
237
|
-
InstructionType[InstructionType["
|
|
238
|
-
InstructionType[InstructionType["
|
|
239
|
-
InstructionType[InstructionType["
|
|
240
|
-
InstructionType[InstructionType["
|
|
241
|
-
InstructionType[InstructionType["
|
|
242
|
-
InstructionType[InstructionType["
|
|
243
|
-
InstructionType[InstructionType["
|
|
244
|
-
InstructionType[InstructionType["
|
|
245
|
-
InstructionType[InstructionType["
|
|
246
|
-
InstructionType[InstructionType["
|
|
247
|
-
InstructionType[InstructionType["
|
|
248
|
-
InstructionType[InstructionType["Pause"] = 14] = "Pause";
|
|
249
|
-
InstructionType[InstructionType["Unpause"] = 15] = "Unpause";
|
|
250
|
-
InstructionType[InstructionType["DistributeClaimableFunds"] = 16] = "DistributeClaimableFunds";
|
|
251
|
-
InstructionType[InstructionType["ClaimExpiredShares"] = 17] = "ClaimExpiredShares";
|
|
252
|
-
InstructionType[InstructionType["EmergencyUnpause"] = 18] = "EmergencyUnpause";
|
|
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";
|
|
253
185
|
})(InstructionType || (InstructionType = {}));
|
|
254
186
|
/**
|
|
255
187
|
* @class MailerClient
|
|
@@ -287,7 +219,6 @@ var InstructionType;
|
|
|
287
219
|
*/
|
|
288
220
|
export class MailerClient {
|
|
289
221
|
constructor(connection, wallet, programId, usdcMint) {
|
|
290
|
-
this.defaultComputeUnitMultiplier = 1.2; // 20% buffer by default
|
|
291
222
|
this.connection = connection;
|
|
292
223
|
this.wallet = wallet;
|
|
293
224
|
this.programId = programId;
|
|
@@ -297,69 +228,10 @@ export class MailerClient {
|
|
|
297
228
|
this.mailerStatePda = mailerPda;
|
|
298
229
|
this.mailerBump = bump;
|
|
299
230
|
}
|
|
300
|
-
/**
|
|
301
|
-
* Optimize compute units for a transaction
|
|
302
|
-
* @param transaction Transaction to optimize
|
|
303
|
-
* @param options Compute unit options
|
|
304
|
-
* @returns Optimized transaction with compute budget instructions
|
|
305
|
-
*/
|
|
306
|
-
async optimizeComputeUnits(transaction, options) {
|
|
307
|
-
// Skip if explicitly disabled
|
|
308
|
-
if (options?.skipComputeUnits) {
|
|
309
|
-
return { transaction };
|
|
310
|
-
}
|
|
311
|
-
let simulatedUnits;
|
|
312
|
-
let computeUnitLimit = options?.computeUnitLimit;
|
|
313
|
-
// Auto-optimize by simulating transaction
|
|
314
|
-
if (options?.autoOptimize && !computeUnitLimit) {
|
|
315
|
-
try {
|
|
316
|
-
// Set a high limit for simulation
|
|
317
|
-
const simTransaction = new Transaction().add(...transaction.instructions);
|
|
318
|
-
simTransaction.add(ComputeBudgetProgram.setComputeUnitLimit({
|
|
319
|
-
units: 1400000, // Max for simulation
|
|
320
|
-
}));
|
|
321
|
-
simTransaction.recentBlockhash = (await this.connection.getLatestBlockhash()).blockhash;
|
|
322
|
-
simTransaction.feePayer = this.wallet.publicKey;
|
|
323
|
-
const simulation = await this.connection.simulateTransaction(simTransaction);
|
|
324
|
-
if (simulation.value.err === null && simulation.value.unitsConsumed) {
|
|
325
|
-
simulatedUnits = simulation.value.unitsConsumed;
|
|
326
|
-
const multiplier = options.computeUnitMultiplier ?? this.defaultComputeUnitMultiplier;
|
|
327
|
-
computeUnitLimit = Math.min(Math.ceil(simulatedUnits * multiplier), 1400000 // Max compute units
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
catch (error) {
|
|
332
|
-
console.warn('Failed to simulate transaction for compute unit optimization:', error);
|
|
333
|
-
// Fall back to default or specified limit
|
|
334
|
-
computeUnitLimit = computeUnitLimit ?? 200000;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
// Create new transaction with compute budget instructions prepended
|
|
338
|
-
const optimizedTx = new Transaction();
|
|
339
|
-
// Add compute unit limit if specified or auto-optimized
|
|
340
|
-
if (computeUnitLimit) {
|
|
341
|
-
optimizedTx.add(ComputeBudgetProgram.setComputeUnitLimit({
|
|
342
|
-
units: computeUnitLimit,
|
|
343
|
-
}));
|
|
344
|
-
}
|
|
345
|
-
// Add priority fee if specified
|
|
346
|
-
if (options?.computeUnitPrice) {
|
|
347
|
-
optimizedTx.add(ComputeBudgetProgram.setComputeUnitPrice({
|
|
348
|
-
microLamports: options.computeUnitPrice,
|
|
349
|
-
}));
|
|
350
|
-
}
|
|
351
|
-
// Add original instructions
|
|
352
|
-
optimizedTx.add(...transaction.instructions);
|
|
353
|
-
return {
|
|
354
|
-
transaction: optimizedTx,
|
|
355
|
-
simulatedUnits,
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
231
|
/**
|
|
359
232
|
* Initialize the mailer program (owner only)
|
|
360
|
-
* @param computeOptions Compute unit optimization options
|
|
361
233
|
*/
|
|
362
|
-
async initialize(
|
|
234
|
+
async initialize() {
|
|
363
235
|
const instruction = new TransactionInstruction({
|
|
364
236
|
keys: [
|
|
365
237
|
{ pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
|
|
@@ -370,7 +242,7 @@ export class MailerClient {
|
|
|
370
242
|
data: encodeInitialize(this.usdcMint),
|
|
371
243
|
});
|
|
372
244
|
const transaction = new Transaction().add(instruction);
|
|
373
|
-
return await this.sendTransaction(transaction
|
|
245
|
+
return await this.sendTransaction(transaction);
|
|
374
246
|
}
|
|
375
247
|
/**
|
|
376
248
|
* Send a message with optional revenue sharing
|
|
@@ -379,10 +251,9 @@ export class MailerClient {
|
|
|
379
251
|
* @param body Message body
|
|
380
252
|
* @param revenueShareToReceiver If true, recipient gets 90% revenue share; if false, no revenue share
|
|
381
253
|
* @param resolveSenderToName If true, resolve sender address to name via off-chain service
|
|
382
|
-
* @
|
|
383
|
-
* @returns Transaction result with signature and compute details
|
|
254
|
+
* @returns Transaction signature
|
|
384
255
|
*/
|
|
385
|
-
async send(to, subject, body, revenueShareToReceiver = false, resolveSenderToName = false
|
|
256
|
+
async send(to, subject, body, revenueShareToReceiver = false, resolveSenderToName = false) {
|
|
386
257
|
const recipientKey = typeof to === 'string' ? new PublicKey(to) : to;
|
|
387
258
|
// Derive recipient claim PDA
|
|
388
259
|
const [recipientClaimPda] = PublicKey.findProgramAddressSync([Buffer.from('claim'), recipientKey.toBuffer()], this.programId);
|
|
@@ -412,13 +283,13 @@ export class MailerClient {
|
|
|
412
283
|
});
|
|
413
284
|
instructions.push(sendInstruction);
|
|
414
285
|
const transaction = new Transaction().add(...instructions);
|
|
415
|
-
return await this.sendTransaction(transaction
|
|
286
|
+
return await this.sendTransaction(transaction);
|
|
416
287
|
}
|
|
417
288
|
/**
|
|
418
289
|
* Claim recipient share of revenue
|
|
419
|
-
* @returns Transaction
|
|
290
|
+
* @returns Transaction signature
|
|
420
291
|
*/
|
|
421
|
-
async claimRecipientShare(
|
|
292
|
+
async claimRecipientShare() {
|
|
422
293
|
const [recipientClaimPda] = PublicKey.findProgramAddressSync([Buffer.from('claim'), this.wallet.publicKey.toBuffer()], this.programId);
|
|
423
294
|
const recipientTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
|
|
424
295
|
const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
|
|
@@ -435,13 +306,13 @@ export class MailerClient {
|
|
|
435
306
|
data: encodeSimpleInstruction(InstructionType.ClaimRecipientShare),
|
|
436
307
|
});
|
|
437
308
|
const transaction = new Transaction().add(instruction);
|
|
438
|
-
return await this.sendTransaction(transaction
|
|
309
|
+
return await this.sendTransaction(transaction);
|
|
439
310
|
}
|
|
440
311
|
/**
|
|
441
312
|
* Claim owner share of fees (owner only)
|
|
442
|
-
* @returns Transaction
|
|
313
|
+
* @returns Transaction signature
|
|
443
314
|
*/
|
|
444
|
-
async claimOwnerShare(
|
|
315
|
+
async claimOwnerShare() {
|
|
445
316
|
const ownerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
|
|
446
317
|
const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
|
|
447
318
|
const instruction = new TransactionInstruction({
|
|
@@ -456,35 +327,14 @@ export class MailerClient {
|
|
|
456
327
|
data: encodeSimpleInstruction(InstructionType.ClaimOwnerShare),
|
|
457
328
|
});
|
|
458
329
|
const transaction = new Transaction().add(instruction);
|
|
459
|
-
return await this.sendTransaction(transaction
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Claim expired recipient shares and move them under owner control
|
|
463
|
-
* @param recipient Recipient whose expired shares to reclaim
|
|
464
|
-
* @param options Transaction confirm options
|
|
465
|
-
* @returns Transaction signature
|
|
466
|
-
*/
|
|
467
|
-
async claimExpiredShares(recipient, options, computeOptions) {
|
|
468
|
-
const recipientKey = typeof recipient === 'string' ? new PublicKey(recipient) : recipient;
|
|
469
|
-
const [recipientClaimPda] = PublicKey.findProgramAddressSync([Buffer.from('claim'), recipientKey.toBuffer()], this.programId);
|
|
470
|
-
const instruction = new TransactionInstruction({
|
|
471
|
-
keys: [
|
|
472
|
-
{ pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
|
|
473
|
-
{ pubkey: this.mailerStatePda, isSigner: false, isWritable: true },
|
|
474
|
-
{ pubkey: recipientClaimPda, isSigner: false, isWritable: true },
|
|
475
|
-
],
|
|
476
|
-
programId: this.programId,
|
|
477
|
-
data: encodeClaimExpiredShares(recipientKey),
|
|
478
|
-
});
|
|
479
|
-
const transaction = new Transaction().add(instruction);
|
|
480
|
-
return await this.sendTransaction(transaction, options, computeOptions);
|
|
330
|
+
return await this.sendTransaction(transaction);
|
|
481
331
|
}
|
|
482
332
|
/**
|
|
483
333
|
* Delegate message handling to another address
|
|
484
334
|
* @param delegate Address to delegate to, or null to clear delegation
|
|
485
335
|
* @returns Transaction signature
|
|
486
336
|
*/
|
|
487
|
-
async delegateTo(delegate
|
|
337
|
+
async delegateTo(delegate) {
|
|
488
338
|
const delegateKey = delegate
|
|
489
339
|
? typeof delegate === 'string'
|
|
490
340
|
? new PublicKey(delegate)
|
|
@@ -507,35 +357,33 @@ export class MailerClient {
|
|
|
507
357
|
data: encodeDelegateTo(delegateKey),
|
|
508
358
|
});
|
|
509
359
|
const transaction = new Transaction().add(instruction);
|
|
510
|
-
return await this.sendTransaction(transaction
|
|
360
|
+
return await this.sendTransaction(transaction);
|
|
511
361
|
}
|
|
512
362
|
/**
|
|
513
363
|
* Reject a delegation made to you
|
|
514
364
|
* @param delegator Address that delegated to you
|
|
515
365
|
* @returns Transaction signature
|
|
516
366
|
*/
|
|
517
|
-
async rejectDelegation(delegator
|
|
367
|
+
async rejectDelegation(delegator) {
|
|
518
368
|
const delegatorKey = typeof delegator === 'string' ? new PublicKey(delegator) : delegator;
|
|
519
369
|
const [delegationPda] = PublicKey.findProgramAddressSync([Buffer.from('delegation'), delegatorKey.toBuffer()], this.programId);
|
|
520
370
|
const instruction = new TransactionInstruction({
|
|
521
371
|
keys: [
|
|
522
372
|
{ pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
|
|
523
373
|
{ pubkey: delegationPda, isSigner: false, isWritable: true },
|
|
524
|
-
{ pubkey: this.mailerStatePda, isSigner: false, isWritable: false },
|
|
525
374
|
],
|
|
526
375
|
programId: this.programId,
|
|
527
376
|
data: encodeSimpleInstruction(InstructionType.RejectDelegation),
|
|
528
377
|
});
|
|
529
378
|
const transaction = new Transaction().add(instruction);
|
|
530
|
-
return await this.sendTransaction(transaction
|
|
379
|
+
return await this.sendTransaction(transaction);
|
|
531
380
|
}
|
|
532
381
|
/**
|
|
533
382
|
* Set the send fee (owner only)
|
|
534
383
|
* @param newFee New fee in USDC micro-units (6 decimals)
|
|
535
|
-
* @
|
|
536
|
-
* @returns Transaction result
|
|
384
|
+
* @returns Transaction signature
|
|
537
385
|
*/
|
|
538
|
-
async setFee(newFee
|
|
386
|
+
async setFee(newFee) {
|
|
539
387
|
const instruction = new TransactionInstruction({
|
|
540
388
|
keys: [
|
|
541
389
|
{ pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
|
|
@@ -545,14 +393,14 @@ export class MailerClient {
|
|
|
545
393
|
data: encodeSetFee(typeof newFee === 'bigint' ? newFee : BigInt(newFee)),
|
|
546
394
|
});
|
|
547
395
|
const transaction = new Transaction().add(instruction);
|
|
548
|
-
return await this.sendTransaction(transaction
|
|
396
|
+
return await this.sendTransaction(transaction);
|
|
549
397
|
}
|
|
550
398
|
/**
|
|
551
399
|
* Set the delegation fee (owner only)
|
|
552
400
|
* @param newFee New delegation fee in USDC micro-units (6 decimals)
|
|
553
401
|
* @returns Transaction signature
|
|
554
402
|
*/
|
|
555
|
-
async setDelegationFee(newFee
|
|
403
|
+
async setDelegationFee(newFee) {
|
|
556
404
|
const instruction = new TransactionInstruction({
|
|
557
405
|
keys: [
|
|
558
406
|
{ pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
|
|
@@ -562,59 +410,7 @@ export class MailerClient {
|
|
|
562
410
|
data: encodeSetDelegationFee(typeof newFee === 'bigint' ? newFee : BigInt(newFee)),
|
|
563
411
|
});
|
|
564
412
|
const transaction = new Transaction().add(instruction);
|
|
565
|
-
return await this.sendTransaction(transaction
|
|
566
|
-
}
|
|
567
|
-
async setCustomFeePercentage(account, percentage, payer, computeOptions) {
|
|
568
|
-
const normalizedPercentage = Math.trunc(percentage);
|
|
569
|
-
if (normalizedPercentage < 0 || normalizedPercentage > 100) {
|
|
570
|
-
throw new Error('Percentage must be between 0 and 100');
|
|
571
|
-
}
|
|
572
|
-
const accountKey = typeof account === 'string' ? new PublicKey(account) : account;
|
|
573
|
-
const payerKey = payer
|
|
574
|
-
? typeof payer === 'string'
|
|
575
|
-
? new PublicKey(payer)
|
|
576
|
-
: payer
|
|
577
|
-
: this.wallet.publicKey;
|
|
578
|
-
const [discountPda] = PublicKey.findProgramAddressSync([Buffer.from('discount'), accountKey.toBuffer()], this.programId);
|
|
579
|
-
const instruction = new TransactionInstruction({
|
|
580
|
-
keys: [
|
|
581
|
-
{ pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
|
|
582
|
-
{ pubkey: this.mailerStatePda, isSigner: false, isWritable: false },
|
|
583
|
-
{ pubkey: discountPda, isSigner: false, isWritable: true },
|
|
584
|
-
{ pubkey: accountKey, isSigner: false, isWritable: false },
|
|
585
|
-
{ pubkey: payerKey, isSigner: true, isWritable: true },
|
|
586
|
-
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
587
|
-
],
|
|
588
|
-
programId: this.programId,
|
|
589
|
-
data: encodeSetCustomFeePercentage(accountKey, normalizedPercentage),
|
|
590
|
-
});
|
|
591
|
-
const transaction = new Transaction().add(instruction);
|
|
592
|
-
return this.sendTransaction(transaction, undefined, computeOptions);
|
|
593
|
-
}
|
|
594
|
-
async clearCustomFeePercentage(account, computeOptions) {
|
|
595
|
-
const accountKey = typeof account === 'string' ? new PublicKey(account) : account;
|
|
596
|
-
const [discountPda] = PublicKey.findProgramAddressSync([Buffer.from('discount'), accountKey.toBuffer()], this.programId);
|
|
597
|
-
const instruction = new TransactionInstruction({
|
|
598
|
-
keys: [
|
|
599
|
-
{ pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
|
|
600
|
-
{ pubkey: this.mailerStatePda, isSigner: false, isWritable: false },
|
|
601
|
-
{ pubkey: discountPda, isSigner: false, isWritable: true },
|
|
602
|
-
],
|
|
603
|
-
programId: this.programId,
|
|
604
|
-
data: encodeClearCustomFeePercentage(accountKey),
|
|
605
|
-
});
|
|
606
|
-
const transaction = new Transaction().add(instruction);
|
|
607
|
-
return this.sendTransaction(transaction, undefined, computeOptions);
|
|
608
|
-
}
|
|
609
|
-
async getCustomFeePercentage(account) {
|
|
610
|
-
const accountKey = typeof account === 'string' ? new PublicKey(account) : account;
|
|
611
|
-
const [discountPda] = PublicKey.findProgramAddressSync([Buffer.from('discount'), accountKey.toBuffer()], this.programId);
|
|
612
|
-
const accountInfo = await this.connection.getAccountInfo(discountPda);
|
|
613
|
-
if (!accountInfo) {
|
|
614
|
-
return 100;
|
|
615
|
-
}
|
|
616
|
-
const discountState = parseFeeDiscount(accountInfo.data);
|
|
617
|
-
return 100 - discountState.discount;
|
|
413
|
+
return await this.sendTransaction(transaction);
|
|
618
414
|
}
|
|
619
415
|
/**
|
|
620
416
|
* Get current fees from the mailer state
|
|
@@ -702,7 +498,7 @@ export class MailerClient {
|
|
|
702
498
|
* @param options Transaction confirm options
|
|
703
499
|
* @returns Transaction signature
|
|
704
500
|
*/
|
|
705
|
-
async sendToEmail(toEmail, subject, body, options
|
|
501
|
+
async sendToEmail(toEmail, subject, body, options) {
|
|
706
502
|
// Get associated token accounts
|
|
707
503
|
const senderTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
|
|
708
504
|
const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
|
|
@@ -728,7 +524,7 @@ export class MailerClient {
|
|
|
728
524
|
data: instructionData,
|
|
729
525
|
}));
|
|
730
526
|
const transaction = new Transaction().add(...instructions);
|
|
731
|
-
return this.sendTransaction(transaction, options
|
|
527
|
+
return this.sendTransaction(transaction, options);
|
|
732
528
|
}
|
|
733
529
|
/**
|
|
734
530
|
* Send a prepared message to an email address (no wallet known)
|
|
@@ -738,7 +534,7 @@ export class MailerClient {
|
|
|
738
534
|
* @param options Transaction confirm options
|
|
739
535
|
* @returns Transaction signature
|
|
740
536
|
*/
|
|
741
|
-
async sendPreparedToEmail(toEmail, mailId, options
|
|
537
|
+
async sendPreparedToEmail(toEmail, mailId, options) {
|
|
742
538
|
// Get associated token accounts
|
|
743
539
|
const senderTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
|
|
744
540
|
const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
|
|
@@ -764,7 +560,7 @@ export class MailerClient {
|
|
|
764
560
|
data: instructionData,
|
|
765
561
|
}));
|
|
766
562
|
const transaction = new Transaction().add(...instructions);
|
|
767
|
-
return this.sendTransaction(transaction, options
|
|
563
|
+
return this.sendTransaction(transaction, options);
|
|
768
564
|
}
|
|
769
565
|
/**
|
|
770
566
|
* Send a prepared message using a mailId (to match EVM behavior)
|
|
@@ -774,66 +570,16 @@ export class MailerClient {
|
|
|
774
570
|
* @param resolveSenderToName If true, resolve sender address to name
|
|
775
571
|
* @returns Transaction signature
|
|
776
572
|
*/
|
|
777
|
-
async sendPrepared(to, mailId, revenueShareToReceiver = false, resolveSenderToName = false
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
const senderTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
|
|
781
|
-
const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
|
|
782
|
-
const instructions = [];
|
|
783
|
-
const mailerTokenInfo = await this.connection.getAccountInfo(mailerTokenAccount);
|
|
784
|
-
if (!mailerTokenInfo) {
|
|
785
|
-
instructions.push(createAssociatedTokenAccountInstruction(this.wallet.publicKey, mailerTokenAccount, this.mailerStatePda, this.usdcMint));
|
|
786
|
-
}
|
|
787
|
-
const sendInstruction = new TransactionInstruction({
|
|
788
|
-
keys: [
|
|
789
|
-
{ pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
|
|
790
|
-
{ pubkey: recipientClaimPda, isSigner: false, isWritable: true },
|
|
791
|
-
{ pubkey: this.mailerStatePda, isSigner: false, isWritable: false },
|
|
792
|
-
{ pubkey: senderTokenAccount, isSigner: false, isWritable: true },
|
|
793
|
-
{ pubkey: mailerTokenAccount, isSigner: false, isWritable: true },
|
|
794
|
-
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
795
|
-
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
796
|
-
],
|
|
797
|
-
programId: this.programId,
|
|
798
|
-
data: encodeSendPrepared(recipientKey, mailId, revenueShareToReceiver, resolveSenderToName),
|
|
799
|
-
});
|
|
800
|
-
instructions.push(sendInstruction);
|
|
801
|
-
const transaction = new Transaction().add(...instructions);
|
|
802
|
-
return this.sendTransaction(transaction, undefined, computeOptions);
|
|
803
|
-
}
|
|
804
|
-
async sendThroughWebhook(to, webhookId, revenueShareToReceiver = false, resolveSenderToName = false, computeOptions) {
|
|
805
|
-
const recipientKey = typeof to === 'string' ? new PublicKey(to) : to;
|
|
806
|
-
const [recipientClaimPda] = PublicKey.findProgramAddressSync([Buffer.from('claim'), recipientKey.toBuffer()], this.programId);
|
|
807
|
-
const senderTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
|
|
808
|
-
const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
|
|
809
|
-
const instructions = [];
|
|
810
|
-
const mailerTokenInfo = await this.connection.getAccountInfo(mailerTokenAccount);
|
|
811
|
-
if (!mailerTokenInfo) {
|
|
812
|
-
instructions.push(createAssociatedTokenAccountInstruction(this.wallet.publicKey, mailerTokenAccount, this.mailerStatePda, this.usdcMint));
|
|
813
|
-
}
|
|
814
|
-
const sendInstruction = new TransactionInstruction({
|
|
815
|
-
keys: [
|
|
816
|
-
{ pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
|
|
817
|
-
{ pubkey: recipientClaimPda, isSigner: false, isWritable: true },
|
|
818
|
-
{ pubkey: this.mailerStatePda, isSigner: false, isWritable: false },
|
|
819
|
-
{ pubkey: senderTokenAccount, isSigner: false, isWritable: true },
|
|
820
|
-
{ pubkey: mailerTokenAccount, isSigner: false, isWritable: true },
|
|
821
|
-
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
822
|
-
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
823
|
-
],
|
|
824
|
-
programId: this.programId,
|
|
825
|
-
data: encodeSendThroughWebhook(recipientKey, webhookId, revenueShareToReceiver, resolveSenderToName),
|
|
826
|
-
});
|
|
827
|
-
instructions.push(sendInstruction);
|
|
828
|
-
const transaction = new Transaction().add(...instructions);
|
|
829
|
-
return this.sendTransaction(transaction, undefined, computeOptions);
|
|
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);
|
|
830
576
|
}
|
|
831
577
|
/**
|
|
832
578
|
* Pause the contract and distribute owner claimable funds (owner only)
|
|
833
579
|
* @param options Transaction confirm options
|
|
834
580
|
* @returns Transaction signature
|
|
835
581
|
*/
|
|
836
|
-
async pause(options
|
|
582
|
+
async pause(options) {
|
|
837
583
|
const ownerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.wallet.publicKey);
|
|
838
584
|
const mailerTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, this.mailerStatePda, true);
|
|
839
585
|
const instruction = new TransactionInstruction({
|
|
@@ -848,14 +594,14 @@ export class MailerClient {
|
|
|
848
594
|
data: encodeSimpleInstruction(InstructionType.Pause),
|
|
849
595
|
});
|
|
850
596
|
const transaction = new Transaction().add(instruction);
|
|
851
|
-
return await this.sendTransaction(transaction, options
|
|
597
|
+
return await this.sendTransaction(transaction, options);
|
|
852
598
|
}
|
|
853
599
|
/**
|
|
854
600
|
* Unpause the contract (owner only)
|
|
855
601
|
* @param options Transaction confirm options
|
|
856
602
|
* @returns Transaction signature
|
|
857
603
|
*/
|
|
858
|
-
async unpause(options
|
|
604
|
+
async unpause(options) {
|
|
859
605
|
const instruction = new TransactionInstruction({
|
|
860
606
|
keys: [
|
|
861
607
|
{ pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
|
|
@@ -865,14 +611,14 @@ export class MailerClient {
|
|
|
865
611
|
data: encodeSimpleInstruction(InstructionType.Unpause),
|
|
866
612
|
});
|
|
867
613
|
const transaction = new Transaction().add(instruction);
|
|
868
|
-
return await this.sendTransaction(transaction, options
|
|
614
|
+
return await this.sendTransaction(transaction, options);
|
|
869
615
|
}
|
|
870
616
|
/**
|
|
871
617
|
* Emergency unpause without fund distribution (owner only)
|
|
872
618
|
* @param options Transaction confirm options
|
|
873
619
|
* @returns Transaction signature
|
|
874
620
|
*/
|
|
875
|
-
async emergencyUnpause(options
|
|
621
|
+
async emergencyUnpause(options) {
|
|
876
622
|
const instruction = new TransactionInstruction({
|
|
877
623
|
keys: [
|
|
878
624
|
{ pubkey: this.wallet.publicKey, isSigner: true, isWritable: false },
|
|
@@ -882,7 +628,7 @@ export class MailerClient {
|
|
|
882
628
|
data: encodeSimpleInstruction(InstructionType.EmergencyUnpause),
|
|
883
629
|
});
|
|
884
630
|
const transaction = new Transaction().add(instruction);
|
|
885
|
-
return await this.sendTransaction(transaction, options
|
|
631
|
+
return await this.sendTransaction(transaction, options);
|
|
886
632
|
}
|
|
887
633
|
/**
|
|
888
634
|
* Distribute claimable funds to a recipient when contract is paused
|
|
@@ -890,7 +636,7 @@ export class MailerClient {
|
|
|
890
636
|
* @param options Transaction confirm options
|
|
891
637
|
* @returns Transaction signature
|
|
892
638
|
*/
|
|
893
|
-
async distributeClaimableFunds(recipient, options
|
|
639
|
+
async distributeClaimableFunds(recipient, options) {
|
|
894
640
|
const recipientKey = typeof recipient === 'string' ? new PublicKey(recipient) : recipient;
|
|
895
641
|
const [recipientClaimPda] = PublicKey.findProgramAddressSync([Buffer.from('claim'), recipientKey.toBuffer()], this.programId);
|
|
896
642
|
const recipientTokenAccount = getAssociatedTokenAddressSync(this.usdcMint, recipientKey);
|
|
@@ -912,7 +658,7 @@ export class MailerClient {
|
|
|
912
658
|
data,
|
|
913
659
|
});
|
|
914
660
|
const transaction = new Transaction().add(instruction);
|
|
915
|
-
return await this.sendTransaction(transaction, options
|
|
661
|
+
return await this.sendTransaction(transaction, options);
|
|
916
662
|
}
|
|
917
663
|
/**
|
|
918
664
|
* Get the current send fee
|
|
@@ -941,24 +687,17 @@ export class MailerClient {
|
|
|
941
687
|
* @param options Confirm options
|
|
942
688
|
* @returns Transaction signature
|
|
943
689
|
*/
|
|
944
|
-
async sendTransaction(transaction, options
|
|
945
|
-
// Optimize compute units if requested
|
|
946
|
-
const { transaction: optimizedTx, simulatedUnits } = await this.optimizeComputeUnits(transaction, computeOptions);
|
|
690
|
+
async sendTransaction(transaction, options) {
|
|
947
691
|
// Get recent blockhash
|
|
948
692
|
const { blockhash } = await this.connection.getLatestBlockhash();
|
|
949
|
-
|
|
950
|
-
|
|
693
|
+
transaction.recentBlockhash = blockhash;
|
|
694
|
+
transaction.feePayer = this.wallet.publicKey;
|
|
951
695
|
// Sign transaction
|
|
952
|
-
const signedTx = await this.wallet.signTransaction(
|
|
696
|
+
const signedTx = await this.wallet.signTransaction(transaction);
|
|
953
697
|
// Send and confirm
|
|
954
698
|
const signature = await this.connection.sendRawTransaction(signedTx.serialize());
|
|
955
699
|
await this.connection.confirmTransaction(signature, options?.commitment || 'confirmed');
|
|
956
|
-
return
|
|
957
|
-
signature,
|
|
958
|
-
simulatedUnits,
|
|
959
|
-
computeUnitLimit: computeOptions?.computeUnitLimit,
|
|
960
|
-
computeUnitPrice: computeOptions?.computeUnitPrice,
|
|
961
|
-
};
|
|
700
|
+
return signature;
|
|
962
701
|
}
|
|
963
702
|
/**
|
|
964
703
|
* Create a simple wallet from a keypair for testing
|