@solana/transactions 2.0.0-experimental.ee9f3d8 → 2.0.0-experimental.ef09aec

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 (41) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +272 -5
  3. package/dist/index.browser.cjs +1019 -39
  4. package/dist/index.browser.cjs.map +1 -1
  5. package/dist/index.browser.js +1003 -38
  6. package/dist/index.browser.js.map +1 -1
  7. package/dist/index.development.js +1734 -37
  8. package/dist/index.development.js.map +1 -1
  9. package/dist/index.native.js +1003 -38
  10. package/dist/index.native.js.map +1 -1
  11. package/dist/index.node.cjs +1019 -37
  12. package/dist/index.node.cjs.map +1 -1
  13. package/dist/index.node.js +1005 -38
  14. package/dist/index.node.js.map +1 -1
  15. package/dist/index.production.min.js +22 -5
  16. package/dist/types/accounts.d.ts +28 -0
  17. package/dist/types/blockhash.d.ts +9 -1
  18. package/dist/types/compilable-transaction.d.ts +7 -0
  19. package/dist/types/compile-address-table-lookups.d.ts +10 -0
  20. package/dist/types/compile-header.d.ts +9 -0
  21. package/dist/types/compile-instructions.d.ts +10 -0
  22. package/dist/types/compile-lifetime-token.d.ts +3 -0
  23. package/dist/types/compile-static-accounts.d.ts +4 -0
  24. package/dist/types/compile-transaction.d.ts +10 -0
  25. package/dist/types/decompile-transaction.d.ts +5 -0
  26. package/dist/types/durable-nonce.d.ts +23 -10
  27. package/dist/types/fee-payer.d.ts +4 -3
  28. package/dist/types/index.d.ts +4 -0
  29. package/dist/types/message.d.ts +26 -0
  30. package/dist/types/serializers/address-table-lookup.d.ts +8 -0
  31. package/dist/types/serializers/header.d.ts +8 -0
  32. package/dist/types/serializers/index.d.ts +3 -0
  33. package/dist/types/serializers/instruction.d.ts +8 -0
  34. package/dist/types/serializers/message.d.ts +6 -0
  35. package/dist/types/serializers/transaction-version.d.ts +6 -0
  36. package/dist/types/serializers/transaction.d.ts +7 -0
  37. package/dist/types/signatures.d.ts +10 -7
  38. package/dist/types/types.d.ts +13 -13
  39. package/dist/types/unsigned-transaction.d.ts +4 -0
  40. package/dist/types/wire-transaction.d.ts +6 -0
  41. package/package.json +22 -20
@@ -1,3 +1,64 @@
1
+ import { getBase58Encoder, getBase58Decoder, getBase64Decoder, getStringEncoder, getStringDecoder } from '@solana/codecs-strings';
2
+ import { getAddressFromPublicKey, getAddressComparator, getAddressEncoder, getAddressDecoder, assertIsAddress } from '@solana/addresses';
3
+ import { mapDecoder, combineCodec, mapEncoder } from '@solana/codecs-core';
4
+ import { getStructDecoder, getStructEncoder, getArrayEncoder, getArrayDecoder, getBytesEncoder, getBytesDecoder } from '@solana/codecs-data-structures';
5
+ import { getShortU16Encoder, getShortU16Decoder, getU8Encoder, getU8Decoder } from '@solana/codecs-numbers';
6
+ import { pipe } from '@solana/functional';
7
+ import { signBytes } from '@solana/keys';
8
+
9
+ // ../build-scripts/env-shim.ts
10
+ var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
11
+
12
+ // src/unsigned-transaction.ts
13
+ function getUnsignedTransaction(transaction) {
14
+ if ("signatures" in transaction) {
15
+ const {
16
+ signatures: _,
17
+ // eslint-disable-line @typescript-eslint/no-unused-vars
18
+ ...unsignedTransaction
19
+ } = transaction;
20
+ return unsignedTransaction;
21
+ } else {
22
+ return transaction;
23
+ }
24
+ }
25
+
26
+ // src/blockhash.ts
27
+ var base58Encoder;
28
+ function assertIsBlockhash(putativeBlockhash) {
29
+ if (!base58Encoder)
30
+ base58Encoder = getBase58Encoder();
31
+ try {
32
+ if (
33
+ // Lowest value (32 bytes of zeroes)
34
+ putativeBlockhash.length < 32 || // Highest value (32 bytes of 255)
35
+ putativeBlockhash.length > 44
36
+ ) {
37
+ throw new Error("Expected input string to decode to a byte array of length 32.");
38
+ }
39
+ const bytes = base58Encoder.encode(putativeBlockhash);
40
+ const numBytes = bytes.byteLength;
41
+ if (numBytes !== 32) {
42
+ throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
43
+ }
44
+ } catch (e) {
45
+ throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
46
+ cause: e
47
+ });
48
+ }
49
+ }
50
+ function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
51
+ if ("lifetimeConstraint" in transaction && transaction.lifetimeConstraint.blockhash === blockhashLifetimeConstraint.blockhash && transaction.lifetimeConstraint.lastValidBlockHeight === blockhashLifetimeConstraint.lastValidBlockHeight) {
52
+ return transaction;
53
+ }
54
+ const out = {
55
+ ...getUnsignedTransaction(transaction),
56
+ lifetimeConstraint: blockhashLifetimeConstraint
57
+ };
58
+ Object.freeze(out);
59
+ return out;
60
+ }
61
+
1
62
  // src/create-transaction.ts
2
63
  function createTransaction({
3
64
  version
@@ -10,66 +71,970 @@ function createTransaction({
10
71
  return out;
11
72
  }
12
73
 
74
+ // ../instructions/dist/index.browser.js
75
+ var AccountRole = /* @__PURE__ */ ((AccountRole2) => {
76
+ AccountRole2[AccountRole2["WRITABLE_SIGNER"] = /* 3 */
77
+ 3] = "WRITABLE_SIGNER";
78
+ AccountRole2[AccountRole2["READONLY_SIGNER"] = /* 2 */
79
+ 2] = "READONLY_SIGNER";
80
+ AccountRole2[AccountRole2["WRITABLE"] = /* 1 */
81
+ 1] = "WRITABLE";
82
+ AccountRole2[AccountRole2["READONLY"] = /* 0 */
83
+ 0] = "READONLY";
84
+ return AccountRole2;
85
+ })(AccountRole || {});
86
+ var IS_WRITABLE_BITMASK = 1;
87
+ function isSignerRole(role) {
88
+ return role >= 2;
89
+ }
90
+ function isWritableRole(role) {
91
+ return (role & IS_WRITABLE_BITMASK) !== 0;
92
+ }
93
+ function mergeRoles(roleA, roleB) {
94
+ return roleA | roleB;
95
+ }
96
+
97
+ // src/durable-nonce.ts
98
+ var RECENT_BLOCKHASHES_SYSVAR_ADDRESS = "SysvarRecentB1ockHashes11111111111111111111";
99
+ var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
100
+ function assertIsDurableNonceTransaction(transaction) {
101
+ if (!isDurableNonceTransaction(transaction)) {
102
+ throw new Error("Transaction is not a durable nonce transaction");
103
+ }
104
+ }
105
+ function createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress) {
106
+ return {
107
+ accounts: [
108
+ { address: nonceAccountAddress, role: AccountRole.WRITABLE },
109
+ {
110
+ address: RECENT_BLOCKHASHES_SYSVAR_ADDRESS,
111
+ role: AccountRole.READONLY
112
+ },
113
+ { address: nonceAuthorityAddress, role: AccountRole.READONLY_SIGNER }
114
+ ],
115
+ data: new Uint8Array([4, 0, 0, 0]),
116
+ programAddress: SYSTEM_PROGRAM_ADDRESS
117
+ };
118
+ }
119
+ function isAdvanceNonceAccountInstruction(instruction) {
120
+ return instruction.programAddress === SYSTEM_PROGRAM_ADDRESS && // Test for `AdvanceNonceAccount` instruction data
121
+ instruction.data != null && isAdvanceNonceAccountInstructionData(instruction.data) && // Test for exactly 3 accounts
122
+ instruction.accounts?.length === 3 && // First account is nonce account address
123
+ instruction.accounts[0].address != null && instruction.accounts[0].role === AccountRole.WRITABLE && // Second account is recent blockhashes sysvar
124
+ instruction.accounts[1].address === RECENT_BLOCKHASHES_SYSVAR_ADDRESS && instruction.accounts[1].role === AccountRole.READONLY && // Third account is nonce authority account
125
+ instruction.accounts[2].address != null && isSignerRole(instruction.accounts[2].role);
126
+ }
127
+ function isAdvanceNonceAccountInstructionData(data) {
128
+ return data.byteLength === 4 && data[0] === 4 && data[1] === 0 && data[2] === 0 && data[3] === 0;
129
+ }
130
+ function isDurableNonceTransaction(transaction) {
131
+ return "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.nonce === "string" && transaction.instructions[0] != null && isAdvanceNonceAccountInstruction(transaction.instructions[0]);
132
+ }
133
+ function isAdvanceNonceAccountInstructionForNonce(instruction, nonceAccountAddress, nonceAuthorityAddress) {
134
+ return instruction.accounts[0].address === nonceAccountAddress && instruction.accounts[2].address === nonceAuthorityAddress;
135
+ }
136
+ function setTransactionLifetimeUsingDurableNonce({
137
+ nonce,
138
+ nonceAccountAddress,
139
+ nonceAuthorityAddress
140
+ }, transaction) {
141
+ let newInstructions;
142
+ const firstInstruction = transaction.instructions[0];
143
+ if (firstInstruction && isAdvanceNonceAccountInstruction(firstInstruction)) {
144
+ if (isAdvanceNonceAccountInstructionForNonce(firstInstruction, nonceAccountAddress, nonceAuthorityAddress)) {
145
+ if (isDurableNonceTransaction(transaction) && transaction.lifetimeConstraint.nonce === nonce) {
146
+ return transaction;
147
+ } else {
148
+ newInstructions = [firstInstruction, ...transaction.instructions.slice(1)];
149
+ }
150
+ } else {
151
+ newInstructions = [
152
+ createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
153
+ ...transaction.instructions.slice(1)
154
+ ];
155
+ }
156
+ } else {
157
+ newInstructions = [
158
+ createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
159
+ ...transaction.instructions
160
+ ];
161
+ }
162
+ const out = {
163
+ ...getUnsignedTransaction(transaction),
164
+ instructions: newInstructions,
165
+ lifetimeConstraint: {
166
+ nonce
167
+ }
168
+ };
169
+ Object.freeze(out);
170
+ return out;
171
+ }
172
+
13
173
  // src/fee-payer.ts
14
174
  function setTransactionFeePayer(feePayer, transaction) {
15
175
  if ("feePayer" in transaction && feePayer === transaction.feePayer) {
16
176
  return transaction;
17
177
  }
18
- let out;
19
- if ("signatures" in transaction) {
20
- const {
21
- signatures: _,
22
- // eslint-disable-line @typescript-eslint/no-unused-vars
23
- ...unsignedTransaction
24
- } = transaction;
25
- out = {
26
- ...unsignedTransaction,
27
- feePayer
28
- };
29
- } else {
30
- out = {
31
- ...transaction,
32
- feePayer
33
- };
34
- }
178
+ const out = {
179
+ ...getUnsignedTransaction(transaction),
180
+ feePayer
181
+ };
35
182
  Object.freeze(out);
36
183
  return out;
37
184
  }
38
185
 
39
186
  // src/instructions.ts
40
- function replaceInstructions(transaction, nextInstructions) {
41
- let out;
187
+ function appendTransactionInstruction(instruction, transaction) {
188
+ const out = {
189
+ ...getUnsignedTransaction(transaction),
190
+ instructions: [...transaction.instructions, instruction]
191
+ };
192
+ Object.freeze(out);
193
+ return out;
194
+ }
195
+ function prependTransactionInstruction(instruction, transaction) {
196
+ const out = {
197
+ ...getUnsignedTransaction(transaction),
198
+ instructions: [instruction, ...transaction.instructions]
199
+ };
200
+ Object.freeze(out);
201
+ return out;
202
+ }
203
+ function upsert(addressMap, address, update) {
204
+ addressMap[address] = update(addressMap[address] ?? { role: AccountRole.READONLY });
205
+ }
206
+ var TYPE = Symbol("AddressMapTypeProperty");
207
+ function getAddressMapFromInstructions(feePayer, instructions) {
208
+ const addressMap = {
209
+ [feePayer]: { [TYPE]: 0 /* FEE_PAYER */, role: AccountRole.WRITABLE_SIGNER }
210
+ };
211
+ const addressesOfInvokedPrograms = /* @__PURE__ */ new Set();
212
+ for (const instruction of instructions) {
213
+ upsert(addressMap, instruction.programAddress, (entry) => {
214
+ addressesOfInvokedPrograms.add(instruction.programAddress);
215
+ if (TYPE in entry) {
216
+ if (isWritableRole(entry.role)) {
217
+ switch (entry[TYPE]) {
218
+ case 0 /* FEE_PAYER */:
219
+ throw new Error(
220
+ `This transaction includes an address (\`${instruction.programAddress}\`) which is both invoked and set as the fee payer. Program addresses may not pay fees.`
221
+ );
222
+ default:
223
+ throw new Error(
224
+ `This transaction includes an address (\`${instruction.programAddress}\`) which is both invoked and marked writable. Program addresses may not be writable.`
225
+ );
226
+ }
227
+ }
228
+ if (entry[TYPE] === 2 /* STATIC */) {
229
+ return entry;
230
+ }
231
+ }
232
+ return { [TYPE]: 2 /* STATIC */, role: AccountRole.READONLY };
233
+ });
234
+ let addressComparator;
235
+ if (!instruction.accounts) {
236
+ continue;
237
+ }
238
+ for (const account of instruction.accounts) {
239
+ upsert(addressMap, account.address, (entry) => {
240
+ const {
241
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
242
+ address: _,
243
+ ...accountMeta
244
+ } = account;
245
+ if (TYPE in entry) {
246
+ switch (entry[TYPE]) {
247
+ case 0 /* FEE_PAYER */:
248
+ return entry;
249
+ case 1 /* LOOKUP_TABLE */: {
250
+ const nextRole = mergeRoles(entry.role, accountMeta.role);
251
+ if ("lookupTableAddress" in accountMeta) {
252
+ const shouldReplaceEntry = (
253
+ // Consider using the new LOOKUP_TABLE if its address is different...
254
+ entry.lookupTableAddress !== accountMeta.lookupTableAddress && // ...and sorts before the existing one.
255
+ (addressComparator ||= getAddressComparator())(
256
+ accountMeta.lookupTableAddress,
257
+ entry.lookupTableAddress
258
+ ) < 0
259
+ );
260
+ if (shouldReplaceEntry) {
261
+ return {
262
+ [TYPE]: 1 /* LOOKUP_TABLE */,
263
+ ...accountMeta,
264
+ role: nextRole
265
+ };
266
+ }
267
+ } else if (isSignerRole(accountMeta.role)) {
268
+ return {
269
+ [TYPE]: 2 /* STATIC */,
270
+ role: nextRole
271
+ };
272
+ }
273
+ if (entry.role !== nextRole) {
274
+ return {
275
+ ...entry,
276
+ role: nextRole
277
+ };
278
+ } else {
279
+ return entry;
280
+ }
281
+ }
282
+ case 2 /* STATIC */: {
283
+ const nextRole = mergeRoles(entry.role, accountMeta.role);
284
+ if (
285
+ // Check to see if this address represents a program that is invoked
286
+ // in this transaction.
287
+ addressesOfInvokedPrograms.has(account.address)
288
+ ) {
289
+ if (isWritableRole(accountMeta.role)) {
290
+ throw new Error(
291
+ `This transaction includes an address (\`${account.address}\`) which is both invoked and marked writable. Program addresses may not be writable.`
292
+ );
293
+ }
294
+ if (entry.role !== nextRole) {
295
+ return {
296
+ ...entry,
297
+ role: nextRole
298
+ };
299
+ } else {
300
+ return entry;
301
+ }
302
+ } else if ("lookupTableAddress" in accountMeta && // Static accounts can be 'upgraded' to lookup table accounts as
303
+ // long as they are not require to sign the transaction.
304
+ !isSignerRole(entry.role)) {
305
+ return {
306
+ ...accountMeta,
307
+ [TYPE]: 1 /* LOOKUP_TABLE */,
308
+ role: nextRole
309
+ };
310
+ } else {
311
+ if (entry.role !== nextRole) {
312
+ return {
313
+ ...entry,
314
+ role: nextRole
315
+ };
316
+ } else {
317
+ return entry;
318
+ }
319
+ }
320
+ }
321
+ }
322
+ }
323
+ if ("lookupTableAddress" in accountMeta) {
324
+ return {
325
+ ...accountMeta,
326
+ [TYPE]: 1 /* LOOKUP_TABLE */
327
+ };
328
+ } else {
329
+ return {
330
+ ...accountMeta,
331
+ [TYPE]: 2 /* STATIC */
332
+ };
333
+ }
334
+ });
335
+ }
336
+ }
337
+ return addressMap;
338
+ }
339
+ function getOrderedAccountsFromAddressMap(addressMap) {
340
+ let addressComparator;
341
+ const orderedAccounts = Object.entries(addressMap).sort(([leftAddress, leftEntry], [rightAddress, rightEntry]) => {
342
+ if (leftEntry[TYPE] !== rightEntry[TYPE]) {
343
+ if (leftEntry[TYPE] === 0 /* FEE_PAYER */) {
344
+ return -1;
345
+ } else if (rightEntry[TYPE] === 0 /* FEE_PAYER */) {
346
+ return 1;
347
+ } else if (leftEntry[TYPE] === 2 /* STATIC */) {
348
+ return -1;
349
+ } else if (rightEntry[TYPE] === 2 /* STATIC */) {
350
+ return 1;
351
+ }
352
+ }
353
+ const leftIsSigner = isSignerRole(leftEntry.role);
354
+ if (leftIsSigner !== isSignerRole(rightEntry.role)) {
355
+ return leftIsSigner ? -1 : 1;
356
+ }
357
+ const leftIsWritable = isWritableRole(leftEntry.role);
358
+ if (leftIsWritable !== isWritableRole(rightEntry.role)) {
359
+ return leftIsWritable ? -1 : 1;
360
+ }
361
+ addressComparator ||= getAddressComparator();
362
+ if (leftEntry[TYPE] === 1 /* LOOKUP_TABLE */ && rightEntry[TYPE] === 1 /* LOOKUP_TABLE */ && leftEntry.lookupTableAddress !== rightEntry.lookupTableAddress) {
363
+ return addressComparator(leftEntry.lookupTableAddress, rightEntry.lookupTableAddress);
364
+ } else {
365
+ return addressComparator(leftAddress, rightAddress);
366
+ }
367
+ }).map(([address, addressMeta]) => ({
368
+ address,
369
+ ...addressMeta
370
+ }));
371
+ return orderedAccounts;
372
+ }
373
+ function getCompiledAddressTableLookups(orderedAccounts) {
374
+ const index = {};
375
+ for (const account of orderedAccounts) {
376
+ if (!("lookupTableAddress" in account)) {
377
+ continue;
378
+ }
379
+ const entry = index[account.lookupTableAddress] ||= {
380
+ readableIndices: [],
381
+ writableIndices: []
382
+ };
383
+ if (account.role === AccountRole.WRITABLE) {
384
+ entry.writableIndices.push(account.addressIndex);
385
+ } else {
386
+ entry.readableIndices.push(account.addressIndex);
387
+ }
388
+ }
389
+ return Object.keys(index).sort(getAddressComparator()).map((lookupTableAddress) => ({
390
+ lookupTableAddress,
391
+ ...index[lookupTableAddress]
392
+ }));
393
+ }
394
+
395
+ // src/compile-header.ts
396
+ function getCompiledMessageHeader(orderedAccounts) {
397
+ let numReadonlyNonSignerAccounts = 0;
398
+ let numReadonlySignerAccounts = 0;
399
+ let numSignerAccounts = 0;
400
+ for (const account of orderedAccounts) {
401
+ if ("lookupTableAddress" in account) {
402
+ break;
403
+ }
404
+ const accountIsWritable = isWritableRole(account.role);
405
+ if (isSignerRole(account.role)) {
406
+ numSignerAccounts++;
407
+ if (!accountIsWritable) {
408
+ numReadonlySignerAccounts++;
409
+ }
410
+ } else if (!accountIsWritable) {
411
+ numReadonlyNonSignerAccounts++;
412
+ }
413
+ }
414
+ return {
415
+ numReadonlyNonSignerAccounts,
416
+ numReadonlySignerAccounts,
417
+ numSignerAccounts
418
+ };
419
+ }
420
+
421
+ // src/compile-instructions.ts
422
+ function getAccountIndex(orderedAccounts) {
423
+ const out = {};
424
+ for (const [index, account] of orderedAccounts.entries()) {
425
+ out[account.address] = index;
426
+ }
427
+ return out;
428
+ }
429
+ function getCompiledInstructions(instructions, orderedAccounts) {
430
+ const accountIndex = getAccountIndex(orderedAccounts);
431
+ return instructions.map(({ accounts, data, programAddress }) => {
432
+ return {
433
+ programAddressIndex: accountIndex[programAddress],
434
+ ...accounts ? { accountIndices: accounts.map(({ address }) => accountIndex[address]) } : null,
435
+ ...data ? { data } : null
436
+ };
437
+ });
438
+ }
439
+
440
+ // src/compile-lifetime-token.ts
441
+ function getCompiledLifetimeToken(lifetimeConstraint) {
442
+ if ("nonce" in lifetimeConstraint) {
443
+ return lifetimeConstraint.nonce;
444
+ }
445
+ return lifetimeConstraint.blockhash;
446
+ }
447
+
448
+ // src/compile-static-accounts.ts
449
+ function getCompiledStaticAccounts(orderedAccounts) {
450
+ const firstLookupTableAccountIndex = orderedAccounts.findIndex((account) => "lookupTableAddress" in account);
451
+ const orderedStaticAccounts = firstLookupTableAccountIndex === -1 ? orderedAccounts : orderedAccounts.slice(0, firstLookupTableAccountIndex);
452
+ return orderedStaticAccounts.map(({ address }) => address);
453
+ }
454
+
455
+ // src/message.ts
456
+ function compileMessage(transaction) {
457
+ const addressMap = getAddressMapFromInstructions(transaction.feePayer, transaction.instructions);
458
+ const orderedAccounts = getOrderedAccountsFromAddressMap(addressMap);
459
+ return {
460
+ ...transaction.version !== "legacy" ? { addressTableLookups: getCompiledAddressTableLookups(orderedAccounts) } : null,
461
+ header: getCompiledMessageHeader(orderedAccounts),
462
+ instructions: getCompiledInstructions(transaction.instructions, orderedAccounts),
463
+ lifetimeToken: getCompiledLifetimeToken(transaction.lifetimeConstraint),
464
+ staticAccounts: getCompiledStaticAccounts(orderedAccounts),
465
+ version: transaction.version
466
+ };
467
+ }
468
+ var lookupTableAddressDescription = __DEV__ ? "The address of the address lookup table account from which instruction addresses should be looked up" : "lookupTableAddress";
469
+ var writableIndicesDescription = __DEV__ ? "The indices of the accounts in the lookup table that should be loaded as writeable" : "writableIndices";
470
+ var readableIndicesDescription = __DEV__ ? "The indices of the accounts in the lookup table that should be loaded as read-only" : "readableIndices";
471
+ var addressTableLookupDescription = __DEV__ ? "A pointer to the address of an address lookup table, along with the readonly/writeable indices of the addresses that should be loaded from it" : "addressTableLookup";
472
+ var memoizedAddressTableLookupEncoder;
473
+ function getAddressTableLookupEncoder() {
474
+ if (!memoizedAddressTableLookupEncoder) {
475
+ memoizedAddressTableLookupEncoder = getStructEncoder(
476
+ [
477
+ ["lookupTableAddress", getAddressEncoder({ description: lookupTableAddressDescription })],
478
+ [
479
+ "writableIndices",
480
+ getArrayEncoder(getU8Encoder(), {
481
+ description: writableIndicesDescription,
482
+ size: getShortU16Encoder()
483
+ })
484
+ ],
485
+ [
486
+ "readableIndices",
487
+ getArrayEncoder(getU8Encoder(), {
488
+ description: readableIndicesDescription,
489
+ size: getShortU16Encoder()
490
+ })
491
+ ]
492
+ ],
493
+ { description: addressTableLookupDescription }
494
+ );
495
+ }
496
+ return memoizedAddressTableLookupEncoder;
497
+ }
498
+ var memoizedAddressTableLookupDecoder;
499
+ function getAddressTableLookupDecoder() {
500
+ if (!memoizedAddressTableLookupDecoder) {
501
+ memoizedAddressTableLookupDecoder = getStructDecoder(
502
+ [
503
+ ["lookupTableAddress", getAddressDecoder({ description: lookupTableAddressDescription })],
504
+ [
505
+ "writableIndices",
506
+ getArrayDecoder(getU8Decoder(), {
507
+ description: writableIndicesDescription,
508
+ size: getShortU16Decoder()
509
+ })
510
+ ],
511
+ [
512
+ "readableIndices",
513
+ getArrayDecoder(getU8Decoder(), {
514
+ description: readableIndicesDescription,
515
+ size: getShortU16Decoder()
516
+ })
517
+ ]
518
+ ],
519
+ { description: addressTableLookupDescription }
520
+ );
521
+ }
522
+ return memoizedAddressTableLookupDecoder;
523
+ }
524
+ var memoizedU8Encoder;
525
+ function getMemoizedU8Encoder() {
526
+ if (!memoizedU8Encoder)
527
+ memoizedU8Encoder = getU8Encoder();
528
+ return memoizedU8Encoder;
529
+ }
530
+ function getMemoizedU8EncoderDescription(description) {
531
+ const encoder = getMemoizedU8Encoder();
532
+ return {
533
+ ...encoder,
534
+ description: description ?? encoder.description
535
+ };
536
+ }
537
+ var memoizedU8Decoder;
538
+ function getMemoizedU8Decoder() {
539
+ if (!memoizedU8Decoder)
540
+ memoizedU8Decoder = getU8Decoder();
541
+ return memoizedU8Decoder;
542
+ }
543
+ function getMemoizedU8DecoderDescription(description) {
544
+ const decoder = getMemoizedU8Decoder();
545
+ return {
546
+ ...decoder,
547
+ description: description ?? decoder.description
548
+ };
549
+ }
550
+ var numSignerAccountsDescription = __DEV__ ? "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction" : void 0;
551
+ var numReadonlySignerAccountsDescription = __DEV__ ? "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction, but may not be writable" : void 0;
552
+ var numReadonlyNonSignerAccountsDescription = __DEV__ ? "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable" : void 0;
553
+ var messageHeaderDescription = __DEV__ ? "The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses" : void 0;
554
+ function getMessageHeaderEncoder() {
555
+ return getStructEncoder(
556
+ [
557
+ ["numSignerAccounts", getMemoizedU8EncoderDescription(numSignerAccountsDescription)],
558
+ ["numReadonlySignerAccounts", getMemoizedU8EncoderDescription(numReadonlySignerAccountsDescription)],
559
+ ["numReadonlyNonSignerAccounts", getMemoizedU8EncoderDescription(numReadonlyNonSignerAccountsDescription)]
560
+ ],
561
+ {
562
+ description: messageHeaderDescription
563
+ }
564
+ );
565
+ }
566
+ function getMessageHeaderDecoder() {
567
+ return getStructDecoder(
568
+ [
569
+ ["numSignerAccounts", getMemoizedU8DecoderDescription(numSignerAccountsDescription)],
570
+ ["numReadonlySignerAccounts", getMemoizedU8DecoderDescription(numReadonlySignerAccountsDescription)],
571
+ ["numReadonlyNonSignerAccounts", getMemoizedU8DecoderDescription(numReadonlyNonSignerAccountsDescription)]
572
+ ],
573
+ {
574
+ description: messageHeaderDescription
575
+ }
576
+ );
577
+ }
578
+ var programAddressIndexDescription = __DEV__ ? "The index of the program being called, according to the well-ordered accounts list for this transaction" : "programAddressIndex";
579
+ var accountIndexDescription = __DEV__ ? "The index of an account, according to the well-ordered accounts list for this transaction" : void 0;
580
+ var accountIndicesDescription = __DEV__ ? "An optional list of account indices, according to the well-ordered accounts list for this transaction, in the order in which the program being called expects them" : "accountIndices";
581
+ var dataDescription = __DEV__ ? "An optional buffer of data passed to the instruction" : "data";
582
+ var memoizedGetInstructionEncoder;
583
+ function getInstructionEncoder() {
584
+ if (!memoizedGetInstructionEncoder) {
585
+ memoizedGetInstructionEncoder = mapEncoder(
586
+ getStructEncoder([
587
+ ["programAddressIndex", getU8Encoder({ description: programAddressIndexDescription })],
588
+ [
589
+ "accountIndices",
590
+ getArrayEncoder(getU8Encoder({ description: accountIndexDescription }), {
591
+ description: accountIndicesDescription,
592
+ size: getShortU16Encoder()
593
+ })
594
+ ],
595
+ ["data", getBytesEncoder({ description: dataDescription, size: getShortU16Encoder() })]
596
+ ]),
597
+ // Convert an instruction to have all fields defined
598
+ (instruction) => {
599
+ if (instruction.accountIndices !== void 0 && instruction.data !== void 0) {
600
+ return instruction;
601
+ }
602
+ return {
603
+ ...instruction,
604
+ accountIndices: instruction.accountIndices ?? [],
605
+ data: instruction.data ?? new Uint8Array(0)
606
+ };
607
+ }
608
+ );
609
+ }
610
+ return memoizedGetInstructionEncoder;
611
+ }
612
+ var memoizedGetInstructionDecoder;
613
+ function getInstructionDecoder() {
614
+ if (!memoizedGetInstructionDecoder) {
615
+ memoizedGetInstructionDecoder = mapDecoder(
616
+ getStructDecoder([
617
+ ["programAddressIndex", getU8Decoder({ description: programAddressIndexDescription })],
618
+ [
619
+ "accountIndices",
620
+ getArrayDecoder(getU8Decoder({ description: accountIndexDescription }), {
621
+ description: accountIndicesDescription,
622
+ size: getShortU16Decoder()
623
+ })
624
+ ],
625
+ ["data", getBytesDecoder({ description: dataDescription, size: getShortU16Decoder() })]
626
+ ]),
627
+ // Convert an instruction to exclude optional fields if they are empty
628
+ (instruction) => {
629
+ if (instruction.accountIndices.length && instruction.data.byteLength) {
630
+ return instruction;
631
+ }
632
+ const { accountIndices, data, ...rest } = instruction;
633
+ return {
634
+ ...rest,
635
+ ...accountIndices.length ? { accountIndices } : null,
636
+ ...data.byteLength ? { data } : null
637
+ };
638
+ }
639
+ );
640
+ }
641
+ return memoizedGetInstructionDecoder;
642
+ }
643
+ var VERSION_FLAG_MASK = 128;
644
+ var BASE_CONFIG = {
645
+ description: __DEV__ ? "A single byte that encodes the version of the transaction" : "",
646
+ fixedSize: null,
647
+ maxSize: 1
648
+ };
649
+ function decode(bytes, offset = 0) {
650
+ const firstByte = bytes[offset];
651
+ if ((firstByte & VERSION_FLAG_MASK) === 0) {
652
+ return ["legacy", offset];
653
+ } else {
654
+ const version = firstByte ^ VERSION_FLAG_MASK;
655
+ return [version, offset + 1];
656
+ }
657
+ }
658
+ function encode(value) {
659
+ if (value === "legacy") {
660
+ return new Uint8Array();
661
+ }
662
+ if (value < 0 || value > 127) {
663
+ throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`);
664
+ }
665
+ return new Uint8Array([value | VERSION_FLAG_MASK]);
666
+ }
667
+ function getTransactionVersionDecoder() {
668
+ return {
669
+ ...BASE_CONFIG,
670
+ decode
671
+ };
672
+ }
673
+ function getTransactionVersionEncoder() {
674
+ return {
675
+ ...BASE_CONFIG,
676
+ encode
677
+ };
678
+ }
679
+
680
+ // src/serializers/message.ts
681
+ var staticAccountsDescription = __DEV__ ? "A compact-array of static account addresses belonging to this transaction" : "staticAccounts";
682
+ var lifetimeTokenDescription = __DEV__ ? "A 32-byte token that specifies the lifetime of this transaction (eg. a recent blockhash, or a durable nonce)" : "lifetimeToken";
683
+ var instructionsDescription = __DEV__ ? "A compact-array of instructions belonging to this transaction" : "instructions";
684
+ var addressTableLookupsDescription = __DEV__ ? "A compact array of address table lookups belonging to this transaction" : "addressTableLookups";
685
+ function getCompiledMessageLegacyEncoder() {
686
+ return getStructEncoder(getPreludeStructEncoderTuple());
687
+ }
688
+ function getCompiledMessageVersionedEncoder() {
689
+ return mapEncoder(
690
+ getStructEncoder([
691
+ ...getPreludeStructEncoderTuple(),
692
+ ["addressTableLookups", getAddressTableLookupArrayEncoder()]
693
+ ]),
694
+ (value) => {
695
+ if (value.version === "legacy") {
696
+ return value;
697
+ }
698
+ return {
699
+ ...value,
700
+ addressTableLookups: value.addressTableLookups ?? []
701
+ };
702
+ }
703
+ );
704
+ }
705
+ function getPreludeStructEncoderTuple() {
706
+ return [
707
+ ["version", getTransactionVersionEncoder()],
708
+ ["header", getMessageHeaderEncoder()],
709
+ [
710
+ "staticAccounts",
711
+ getArrayEncoder(getAddressEncoder(), {
712
+ description: staticAccountsDescription,
713
+ size: getShortU16Encoder()
714
+ })
715
+ ],
716
+ [
717
+ "lifetimeToken",
718
+ getStringEncoder({
719
+ description: lifetimeTokenDescription,
720
+ encoding: getBase58Encoder(),
721
+ size: 32
722
+ })
723
+ ],
724
+ [
725
+ "instructions",
726
+ getArrayEncoder(getInstructionEncoder(), {
727
+ description: instructionsDescription,
728
+ size: getShortU16Encoder()
729
+ })
730
+ ]
731
+ ];
732
+ }
733
+ function getPreludeStructDecoderTuple() {
734
+ return [
735
+ ["version", getTransactionVersionDecoder()],
736
+ ["header", getMessageHeaderDecoder()],
737
+ [
738
+ "staticAccounts",
739
+ getArrayDecoder(getAddressDecoder(), {
740
+ description: staticAccountsDescription,
741
+ size: getShortU16Decoder()
742
+ })
743
+ ],
744
+ [
745
+ "lifetimeToken",
746
+ getStringDecoder({
747
+ description: lifetimeTokenDescription,
748
+ encoding: getBase58Decoder(),
749
+ size: 32
750
+ })
751
+ ],
752
+ [
753
+ "instructions",
754
+ getArrayDecoder(getInstructionDecoder(), {
755
+ description: instructionsDescription,
756
+ size: getShortU16Decoder()
757
+ })
758
+ ],
759
+ ["addressTableLookups", getAddressTableLookupArrayDecoder()]
760
+ ];
761
+ }
762
+ function getAddressTableLookupArrayEncoder() {
763
+ return getArrayEncoder(getAddressTableLookupEncoder(), {
764
+ description: addressTableLookupsDescription,
765
+ size: getShortU16Encoder()
766
+ });
767
+ }
768
+ function getAddressTableLookupArrayDecoder() {
769
+ return getArrayDecoder(getAddressTableLookupDecoder(), {
770
+ description: addressTableLookupsDescription,
771
+ size: getShortU16Decoder()
772
+ });
773
+ }
774
+ var messageDescription = __DEV__ ? "The wire format of a Solana transaction message" : "message";
775
+ function getCompiledMessageEncoder() {
776
+ return {
777
+ description: messageDescription,
778
+ encode: (compiledMessage) => {
779
+ if (compiledMessage.version === "legacy") {
780
+ return getCompiledMessageLegacyEncoder().encode(compiledMessage);
781
+ } else {
782
+ return getCompiledMessageVersionedEncoder().encode(compiledMessage);
783
+ }
784
+ },
785
+ fixedSize: null,
786
+ maxSize: null
787
+ };
788
+ }
789
+ function getCompiledMessageDecoder() {
790
+ return mapDecoder(
791
+ getStructDecoder(getPreludeStructDecoderTuple(), {
792
+ description: messageDescription
793
+ }),
794
+ ({ addressTableLookups, ...restOfMessage }) => {
795
+ if (restOfMessage.version === "legacy" || !addressTableLookups?.length) {
796
+ return restOfMessage;
797
+ }
798
+ return { ...restOfMessage, addressTableLookups };
799
+ }
800
+ );
801
+ }
802
+ function getCompiledMessageCodec() {
803
+ return combineCodec(getCompiledMessageEncoder(), getCompiledMessageDecoder());
804
+ }
805
+
806
+ // src/compile-transaction.ts
807
+ function getCompiledTransaction(transaction) {
808
+ const compiledMessage = compileMessage(transaction);
809
+ let signatures;
42
810
  if ("signatures" in transaction) {
43
- const {
44
- signatures: _,
45
- // eslint-disable-line @typescript-eslint/no-unused-vars
46
- ...unsignedTransaction
47
- } = transaction;
48
- out = {
49
- ...unsignedTransaction,
50
- instructions: nextInstructions
811
+ signatures = [];
812
+ for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
813
+ signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
814
+ }
815
+ } else {
816
+ signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
817
+ }
818
+ return {
819
+ compiledMessage,
820
+ signatures
821
+ };
822
+ }
823
+ function getAccountMetas(message) {
824
+ const { header } = message;
825
+ const numWritableSignerAccounts = header.numSignerAccounts - header.numReadonlySignerAccounts;
826
+ const numWritableNonSignerAccounts = message.staticAccounts.length - header.numSignerAccounts - header.numReadonlyNonSignerAccounts;
827
+ const accountMetas = [];
828
+ let accountIndex = 0;
829
+ for (let i = 0; i < numWritableSignerAccounts; i++) {
830
+ accountMetas.push({
831
+ address: message.staticAccounts[accountIndex],
832
+ role: AccountRole.WRITABLE_SIGNER
833
+ });
834
+ accountIndex++;
835
+ }
836
+ for (let i = 0; i < header.numReadonlySignerAccounts; i++) {
837
+ accountMetas.push({
838
+ address: message.staticAccounts[accountIndex],
839
+ role: AccountRole.READONLY_SIGNER
840
+ });
841
+ accountIndex++;
842
+ }
843
+ for (let i = 0; i < numWritableNonSignerAccounts; i++) {
844
+ accountMetas.push({
845
+ address: message.staticAccounts[accountIndex],
846
+ role: AccountRole.WRITABLE
847
+ });
848
+ accountIndex++;
849
+ }
850
+ for (let i = 0; i < header.numReadonlyNonSignerAccounts; i++) {
851
+ accountMetas.push({
852
+ address: message.staticAccounts[accountIndex],
853
+ role: AccountRole.READONLY
854
+ });
855
+ accountIndex++;
856
+ }
857
+ return accountMetas;
858
+ }
859
+ function convertInstruction(instruction, accountMetas) {
860
+ const programAddress = accountMetas[instruction.programAddressIndex]?.address;
861
+ if (!programAddress) {
862
+ throw new Error(`Could not find program address at index ${instruction.programAddressIndex}`);
863
+ }
864
+ const accounts = instruction.accountIndices?.map((accountIndex) => accountMetas[accountIndex]);
865
+ const { data } = instruction;
866
+ return {
867
+ programAddress,
868
+ ...accounts && accounts.length ? { accounts } : {},
869
+ ...data && data.length ? { data } : {}
870
+ };
871
+ }
872
+ function getLifetimeConstraint(messageLifetimeToken, firstInstruction, lastValidBlockHeight) {
873
+ if (!firstInstruction || !isAdvanceNonceAccountInstruction(firstInstruction)) {
874
+ return {
875
+ blockhash: messageLifetimeToken,
876
+ lastValidBlockHeight: lastValidBlockHeight ?? 2n ** 64n - 1n
877
+ // U64 MAX
51
878
  };
52
879
  } else {
53
- out = {
54
- ...transaction,
55
- instructions: nextInstructions
880
+ const nonceAccountAddress = firstInstruction.accounts[0].address;
881
+ assertIsAddress(nonceAccountAddress);
882
+ const nonceAuthorityAddress = firstInstruction.accounts[2].address;
883
+ assertIsAddress(nonceAuthorityAddress);
884
+ return {
885
+ nonce: messageLifetimeToken,
886
+ nonceAccountAddress,
887
+ nonceAuthorityAddress
56
888
  };
57
889
  }
58
- return out;
59
890
  }
60
- function appendTransactionInstruction(instruction, transaction) {
61
- const nextInstructions = [...transaction.instructions, instruction];
62
- const out = replaceInstructions(transaction, nextInstructions);
891
+ function convertSignatures(compiledTransaction) {
892
+ const {
893
+ compiledMessage: { staticAccounts },
894
+ signatures
895
+ } = compiledTransaction;
896
+ return signatures.reduce((acc, sig, index) => {
897
+ const allZeros = sig.every((byte) => byte === 0);
898
+ if (allZeros)
899
+ return acc;
900
+ const address = staticAccounts[index];
901
+ return { ...acc, [address]: sig };
902
+ }, {});
903
+ }
904
+ function decompileTransaction(compiledTransaction, lastValidBlockHeight) {
905
+ const { compiledMessage } = compiledTransaction;
906
+ if ("addressTableLookups" in compiledMessage && compiledMessage.addressTableLookups.length > 0) {
907
+ throw new Error("Cannot convert transaction with addressTableLookups");
908
+ }
909
+ const feePayer = compiledMessage.staticAccounts[0];
910
+ if (!feePayer)
911
+ throw new Error("No fee payer set in CompiledTransaction");
912
+ const accountMetas = getAccountMetas(compiledMessage);
913
+ const instructions = compiledMessage.instructions.map(
914
+ (compiledInstruction) => convertInstruction(compiledInstruction, accountMetas)
915
+ );
916
+ const firstInstruction = instructions[0];
917
+ const lifetimeConstraint = getLifetimeConstraint(
918
+ compiledMessage.lifetimeToken,
919
+ firstInstruction,
920
+ lastValidBlockHeight
921
+ );
922
+ const signatures = convertSignatures(compiledTransaction);
923
+ return pipe(
924
+ createTransaction({ version: compiledMessage.version }),
925
+ (tx) => setTransactionFeePayer(feePayer, tx),
926
+ (tx) => instructions.reduce((acc, instruction) => {
927
+ return appendTransactionInstruction(instruction, acc);
928
+ }, tx),
929
+ (tx) => "blockhash" in lifetimeConstraint ? setTransactionLifetimeUsingBlockhash(lifetimeConstraint, tx) : setTransactionLifetimeUsingDurableNonce(lifetimeConstraint, tx),
930
+ (tx) => compiledTransaction.signatures.length ? { ...tx, signatures } : tx
931
+ );
932
+ }
933
+
934
+ // src/serializers/transaction.ts
935
+ var signaturesDescription = __DEV__ ? "A compact array of 64-byte, base-64 encoded Ed25519 signatures" : "signatures";
936
+ var transactionDescription = __DEV__ ? "The wire format of a Solana transaction" : "transaction";
937
+ function getCompiledTransactionEncoder() {
938
+ return getStructEncoder(
939
+ [
940
+ [
941
+ "signatures",
942
+ getArrayEncoder(getBytesEncoder({ size: 64 }), {
943
+ description: signaturesDescription,
944
+ size: getShortU16Encoder()
945
+ })
946
+ ],
947
+ ["compiledMessage", getCompiledMessageEncoder()]
948
+ ],
949
+ {
950
+ description: transactionDescription
951
+ }
952
+ );
953
+ }
954
+ function getSignatureDecoder() {
955
+ return mapDecoder(getBytesDecoder({ size: 64 }), (bytes) => bytes);
956
+ }
957
+ function getCompiledTransactionDecoder() {
958
+ return getStructDecoder(
959
+ [
960
+ [
961
+ "signatures",
962
+ getArrayDecoder(getSignatureDecoder(), {
963
+ description: signaturesDescription,
964
+ size: getShortU16Decoder()
965
+ })
966
+ ],
967
+ ["compiledMessage", getCompiledMessageDecoder()]
968
+ ],
969
+ {
970
+ description: transactionDescription
971
+ }
972
+ );
973
+ }
974
+ function getTransactionEncoder() {
975
+ return mapEncoder(getCompiledTransactionEncoder(), getCompiledTransaction);
976
+ }
977
+ function getTransactionDecoder(lastValidBlockHeight) {
978
+ return mapDecoder(
979
+ getCompiledTransactionDecoder(),
980
+ (compiledTransaction) => decompileTransaction(compiledTransaction, lastValidBlockHeight)
981
+ );
982
+ }
983
+ function getTransactionCodec(lastValidBlockHeight) {
984
+ return combineCodec(getTransactionEncoder(), getTransactionDecoder(lastValidBlockHeight));
985
+ }
986
+ var base58Decoder;
987
+ function getSignatureFromTransaction(transaction) {
988
+ if (!base58Decoder)
989
+ base58Decoder = getBase58Decoder();
990
+ const signatureBytes = transaction.signatures[transaction.feePayer];
991
+ if (!signatureBytes) {
992
+ throw new Error(
993
+ "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
994
+ );
995
+ }
996
+ const transactionSignature = base58Decoder.decode(signatureBytes)[0];
997
+ return transactionSignature;
998
+ }
999
+ async function partiallySignTransaction(keyPairs, transaction) {
1000
+ const compiledMessage = compileMessage(transaction);
1001
+ const nextSignatures = "signatures" in transaction ? { ...transaction.signatures } : {};
1002
+ const wireMessageBytes = getCompiledMessageEncoder().encode(compiledMessage);
1003
+ const publicKeySignaturePairs = await Promise.all(
1004
+ keyPairs.map(
1005
+ (keyPair) => Promise.all([getAddressFromPublicKey(keyPair.publicKey), signBytes(keyPair.privateKey, wireMessageBytes)])
1006
+ )
1007
+ );
1008
+ for (const [signerPublicKey, signature] of publicKeySignaturePairs) {
1009
+ nextSignatures[signerPublicKey] = signature;
1010
+ }
1011
+ const out = {
1012
+ ...transaction,
1013
+ signatures: nextSignatures
1014
+ };
63
1015
  Object.freeze(out);
64
1016
  return out;
65
1017
  }
66
- function prependTransactionInstruction(instruction, transaction) {
67
- const nextInstructions = [instruction, ...transaction.instructions];
68
- const out = replaceInstructions(transaction, nextInstructions);
1018
+ async function signTransaction(keyPairs, transaction) {
1019
+ const out = await partiallySignTransaction(keyPairs, transaction);
1020
+ assertTransactionIsFullySigned(out);
69
1021
  Object.freeze(out);
70
1022
  return out;
71
1023
  }
1024
+ function assertTransactionIsFullySigned(transaction) {
1025
+ const signerAddressesFromInstructions = transaction.instructions.flatMap((i) => i.accounts?.filter((a) => isSignerRole(a.role)) ?? []).map((a) => a.address);
1026
+ const requiredSigners = /* @__PURE__ */ new Set([transaction.feePayer, ...signerAddressesFromInstructions]);
1027
+ requiredSigners.forEach((address) => {
1028
+ if (!transaction.signatures[address]) {
1029
+ throw new Error(`Transaction is missing signature for address \`${address}\``);
1030
+ }
1031
+ });
1032
+ }
1033
+ function getBase64EncodedWireTransaction(transaction) {
1034
+ const wireTransactionBytes = getTransactionEncoder().encode(transaction);
1035
+ return getBase64Decoder().decode(wireTransactionBytes)[0];
1036
+ }
72
1037
 
73
- export { appendTransactionInstruction, createTransaction, prependTransactionInstruction, setTransactionFeePayer };
1038
+ export { appendTransactionInstruction, assertIsBlockhash, assertIsDurableNonceTransaction, assertTransactionIsFullySigned, compileMessage, createTransaction, getBase64EncodedWireTransaction, getCompiledMessageCodec, getCompiledMessageDecoder, getCompiledMessageEncoder, getSignatureFromTransaction, getTransactionCodec, getTransactionDecoder, getTransactionEncoder, isAdvanceNonceAccountInstruction, partiallySignTransaction, prependTransactionInstruction, setTransactionFeePayer, setTransactionLifetimeUsingBlockhash, setTransactionLifetimeUsingDurableNonce, signTransaction };
74
1039
  //# sourceMappingURL=out.js.map
75
1040
  //# sourceMappingURL=index.browser.js.map