@usearete/adapter-web3js 0.3.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":[null],"names":["PublicKey","bs58","TransactionInstruction","TransactionMessage","VersionedTransaction","TransactionTransportError","SendTransactionError"],"mappings":";;;;;;;;;;AAAA;;;;;;AAMG;AA+GG,SAAU,uBAAuB,CACrC,UAA8C,EAAA;IAE9C,OAAO;QACL,MAAM,UAAU,CAAC,OAAe,EAAA;AAC9B,YAAA,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,cAAc,CAAC,IAAIA,iBAAS,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC;AACrF,YAAA,OAAO,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC;SAChE;KACF,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CACnB,KAAoC,EACpC,QAAoB,EAAA;IAEpB,OAAQ,KAAgC,IAAI,QAAQ,CAAC;AACvD,CAAC;AAED,SAAS,aAAa,CAAC,MAAgC,EAAA;AACrD,IAAA,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;AACrC,CAAC;AAED,SAAS,8BAA8B,CACrC,YAAyC,EACzC,QAAmB,EAAA;AAEnB,IAAA,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AAExD,IAAA,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;AACtC,QAAA,KAAK,MAAM,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE;AAClC,YAAA,IAAI,GAAG,CAAC,QAAQ,EAAE;AAChB,gBAAA,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;aAC1B;SACF;KACF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B,uBAAA,KAA4C,CAAC,OAAO,EAAE,MAAM,KAAK,cAAc,EACnF;AACA,oBAAA,MAAM,KAAK,CAAC;iBACb;AACD,gBAAA,OAAO,0BAA0B,CAC/B,UAAU,EACV,SAAS,EACT,UAAU,EACV,cAAc,EACd,KAAK,CACN,CAAC;aACH;SACF;KACF,CAAC;AACJ,CAAC;AAED;AACM,SAAU,0BAA0B,CAAC,MAM1C,EAAA;AACC,IAAA,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAAC;AACxF,IAAA,OAAO,mBAAmB,CAAC;QACzB,UAAU;QACV,SAAS;QACT,iBAAiB;QACjB,iBAAiB;AACjB,QAAA,MAAM,EAAE;YACN,SAAS,EAAE,OAAO,CAAC,SAAS;AAC5B,YAAA,4BAA4B,EAAE,IAAI,GAAG,CAAqB,CAAC,CAAC,CAAC,CAAC;YAC9D,MAAM,eAAe,CAAC,EAAwB,EAAA;AAC5C,gBAAA,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACnB,gBAAA,OAAO,EAAE,CAAC;aACX;AACF,SAAA;AACF,KAAA,CAAC,CAAC;AACL;;;;;;;;"}
@@ -0,0 +1,85 @@
1
+ import { PublicKey, VersionedTransaction, TransactionVersion, Connection, Signer, Commitment, TransactionInstruction, Keypair } from '@solana/web3.js';
2
+ import { TransactionTransport, SendOptions, TransactionInspectionOptions, TransactionInspectionResult, ProgramError, WalletAdapter, BuiltInstruction, WalletExecutionContext, SendResult, AccountLoader } from '@usearete/sdk';
3
+
4
+ /**
5
+ * @usearete/adapter-web3js
6
+ *
7
+ * An Arete WalletAdapter backed by @solana/web3.js. Transactions are compiled
8
+ * as v0 messages, signed once, submitted once, and then confirmed or
9
+ * classified without resubmission.
10
+ */
11
+
12
+ type AdapterTransportSelection = 'auto' | 'direct' | TransactionTransport;
13
+ /**
14
+ * The transaction-signing surface exposed by compatible browser wallets.
15
+ *
16
+ * This matches wallet-adapter-style signers. Raw Wallet Standard features use
17
+ * byte-array request/response types and need an explicit bridge before they
18
+ * satisfy this interface.
19
+ */
20
+ interface VersionedTransactionSigner {
21
+ publicKey: PublicKey;
22
+ signTransaction(tx: VersionedTransaction): Promise<VersionedTransaction>;
23
+ /** `null` means legacy-only; omitted means the caller guarantees v0 support. */
24
+ supportedTransactionVersions?: ReadonlySet<TransactionVersion> | null;
25
+ }
26
+ interface Web3JsAdapterConfig {
27
+ /** Direct Solana RPC dependency. Required by direct mode and standalone auto mode. */
28
+ connection?: Connection;
29
+ /** Arete when connected, direct when explicitly selected, or a custom transport. */
30
+ transport?: AdapterTransportSelection;
31
+ /** A signer that accepts v0 VersionedTransaction instances. */
32
+ signer: VersionedTransactionSigner;
33
+ /** Optional local signers that can satisfy additional required signatures. */
34
+ additionalSigners?: readonly Signer[];
35
+ /** Default commitment used when the caller does not specify one. */
36
+ defaultCommitment?: Commitment;
37
+ }
38
+ interface Web3JsSendOptions extends SendOptions {
39
+ /** Extra local signers for this send only. */
40
+ additionalSigners?: readonly Signer[];
41
+ /** Override the fee payer with a local signer. */
42
+ feePayer?: Signer;
43
+ confirmationTimeoutMs?: number;
44
+ statusPollIntervalMs?: number;
45
+ }
46
+ interface Web3JsInspectionOptions extends TransactionInspectionOptions {
47
+ /** Commitment used for blockhash, fee, and simulation RPCs. */
48
+ commitment?: Commitment;
49
+ /** Fee payer used to compile the unsigned v0 message. */
50
+ feePayer?: PublicKey;
51
+ /** Minimum slot the simulation RPC may evaluate. */
52
+ minContextSlot?: number;
53
+ /** Accounts to return from simulation. */
54
+ accounts?: readonly string[];
55
+ /** Include inner instructions in the simulation response. */
56
+ innerInstructions?: boolean;
57
+ }
58
+ interface Web3JsInspectionResult extends TransactionInspectionResult {
59
+ /** Context slot returned by fee estimation, when different from simulation. */
60
+ feeContextSlot?: number;
61
+ /** Generic custom-program error parsed from the simulation response. */
62
+ programError?: ProgramError;
63
+ }
64
+ interface Web3JsWalletAdapter extends WalletAdapter {
65
+ signAndSend(instructions: readonly BuiltInstruction[], options?: Web3JsSendOptions, context?: WalletExecutionContext): Promise<SendResult>;
66
+ inspectTransaction(instructions: readonly BuiltInstruction[], options?: Web3JsInspectionOptions, context?: WalletExecutionContext): Promise<Web3JsInspectionResult>;
67
+ }
68
+ declare function connectionAccountLoader(connection: Pick<Connection, 'getAccountInfo'>): AccountLoader;
69
+ /** Convert an Arete BuiltInstruction to a web3.js TransactionInstruction. */
70
+ declare function toTransactionInstruction(ix: BuiltInstruction): TransactionInstruction;
71
+ /** Convert a web3.js TransactionInstruction to an Arete BuiltInstruction. */
72
+ declare function fromTransactionInstruction(ix: TransactionInstruction): BuiltInstruction;
73
+ /** Create a WalletAdapter from a connection and a v0-capable signer. */
74
+ declare function createWalletAdapter(config: Web3JsAdapterConfig): Web3JsWalletAdapter;
75
+ /** Create a WalletAdapter backed by a local Keypair. */
76
+ declare function createKeypairWalletAdapter(config: {
77
+ connection?: Connection;
78
+ transport?: AdapterTransportSelection;
79
+ keypair: Keypair;
80
+ additionalSigners?: readonly Signer[];
81
+ defaultCommitment?: Commitment;
82
+ }): Web3JsWalletAdapter;
83
+
84
+ export { connectionAccountLoader, createKeypairWalletAdapter, createWalletAdapter, fromTransactionInstruction, toTransactionInstruction };
85
+ export type { AdapterTransportSelection, VersionedTransactionSigner, Web3JsAdapterConfig, Web3JsInspectionOptions, Web3JsInspectionResult, Web3JsSendOptions, Web3JsWalletAdapter };
package/dist/index.js ADDED
@@ -0,0 +1,529 @@
1
+ import bs58 from 'bs58';
2
+ import { PublicKey, TransactionInstruction, TransactionMessage, VersionedTransaction, SendTransactionError } from '@solana/web3.js';
3
+ import { TransactionTransportError } from '@usearete/sdk';
4
+
5
+ /**
6
+ * @usearete/adapter-web3js
7
+ *
8
+ * An Arete WalletAdapter backed by @solana/web3.js. Transactions are compiled
9
+ * as v0 messages, signed once, submitted once, and then confirmed or
10
+ * classified without resubmission.
11
+ */
12
+ function connectionAccountLoader(connection) {
13
+ return {
14
+ async getAccount(address) {
15
+ const account = await connection.getAccountInfo(new PublicKey(address), 'confirmed');
16
+ return account ? { data: new Uint8Array(account.data) } : null;
17
+ },
18
+ };
19
+ }
20
+ function toCommitment(level, fallback) {
21
+ return level ?? fallback;
22
+ }
23
+ function signerAddress(signer) {
24
+ return signer.publicKey.toBase58();
25
+ }
26
+ function collectRequiredSignerAddresses(instructions, feePayer) {
27
+ const required = new Set([feePayer.toBase58()]);
28
+ for (const instruction of instructions) {
29
+ for (const key of instruction.keys) {
30
+ if (key.isSigner) {
31
+ required.add(key.pubkey);
32
+ }
33
+ }
34
+ }
35
+ return required;
36
+ }
37
+ function indexLocalSigners(signers) {
38
+ const indexed = new Map();
39
+ for (const signer of signers) {
40
+ indexed.set(signerAddress(signer), signer);
41
+ }
42
+ return indexed;
43
+ }
44
+ function outcomeMessage(outcome) {
45
+ if (outcome.status === 'not-submitted') {
46
+ return `Transaction was not submitted during ${outcome.phase}`;
47
+ }
48
+ if (outcome.status === 'submitted-unknown') {
49
+ return `Transaction ${outcome.signature} was submitted but its status is unknown`;
50
+ }
51
+ return outcome.signature
52
+ ? `Transaction ${outcome.signature} failed on chain`
53
+ : 'Transaction failed on chain';
54
+ }
55
+ function transactionError(outcome, programError) {
56
+ const causeMessage = outcome.cause instanceof Error ? outcome.cause.message : undefined;
57
+ const error = new Error(causeMessage || outcomeMessage(outcome));
58
+ Object.defineProperties(error, {
59
+ name: { value: 'TransactionExecutionError', configurable: true },
60
+ cause: { value: outcome.cause, enumerable: true },
61
+ outcome: { value: outcome, enumerable: true },
62
+ signature: {
63
+ value: 'signature' in outcome ? outcome.signature : undefined,
64
+ enumerable: true,
65
+ },
66
+ slot: {
67
+ value: 'slot' in outcome ? outcome.slot : undefined,
68
+ enumerable: true,
69
+ },
70
+ programError: { value: programError, enumerable: true },
71
+ });
72
+ return error;
73
+ }
74
+ function customErrorCode(value, seen = new Set()) {
75
+ if (typeof value === 'string') {
76
+ const match = /custom program error:\s*0x([\da-f]+)/i.exec(value);
77
+ return match?.[1] ? Number.parseInt(match[1], 16) : undefined;
78
+ }
79
+ if (typeof value !== 'object' || value === null || seen.has(value)) {
80
+ return undefined;
81
+ }
82
+ seen.add(value);
83
+ if (Array.isArray(value)) {
84
+ for (const item of value) {
85
+ const code = customErrorCode(item, seen);
86
+ if (code !== undefined) {
87
+ return code;
88
+ }
89
+ }
90
+ return undefined;
91
+ }
92
+ const candidate = value;
93
+ if (Array.isArray(candidate.InstructionError)) {
94
+ const detail = candidate.InstructionError[1];
95
+ if (typeof detail === 'object' && detail !== null) {
96
+ const code = detail.Custom;
97
+ if (typeof code === 'number') {
98
+ return code;
99
+ }
100
+ }
101
+ }
102
+ if (typeof candidate.code === 'number') {
103
+ return candidate.code;
104
+ }
105
+ for (const key of [
106
+ 'cause',
107
+ 'error',
108
+ 'err',
109
+ 'value',
110
+ 'data',
111
+ 'message',
112
+ 'transactionMessage',
113
+ 'transactionLogs',
114
+ 'logs',
115
+ ]) {
116
+ const code = customErrorCode(candidate[key], seen);
117
+ if (code !== undefined) {
118
+ return code;
119
+ }
120
+ }
121
+ return undefined;
122
+ }
123
+ function parseProgramError(error) {
124
+ const code = customErrorCode(error);
125
+ return code === undefined
126
+ ? undefined
127
+ : {
128
+ code,
129
+ name: `CustomError${code}`,
130
+ message: `Unknown error with code ${code}`,
131
+ };
132
+ }
133
+ function signatureFromTransaction(transaction) {
134
+ const signature = transaction.signatures[0];
135
+ if (!signature || signature.every((byte) => byte === 0)) {
136
+ return undefined;
137
+ }
138
+ return bs58.encode(signature);
139
+ }
140
+ function hasAllRequiredSignatures(transaction) {
141
+ const required = transaction.message.header.numRequiredSignatures;
142
+ return transaction.signatures
143
+ .slice(0, required)
144
+ .every((signature) => signature.some((byte) => byte !== 0));
145
+ }
146
+ function commitmentRank(commitment) {
147
+ if (commitment === 'finalized' || commitment === 'max' || commitment === 'root') {
148
+ return 2;
149
+ }
150
+ if (commitment === 'confirmed'
151
+ || commitment === 'single'
152
+ || commitment === 'singleGossip') {
153
+ return 1;
154
+ }
155
+ return 0;
156
+ }
157
+ function statusRank(status) {
158
+ if (status.confirmationStatus === 'finalized' || status.confirmations === null) {
159
+ return 2;
160
+ }
161
+ if (status.confirmationStatus === 'confirmed' || (status.confirmations ?? 0) > 0) {
162
+ return 1;
163
+ }
164
+ return 0;
165
+ }
166
+ function encodeBase64(bytes) {
167
+ const bufferCtor = globalThis.Buffer;
168
+ if (bufferCtor)
169
+ return bufferCtor.from(bytes).toString('base64');
170
+ let binary = '';
171
+ for (const byte of bytes)
172
+ binary += String.fromCharCode(byte);
173
+ return btoa(binary);
174
+ }
175
+ function resolveTransport(selection, connection, context) {
176
+ if (typeof selection === 'object')
177
+ return { kind: 'arete', transport: selection };
178
+ if (selection === 'direct') {
179
+ if (!connection)
180
+ throw new Error('Web3.js direct transaction transport requires a Connection');
181
+ return { kind: 'direct', connection };
182
+ }
183
+ if (context?.transactionTransport)
184
+ return { kind: 'arete', transport: context.transactionTransport };
185
+ if (connection)
186
+ return { kind: 'direct', connection };
187
+ throw new Error('No transaction transport is available; connect through Arete or configure direct RPC');
188
+ }
189
+ async function pollAreteStatus(transport, signature, commitment, lastValidBlockHeight, options) {
190
+ const timeoutMs = options?.confirmationTimeoutMs ?? 60000;
191
+ const intervalMs = options?.statusPollIntervalMs ?? 500;
192
+ const deadline = Date.now() + timeoutMs;
193
+ let emptyStatusPolls = 0;
194
+ while (Date.now() <= deadline) {
195
+ const status = await transport.getSignatureStatus(signature, {
196
+ commitment: commitment,
197
+ searchTransactionHistory: true,
198
+ });
199
+ if (status?.err) {
200
+ throw transactionError({
201
+ status: 'chain-failed', phase: 'chain', signature,
202
+ slot: status.slot === null ? undefined : Number(status.slot),
203
+ programError: parseProgramError(status.err), cause: status.err,
204
+ });
205
+ }
206
+ if (status && commitmentRank(status.confirmationStatus) >= commitmentRank(commitment)) {
207
+ return { signature, slot: status.slot === null ? undefined : Number(status.slot) };
208
+ }
209
+ if (await transport.getBlockHeight({ commitment: commitment }) > lastValidBlockHeight) {
210
+ throw transactionError({
211
+ status: 'submitted-unknown', phase: 'confirmation', signature,
212
+ slot: status?.slot === null ? undefined : Number(status?.slot),
213
+ cause: new Error('Transaction blockhash expired before confirmation'),
214
+ });
215
+ }
216
+ emptyStatusPolls = status ? 0 : emptyStatusPolls + 1;
217
+ const delayMs = Math.min(intervalMs * (2 ** Math.min(emptyStatusPolls, 3)), 4000);
218
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
219
+ }
220
+ throw transactionError({
221
+ status: 'submitted-unknown', phase: 'confirmation', signature,
222
+ cause: new Error('Transaction confirmation timed out'),
223
+ });
224
+ }
225
+ async function resolveUncertainSubmission(connection, signature, commitment, phase, cause) {
226
+ let status = null;
227
+ try {
228
+ const response = await connection.getSignatureStatuses([signature], { searchTransactionHistory: true });
229
+ status = response.value[0] ?? null;
230
+ }
231
+ catch {
232
+ // The original submission/confirmation error remains the useful cause.
233
+ }
234
+ if (status?.err) {
235
+ throw transactionError({
236
+ status: 'chain-failed',
237
+ phase: 'chain',
238
+ signature,
239
+ slot: status.slot,
240
+ programError: parseProgramError(status.err),
241
+ cause,
242
+ });
243
+ }
244
+ if (status && statusRank(status) >= commitmentRank(commitment)) {
245
+ return { signature, slot: status.slot };
246
+ }
247
+ throw transactionError({
248
+ status: 'submitted-unknown',
249
+ phase,
250
+ signature,
251
+ slot: status?.slot,
252
+ cause,
253
+ });
254
+ }
255
+ /** Convert an Arete BuiltInstruction to a web3.js TransactionInstruction. */
256
+ function toTransactionInstruction(ix) {
257
+ return new TransactionInstruction({
258
+ programId: new PublicKey(ix.programId),
259
+ keys: ix.keys.map((key) => ({
260
+ pubkey: new PublicKey(key.pubkey),
261
+ isSigner: key.isSigner,
262
+ isWritable: key.isWritable,
263
+ })),
264
+ // web3.js types this field as Buffer, but its transaction compiler consumes
265
+ // Uint8Array. Avoid importing the Node `buffer` builtin into browser apps.
266
+ data: Uint8Array.from(ix.data),
267
+ });
268
+ }
269
+ /** Convert a web3.js TransactionInstruction to an Arete BuiltInstruction. */
270
+ function fromTransactionInstruction(ix) {
271
+ return {
272
+ programId: ix.programId.toBase58(),
273
+ keys: ix.keys.map((key) => ({
274
+ pubkey: key.pubkey.toBase58(),
275
+ isSigner: key.isSigner,
276
+ isWritable: key.isWritable,
277
+ })),
278
+ data: new Uint8Array(ix.data),
279
+ };
280
+ }
281
+ /** Create a WalletAdapter from a connection and a v0-capable signer. */
282
+ function createWalletAdapter(config) {
283
+ const { signer } = config;
284
+ const configuredLocalSigners = config.additionalSigners ?? [];
285
+ const fallbackCommitment = config.defaultCommitment ?? 'confirmed';
286
+ const signerAddresses = [
287
+ signer.publicKey.toBase58(),
288
+ ...configuredLocalSigners.map(signerAddress),
289
+ ];
290
+ return {
291
+ publicKey: signer.publicKey.toBase58(),
292
+ signerAddresses: [...new Set(signerAddresses)],
293
+ async inspectTransaction(instructions, options, context) {
294
+ if (instructions.length === 0) {
295
+ throw new Error('inspectTransaction requires at least one instruction');
296
+ }
297
+ const commitment = options?.commitment ?? fallbackCommitment;
298
+ const feePayer = options?.feePayer ?? signer.publicKey;
299
+ const resolved = resolveTransport(config.transport, config.connection, context);
300
+ if (resolved.kind === 'arete') {
301
+ const latest = await resolved.transport.getLatestBlockhash({
302
+ commitment: commitment,
303
+ minContextSlot: options?.minContextSlot === undefined ? undefined : BigInt(options.minContextSlot),
304
+ });
305
+ const message = new TransactionMessage({
306
+ payerKey: feePayer,
307
+ recentBlockhash: latest.blockhash,
308
+ instructions: instructions.map(toTransactionInstruction),
309
+ }).compileToV0Message();
310
+ const transaction = new VersionedTransaction(message);
311
+ const [fee, simulation] = await Promise.all([
312
+ resolved.transport.getFeeForMessage(encodeBase64(message.serialize()), {
313
+ commitment: commitment,
314
+ minContextSlot: options?.minContextSlot === undefined ? undefined : BigInt(options.minContextSlot),
315
+ }),
316
+ resolved.transport.simulateTransaction(encodeBase64(transaction.serialize()), {
317
+ commitment: commitment,
318
+ minContextSlot: options?.minContextSlot === undefined ? undefined : BigInt(options.minContextSlot),
319
+ accounts: options?.accounts,
320
+ innerInstructions: options?.innerInstructions,
321
+ }),
322
+ ]);
323
+ return {
324
+ feeLamports: fee.feeLamports === null ? undefined : Number(fee.feeLamports),
325
+ feeContextSlot: Number(fee.contextSlot), logs: simulation.logs ?? undefined,
326
+ computeUnitsConsumed: simulation.unitsConsumed === undefined ? undefined : Number(simulation.unitsConsumed),
327
+ contextSlot: Number(simulation.contextSlot), error: simulation.err ?? undefined,
328
+ programError: parseProgramError(simulation.err),
329
+ };
330
+ }
331
+ const connection = resolved.connection;
332
+ const { blockhash } = await connection.getLatestBlockhash(commitment);
333
+ const message = new TransactionMessage({
334
+ payerKey: feePayer,
335
+ recentBlockhash: blockhash,
336
+ instructions: instructions.map(toTransactionInstruction),
337
+ }).compileToV0Message();
338
+ const transaction = new VersionedTransaction(message);
339
+ const [fee, simulation] = await Promise.all([
340
+ connection.getFeeForMessage(message, commitment),
341
+ connection.simulateTransaction(transaction, {
342
+ commitment,
343
+ sigVerify: false,
344
+ replaceRecentBlockhash: false,
345
+ minContextSlot: options?.minContextSlot,
346
+ innerInstructions: options?.innerInstructions,
347
+ accounts: options?.accounts
348
+ ? { encoding: 'base64', addresses: [...options.accounts] }
349
+ : undefined,
350
+ }),
351
+ ]);
352
+ return {
353
+ feeLamports: fee.value ?? undefined,
354
+ feeContextSlot: fee.context.slot,
355
+ logs: simulation.value.logs ?? undefined,
356
+ computeUnitsConsumed: simulation.value.unitsConsumed,
357
+ contextSlot: simulation.context.slot,
358
+ error: simulation.value.err ?? undefined,
359
+ programError: parseProgramError(simulation.value.err),
360
+ };
361
+ },
362
+ async signAndSend(instructions, options, context) {
363
+ const sendOptions = options;
364
+ let transaction;
365
+ let blockhash;
366
+ let lastValidBlockHeight;
367
+ let requiredSignerAddresses;
368
+ let localSigners;
369
+ const commitment = toCommitment(options?.confirmationLevel, fallbackCommitment);
370
+ let resolved;
371
+ try {
372
+ resolved = resolveTransport(config.transport, config.connection, context);
373
+ }
374
+ catch (cause) {
375
+ throw transactionError({ status: 'not-submitted', phase: 'build', cause });
376
+ }
377
+ const feePayer = sendOptions?.feePayer ?? signer;
378
+ const primarySignerAddress = signerAddress(signer);
379
+ try {
380
+ if (instructions.length === 0) {
381
+ throw new Error('signAndSend requires at least one instruction');
382
+ }
383
+ requiredSignerAddresses = collectRequiredSignerAddresses(instructions, feePayer.publicKey);
384
+ const localSignerMap = indexLocalSigners([
385
+ ...configuredLocalSigners,
386
+ ...(sendOptions?.signers ?? []),
387
+ ...(sendOptions?.additionalSigners ?? []),
388
+ ...(sendOptions?.feePayer ? [sendOptions.feePayer] : []),
389
+ ]);
390
+ const missingSignerAddresses = [...requiredSignerAddresses].filter((address) => address !== primarySignerAddress && !localSignerMap.has(address));
391
+ if (missingSignerAddresses.length > 0) {
392
+ throw new Error(`Missing signer(s) for transaction: ${missingSignerAddresses.join(', ')}`);
393
+ }
394
+ localSigners = [...requiredSignerAddresses]
395
+ .filter((address) => address !== primarySignerAddress)
396
+ .map((address) => localSignerMap.get(address))
397
+ .filter((candidate, index, all) => all.indexOf(candidate) === index);
398
+ const latestBlockhash = resolved.kind === 'arete'
399
+ ? await resolved.transport.getLatestBlockhash({ commitment: commitment })
400
+ : await resolved.connection.getLatestBlockhash(commitment);
401
+ blockhash = latestBlockhash.blockhash;
402
+ lastValidBlockHeight = Number(latestBlockhash.lastValidBlockHeight);
403
+ const message = new TransactionMessage({
404
+ payerKey: feePayer.publicKey,
405
+ recentBlockhash: blockhash,
406
+ instructions: instructions.map(toTransactionInstruction),
407
+ }).compileToV0Message();
408
+ transaction = new VersionedTransaction(message);
409
+ }
410
+ catch (cause) {
411
+ throw transactionError({ status: 'not-submitted', phase: 'build', cause });
412
+ }
413
+ try {
414
+ if (localSigners.length > 0) {
415
+ transaction.sign(localSigners);
416
+ }
417
+ if (requiredSignerAddresses.has(primarySignerAddress)) {
418
+ const supportedVersions = signer.supportedTransactionVersions;
419
+ if (supportedVersions === null || (supportedVersions && !supportedVersions.has(0))) {
420
+ throw new Error('The configured wallet does not support v0 VersionedTransaction signing');
421
+ }
422
+ const signed = await signer.signTransaction(transaction);
423
+ if (!signed || typeof signed.serialize !== 'function') {
424
+ throw new Error('The configured wallet did not return a signed v0 VersionedTransaction');
425
+ }
426
+ // Wallet adapters can use a different web3.js module instance, making
427
+ // instanceof checks reject otherwise valid signed transactions.
428
+ transaction = VersionedTransaction.deserialize(signed.serialize());
429
+ }
430
+ if (!hasAllRequiredSignatures(transaction)) {
431
+ throw new Error('The configured signers did not provide every required signature');
432
+ }
433
+ }
434
+ catch (cause) {
435
+ throw transactionError({ status: 'not-submitted', phase: 'wallet', cause });
436
+ }
437
+ const localSignature = signatureFromTransaction(transaction);
438
+ if (resolved.kind === 'arete') {
439
+ let signature;
440
+ try {
441
+ const sent = await resolved.transport.sendTransaction(encodeBase64(transaction.serialize()), {
442
+ skipPreflight: options?.skipPreflight ?? false,
443
+ preflightCommitment: commitment,
444
+ });
445
+ signature = sent.signature;
446
+ }
447
+ catch (cause) {
448
+ if (cause instanceof TransactionTransportError && cause.submissionState === 'not_submitted') {
449
+ throw transactionError({ status: 'not-submitted', phase: 'send', cause });
450
+ }
451
+ throw transactionError({
452
+ status: 'submitted-unknown', phase: 'send',
453
+ signature: cause instanceof TransactionTransportError && cause.signature
454
+ ? cause.signature : localSignature,
455
+ cause,
456
+ });
457
+ }
458
+ try {
459
+ return await pollAreteStatus(resolved.transport, signature, commitment, BigInt(lastValidBlockHeight), options);
460
+ }
461
+ catch (cause) {
462
+ if (typeof cause === 'object' && cause !== null && 'outcome' in cause)
463
+ throw cause;
464
+ throw transactionError({
465
+ status: 'submitted-unknown', phase: 'confirmation', signature, cause,
466
+ });
467
+ }
468
+ }
469
+ const connection = resolved.connection;
470
+ let signature;
471
+ try {
472
+ signature = await connection.sendRawTransaction(transaction.serialize(), {
473
+ skipPreflight: options?.skipPreflight ?? false,
474
+ preflightCommitment: commitment,
475
+ });
476
+ }
477
+ catch (cause) {
478
+ if (cause instanceof SendTransactionError) {
479
+ throw transactionError({ status: 'not-submitted', phase: 'send', cause }, parseProgramError(cause));
480
+ }
481
+ return resolveUncertainSubmission(connection, localSignature, commitment, 'send', cause);
482
+ }
483
+ try {
484
+ const confirmation = await connection.confirmTransaction({ signature, blockhash, lastValidBlockHeight }, commitment);
485
+ if (confirmation.value.err) {
486
+ throw transactionError({
487
+ status: 'chain-failed',
488
+ phase: 'chain',
489
+ signature,
490
+ slot: confirmation.context.slot,
491
+ programError: parseProgramError(confirmation.value.err),
492
+ cause: confirmation.value.err,
493
+ });
494
+ }
495
+ return { signature, slot: confirmation.context.slot };
496
+ }
497
+ catch (cause) {
498
+ if (typeof cause === 'object'
499
+ && cause !== null
500
+ && 'outcome' in cause
501
+ && cause.outcome?.status === 'chain-failed') {
502
+ throw cause;
503
+ }
504
+ return resolveUncertainSubmission(connection, signature, commitment, 'confirmation', cause);
505
+ }
506
+ },
507
+ };
508
+ }
509
+ /** Create a WalletAdapter backed by a local Keypair. */
510
+ function createKeypairWalletAdapter(config) {
511
+ const { connection, transport, keypair, additionalSigners, defaultCommitment } = config;
512
+ return createWalletAdapter({
513
+ connection,
514
+ transport,
515
+ additionalSigners,
516
+ defaultCommitment,
517
+ signer: {
518
+ publicKey: keypair.publicKey,
519
+ supportedTransactionVersions: new Set([0]),
520
+ async signTransaction(tx) {
521
+ tx.sign([keypair]);
522
+ return tx;
523
+ },
524
+ },
525
+ });
526
+ }
527
+
528
+ export { connectionAccountLoader, createKeypairWalletAdapter, createWalletAdapter, fromTransactionInstruction, toTransactionInstruction };
529
+ //# sourceMappingURL=index.js.map