@solana/transactions 2.0.0-experimental.2bae733 → 2.0.0-experimental.2f6fdd4

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 (52) hide show
  1. package/dist/index.browser.cjs +204 -68
  2. package/dist/index.browser.cjs.map +1 -1
  3. package/dist/index.browser.js +196 -67
  4. package/dist/index.browser.js.map +1 -1
  5. package/dist/index.development.js +264 -125
  6. package/dist/index.development.js.map +1 -1
  7. package/dist/index.native.js +196 -65
  8. package/dist/index.native.js.map +1 -1
  9. package/dist/index.node.cjs +206 -68
  10. package/dist/index.node.cjs.map +1 -1
  11. package/dist/index.node.js +196 -65
  12. package/dist/index.node.js.map +1 -1
  13. package/dist/index.production.min.js +11 -6
  14. package/dist/types/accounts.d.ts +1 -1
  15. package/dist/types/accounts.d.ts.map +1 -0
  16. package/dist/types/blockhash.d.ts +9 -1
  17. package/dist/types/blockhash.d.ts.map +1 -0
  18. package/dist/types/compile-address-table-lookups.d.ts +1 -1
  19. package/dist/types/compile-address-table-lookups.d.ts.map +1 -0
  20. package/dist/types/compile-header.d.ts.map +1 -0
  21. package/dist/types/compile-instructions.d.ts +1 -1
  22. package/dist/types/compile-instructions.d.ts.map +1 -0
  23. package/dist/types/compile-lifetime-token.d.ts.map +1 -0
  24. package/dist/types/compile-static-accounts.d.ts +1 -1
  25. package/dist/types/compile-static-accounts.d.ts.map +1 -0
  26. package/dist/types/compile-transaction.d.ts +11 -0
  27. package/dist/types/compile-transaction.d.ts.map +1 -0
  28. package/dist/types/create-transaction.d.ts.map +1 -0
  29. package/dist/types/durable-nonce.d.ts +18 -6
  30. package/dist/types/durable-nonce.d.ts.map +1 -0
  31. package/dist/types/fee-payer.d.ts +1 -1
  32. package/dist/types/fee-payer.d.ts.map +1 -0
  33. package/dist/types/index.d.ts +1 -0
  34. package/dist/types/index.d.ts.map +1 -0
  35. package/dist/types/instructions.d.ts.map +1 -0
  36. package/dist/types/message.d.ts.map +1 -0
  37. package/dist/types/serializers/address-table-lookup.d.ts.map +1 -0
  38. package/dist/types/serializers/header.d.ts.map +1 -0
  39. package/dist/types/serializers/instruction.d.ts.map +1 -0
  40. package/dist/types/serializers/message.d.ts.map +1 -0
  41. package/dist/types/serializers/transaction-version.d.ts.map +1 -0
  42. package/dist/types/serializers/transaction.d.ts +6 -0
  43. package/dist/types/serializers/transaction.d.ts.map +1 -0
  44. package/dist/types/serializers/unimplemented.d.ts.map +1 -0
  45. package/dist/types/signatures.d.ts +3 -4
  46. package/dist/types/signatures.d.ts.map +1 -0
  47. package/dist/types/types.d.ts.map +1 -0
  48. package/dist/types/unsigned-transaction.d.ts +4 -0
  49. package/dist/types/unsigned-transaction.d.ts.map +1 -0
  50. package/dist/types/wire-transaction.d.ts +6 -0
  51. package/dist/types/wire-transaction.d.ts.map +1 -0
  52. package/package.json +12 -16
@@ -9,78 +9,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
9
9
  return value;
10
10
  };
11
11
 
12
- // src/create-transaction.ts
13
- function createTransaction({
14
- version
15
- }) {
16
- const out = {
17
- instructions: [],
18
- version
19
- };
20
- Object.freeze(out);
21
- return out;
22
- }
23
-
24
- // src/fee-payer.ts
25
- function setTransactionFeePayer(feePayer, transaction) {
26
- if ("feePayer" in transaction && feePayer === transaction.feePayer) {
27
- return transaction;
28
- }
29
- let out;
30
- if ("signatures" in transaction) {
31
- const {
32
- signatures: _,
33
- // eslint-disable-line @typescript-eslint/no-unused-vars
34
- ...unsignedTransaction
35
- } = transaction;
36
- out = {
37
- ...unsignedTransaction,
38
- feePayer
39
- };
40
- } else {
41
- out = {
42
- ...transaction,
43
- feePayer
44
- };
45
- }
46
- Object.freeze(out);
47
- return out;
48
- }
49
-
50
- // src/instructions.ts
51
- function replaceInstructions(transaction, nextInstructions) {
52
- let out;
53
- if ("signatures" in transaction) {
54
- const {
55
- signatures: _,
56
- // eslint-disable-line @typescript-eslint/no-unused-vars
57
- ...unsignedTransaction
58
- } = transaction;
59
- out = {
60
- ...unsignedTransaction,
61
- instructions: nextInstructions
62
- };
63
- } else {
64
- out = {
65
- ...transaction,
66
- instructions: nextInstructions
67
- };
68
- }
69
- return out;
70
- }
71
- function appendTransactionInstruction(instruction, transaction) {
72
- const nextInstructions = [...transaction.instructions, instruction];
73
- const out = replaceInstructions(transaction, nextInstructions);
74
- Object.freeze(out);
75
- return out;
76
- }
77
- function prependTransactionInstruction(instruction, transaction) {
78
- const nextInstructions = [instruction, ...transaction.instructions];
79
- const out = replaceInstructions(transaction, nextInstructions);
80
- Object.freeze(out);
81
- return out;
82
- }
83
-
84
12
  // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers-core@0.8.2/node_modules/@metaplex-foundation/umi-serializers-core/dist/esm/bytes.mjs
85
13
  var mergeBytes = (bytesArr) => {
86
14
  const totalLength = bytesArr.reduce((total, arr) => total + arr.length, 0);
@@ -360,7 +288,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
360
288
  }
361
289
  });
362
290
 
363
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.2/node_modules/@metaplex-foundation/umi-serializers/dist/esm/errors.mjs
291
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/errors.mjs
364
292
  var InvalidNumberOfItemsError = class extends Error {
365
293
  constructor(serializer, expected, actual) {
366
294
  super(`Expected [${serializer}] to have ${expected} items, got ${actual}.`);
@@ -380,12 +308,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
380
308
  }
381
309
  };
382
310
 
383
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.2/node_modules/@metaplex-foundation/umi-serializers/dist/esm/sumSerializerSizes.mjs
311
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/sumSerializerSizes.mjs
384
312
  function sumSerializerSizes(sizes) {
385
313
  return sizes.reduce((all, size) => all === null || size === null ? null : all + size, 0);
386
314
  }
387
315
 
388
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.2/node_modules/@metaplex-foundation/umi-serializers/dist/esm/utils.mjs
316
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/utils.mjs
389
317
  function getResolvedSize(size, childrenSizes, bytes2, offset) {
390
318
  if (typeof size === "number") {
391
319
  return [size, offset];
@@ -421,7 +349,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
421
349
  return typeof size === "object" ? size.serialize(realSize) : new Uint8Array();
422
350
  }
423
351
 
424
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.2/node_modules/@metaplex-foundation/umi-serializers/dist/esm/array.mjs
352
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/array.mjs
425
353
  function array(item, options = {}) {
426
354
  const size = options.size ?? u32();
427
355
  if (size === "remainder" && item.fixedSize === null) {
@@ -454,7 +382,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
454
382
  };
455
383
  }
456
384
 
457
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.2/node_modules/@metaplex-foundation/umi-serializers/dist/esm/bytes.mjs
385
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/bytes.mjs
458
386
  function bytes(options = {}) {
459
387
  const size = options.size ?? "variable";
460
388
  const description = options.description ?? `bytes(${getSizeDescription(size)})`;
@@ -501,7 +429,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
501
429
  };
502
430
  }
503
431
 
504
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.2/node_modules/@metaplex-foundation/umi-serializers/dist/esm/string.mjs
432
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/string.mjs
505
433
  function string(options = {}) {
506
434
  const size = options.size ?? u32();
507
435
  const encoding = options.encoding ?? utf8;
@@ -542,7 +470,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
542
470
  };
543
471
  }
544
472
 
545
- // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.2/node_modules/@metaplex-foundation/umi-serializers/dist/esm/struct.mjs
473
+ // ../../node_modules/.pnpm/@metaplex-foundation+umi-serializers@0.8.5/node_modules/@metaplex-foundation/umi-serializers/dist/esm/struct.mjs
546
474
  function struct(fields, options = {}) {
547
475
  const fieldDescriptions = fields.map(([name, serializer]) => `${String(name)}: ${serializer.description}`).join(", ");
548
476
  return {
@@ -564,23 +492,180 @@ this.globalThis.solanaWeb3 = (function (exports) {
564
492
  }
565
493
  };
566
494
  }
567
- function getBase58EncodedAddressCodec(config) {
568
- return string({
569
- description: config?.description ?? ("A 32-byte account address" ),
570
- encoding: base58,
571
- size: 32
572
- });
495
+
496
+ // src/unsigned-transaction.ts
497
+ function getUnsignedTransaction(transaction) {
498
+ if ("signatures" in transaction) {
499
+ const {
500
+ signatures: _,
501
+ // eslint-disable-line @typescript-eslint/no-unused-vars
502
+ ...unsignedTransaction
503
+ } = transaction;
504
+ return unsignedTransaction;
505
+ } else {
506
+ return transaction;
507
+ }
573
508
  }
574
- function getBase58EncodedAddressComparator() {
575
- return new Intl.Collator("en", {
576
- caseFirst: "lower",
577
- ignorePunctuation: false,
578
- localeMatcher: "best fit",
579
- numeric: false,
580
- sensitivity: "variant",
581
- usage: "sort"
582
- }).compare;
509
+
510
+ // src/blockhash.ts
511
+ function assertIsBlockhash(putativeBlockhash) {
512
+ try {
513
+ if (
514
+ // Lowest value (32 bytes of zeroes)
515
+ putativeBlockhash.length < 32 || // Highest value (32 bytes of 255)
516
+ putativeBlockhash.length > 44
517
+ ) {
518
+ throw new Error("Expected input string to decode to a byte array of length 32.");
519
+ }
520
+ const bytes2 = base58.serialize(putativeBlockhash);
521
+ const numBytes = bytes2.byteLength;
522
+ if (numBytes !== 32) {
523
+ throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
524
+ }
525
+ } catch (e) {
526
+ throw new Error(`\`${putativeBlockhash}\` is not a blockhash`, {
527
+ cause: e
528
+ });
529
+ }
530
+ }
531
+ function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
532
+ if ("lifetimeConstraint" in transaction && transaction.lifetimeConstraint.blockhash === blockhashLifetimeConstraint.blockhash && transaction.lifetimeConstraint.lastValidBlockHeight === blockhashLifetimeConstraint.lastValidBlockHeight) {
533
+ return transaction;
534
+ }
535
+ const out = {
536
+ ...getUnsignedTransaction(transaction),
537
+ lifetimeConstraint: blockhashLifetimeConstraint
538
+ };
539
+ Object.freeze(out);
540
+ return out;
541
+ }
542
+
543
+ // src/create-transaction.ts
544
+ function createTransaction({
545
+ version
546
+ }) {
547
+ const out = {
548
+ instructions: [],
549
+ version
550
+ };
551
+ Object.freeze(out);
552
+ return out;
553
+ }
554
+
555
+ // ../instructions/dist/index.browser.js
556
+ var AccountRole = /* @__PURE__ */ ((AccountRole2) => {
557
+ AccountRole2[AccountRole2["WRITABLE_SIGNER"] = /* 3 */
558
+ 3] = "WRITABLE_SIGNER";
559
+ AccountRole2[AccountRole2["READONLY_SIGNER"] = /* 2 */
560
+ 2] = "READONLY_SIGNER";
561
+ AccountRole2[AccountRole2["WRITABLE"] = /* 1 */
562
+ 1] = "WRITABLE";
563
+ AccountRole2[AccountRole2["READONLY"] = /* 0 */
564
+ 0] = "READONLY";
565
+ return AccountRole2;
566
+ })(AccountRole || {});
567
+ var IS_WRITABLE_BITMASK = 1;
568
+ function isSignerRole(role) {
569
+ return role >= 2;
570
+ }
571
+ function isWritableRole(role) {
572
+ return (role & IS_WRITABLE_BITMASK) !== 0;
573
+ }
574
+ function mergeRoles(roleA, roleB) {
575
+ return roleA | roleB;
576
+ }
577
+
578
+ // src/durable-nonce.ts
579
+ var RECENT_BLOCKHASHES_SYSVAR_ADDRESS = "SysvarRecentB1ockHashes11111111111111111111";
580
+ var SYSTEM_PROGRAM_ADDRESS = "11111111111111111111111111111111";
581
+ function assertIsDurableNonceTransaction(transaction) {
582
+ if (!isDurableNonceTransaction(transaction)) {
583
+ throw new Error("Transaction is not a durable nonce transaction");
584
+ }
585
+ }
586
+ function createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress) {
587
+ return {
588
+ accounts: [
589
+ { address: nonceAccountAddress, role: AccountRole.WRITABLE },
590
+ {
591
+ address: RECENT_BLOCKHASHES_SYSVAR_ADDRESS,
592
+ role: AccountRole.READONLY
593
+ },
594
+ { address: nonceAuthorityAddress, role: AccountRole.READONLY_SIGNER }
595
+ ],
596
+ data: new Uint8Array([4, 0, 0, 0]),
597
+ programAddress: SYSTEM_PROGRAM_ADDRESS
598
+ };
599
+ }
600
+ function isAdvanceNonceAccountInstruction(instruction) {
601
+ return instruction.programAddress === SYSTEM_PROGRAM_ADDRESS && // Test for `AdvanceNonceAccount` instruction data
602
+ instruction.data != null && isAdvanceNonceAccountInstructionData(instruction.data) && // Test for exactly 3 accounts
603
+ instruction.accounts?.length === 3 && // First account is nonce account address
604
+ instruction.accounts[0].address != null && instruction.accounts[0].role === AccountRole.WRITABLE && // Second account is recent blockhashes sysvar
605
+ instruction.accounts[1].address === RECENT_BLOCKHASHES_SYSVAR_ADDRESS && instruction.accounts[1].role === AccountRole.READONLY && // Third account is nonce authority account
606
+ instruction.accounts[2].address != null && instruction.accounts[2].role === AccountRole.READONLY_SIGNER;
583
607
  }
608
+ function isAdvanceNonceAccountInstructionData(data) {
609
+ return data.byteLength === 4 && data[0] === 4 && data[1] === 0 && data[2] === 0 && data[3] === 0;
610
+ }
611
+ function isDurableNonceTransaction(transaction) {
612
+ return "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.nonce === "string" && transaction.instructions[0] != null && isAdvanceNonceAccountInstruction(transaction.instructions[0]);
613
+ }
614
+ function setTransactionLifetimeUsingDurableNonce({
615
+ nonce,
616
+ nonceAccountAddress,
617
+ nonceAuthorityAddress
618
+ }, transaction) {
619
+ const isAlreadyDurableNonceTransaction = isDurableNonceTransaction(transaction);
620
+ if (isAlreadyDurableNonceTransaction && transaction.lifetimeConstraint.nonce === nonce && transaction.instructions[0].accounts[0].address === nonceAccountAddress && transaction.instructions[0].accounts[2].address === nonceAuthorityAddress) {
621
+ return transaction;
622
+ }
623
+ const out = {
624
+ ...getUnsignedTransaction(transaction),
625
+ instructions: [
626
+ createAdvanceNonceAccountInstruction(nonceAccountAddress, nonceAuthorityAddress),
627
+ ...isAlreadyDurableNonceTransaction ? transaction.instructions.slice(1) : transaction.instructions
628
+ ],
629
+ lifetimeConstraint: {
630
+ nonce
631
+ }
632
+ };
633
+ Object.freeze(out);
634
+ return out;
635
+ }
636
+
637
+ // src/fee-payer.ts
638
+ function setTransactionFeePayer(feePayer, transaction) {
639
+ if ("feePayer" in transaction && feePayer === transaction.feePayer) {
640
+ return transaction;
641
+ }
642
+ const out = {
643
+ ...getUnsignedTransaction(transaction),
644
+ feePayer
645
+ };
646
+ Object.freeze(out);
647
+ return out;
648
+ }
649
+
650
+ // src/instructions.ts
651
+ function appendTransactionInstruction(instruction, transaction) {
652
+ const out = {
653
+ ...getUnsignedTransaction(transaction),
654
+ instructions: [...transaction.instructions, instruction]
655
+ };
656
+ Object.freeze(out);
657
+ return out;
658
+ }
659
+ function prependTransactionInstruction(instruction, transaction) {
660
+ const out = {
661
+ ...getUnsignedTransaction(transaction),
662
+ instructions: [instruction, ...transaction.instructions]
663
+ };
664
+ Object.freeze(out);
665
+ return out;
666
+ }
667
+
668
+ // ../assertions/dist/index.browser.js
584
669
  function assertIsSecureContext() {
585
670
  if (!globalThis.isSecureContext) {
586
671
  throw new Error(
@@ -600,7 +685,24 @@ this.globalThis.solanaWeb3 = (function (exports) {
600
685
  throw new Error("No signing implementation could be found");
601
686
  }
602
687
  }
603
- async function getBase58EncodedAddressFromPublicKey(publicKey) {
688
+ function getBase58EncodedAddressCodec(config) {
689
+ return string({
690
+ description: config?.description ?? ("A 32-byte account address" ),
691
+ encoding: base58,
692
+ size: 32
693
+ });
694
+ }
695
+ function getBase58EncodedAddressComparator() {
696
+ return new Intl.Collator("en", {
697
+ caseFirst: "lower",
698
+ ignorePunctuation: false,
699
+ localeMatcher: "best fit",
700
+ numeric: false,
701
+ sensitivity: "variant",
702
+ usage: "sort"
703
+ }).compare;
704
+ }
705
+ async function getAddressFromPublicKey(publicKey) {
604
706
  await assertKeyExporterIsAvailable();
605
707
  if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
606
708
  throw new Error("The `CryptoKey` must be an `Ed25519` public key");
@@ -609,35 +711,14 @@ this.globalThis.solanaWeb3 = (function (exports) {
609
711
  const [base58EncodedAddress] = getBase58EncodedAddressCodec().deserialize(new Uint8Array(publicKeyBytes));
610
712
  return base58EncodedAddress;
611
713
  }
714
+
715
+ // ../keys/dist/index.browser.js
612
716
  async function signBytes(key, data) {
613
717
  await assertSigningCapabilityIsAvailable();
614
718
  const signedData = await crypto.subtle.sign("Ed25519", key, data);
615
719
  return new Uint8Array(signedData);
616
720
  }
617
721
 
618
- // ../instructions/dist/index.browser.js
619
- var AccountRole = /* @__PURE__ */ ((AccountRole2) => {
620
- AccountRole2[AccountRole2["WRITABLE_SIGNER"] = /* 3 */
621
- 3] = "WRITABLE_SIGNER";
622
- AccountRole2[AccountRole2["READONLY_SIGNER"] = /* 2 */
623
- 2] = "READONLY_SIGNER";
624
- AccountRole2[AccountRole2["WRITABLE"] = /* 1 */
625
- 1] = "WRITABLE";
626
- AccountRole2[AccountRole2["READONLY"] = /* 0 */
627
- 0] = "READONLY";
628
- return AccountRole2;
629
- })(AccountRole || {});
630
- var IS_WRITABLE_BITMASK = 1;
631
- function isSignerRole(role) {
632
- return role >= 2;
633
- }
634
- function isWritableRole(role) {
635
- return (role & IS_WRITABLE_BITMASK) !== 0;
636
- }
637
- function mergeRoles(roleA, roleB) {
638
- return roleA | roleB;
639
- }
640
-
641
722
  // src/accounts.ts
642
723
  function upsert(addressMap, address, update) {
643
724
  addressMap[address] = update(addressMap[address] ?? { role: AccountRole.READONLY });
@@ -993,7 +1074,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
993
1074
  )
994
1075
  ],
995
1076
  [
996
- "addressIndices",
1077
+ "accountIndices",
997
1078
  array(
998
1079
  u8({
999
1080
  description: "The index of an account, according to the well-ordered accounts list for this transaction"
@@ -1013,23 +1094,23 @@ this.globalThis.solanaWeb3 = (function (exports) {
1013
1094
  ]
1014
1095
  ]),
1015
1096
  (value) => {
1016
- if (value.addressIndices !== void 0 && value.data !== void 0) {
1097
+ if (value.accountIndices !== void 0 && value.data !== void 0) {
1017
1098
  return value;
1018
1099
  }
1019
1100
  return {
1020
1101
  ...value,
1021
- addressIndices: value.addressIndices ?? [],
1102
+ accountIndices: value.accountIndices ?? [],
1022
1103
  data: value.data ?? new Uint8Array(0)
1023
1104
  };
1024
1105
  },
1025
1106
  (value) => {
1026
- if (value.addressIndices.length && value.data.byteLength) {
1107
+ if (value.accountIndices.length && value.data.byteLength) {
1027
1108
  return value;
1028
1109
  }
1029
- const { addressIndices, data, ...rest } = value;
1110
+ const { accountIndices, data, ...rest } = value;
1030
1111
  return {
1031
1112
  ...rest,
1032
- ...addressIndices.length ? { addressIndices } : null,
1113
+ ...accountIndices.length ? { accountIndices } : null,
1033
1114
  ...data.byteLength ? { data } : null
1034
1115
  };
1035
1116
  }
@@ -1160,7 +1241,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
1160
1241
  async function signTransaction(keyPair, transaction) {
1161
1242
  const compiledMessage = compileMessage(transaction);
1162
1243
  const [signerPublicKey, signature] = await Promise.all([
1163
- getBase58EncodedAddressFromPublicKey(keyPair.publicKey),
1244
+ getAddressFromPublicKey(keyPair.publicKey),
1164
1245
  getCompiledMessageSignature(compiledMessage, keyPair.privateKey)
1165
1246
  ]);
1166
1247
  const nextSignatures = {
@@ -1175,10 +1256,68 @@ this.globalThis.solanaWeb3 = (function (exports) {
1175
1256
  return out;
1176
1257
  }
1177
1258
 
1259
+ // src/compile-transaction.ts
1260
+ function getCompiledTransaction(transaction) {
1261
+ const compiledMessage = compileMessage(transaction);
1262
+ let signatures;
1263
+ if ("signatures" in transaction) {
1264
+ signatures = [];
1265
+ for (let ii = 0; ii < compiledMessage.header.numSignerAccounts; ii++) {
1266
+ signatures[ii] = transaction.signatures[compiledMessage.staticAccounts[ii]] ?? new Uint8Array(Array(64).fill(0));
1267
+ }
1268
+ } else {
1269
+ signatures = Array(compiledMessage.header.numSignerAccounts).fill(new Uint8Array(Array(64).fill(0)));
1270
+ }
1271
+ return {
1272
+ compiledMessage,
1273
+ signatures
1274
+ };
1275
+ }
1276
+
1277
+ // src/serializers/transaction.ts
1278
+ var BASE_CONFIG3 = {
1279
+ description: "The wire format of a Solana transaction" ,
1280
+ fixedSize: null,
1281
+ maxSize: null
1282
+ };
1283
+ function serialize3(transaction) {
1284
+ const compiledTransaction = getCompiledTransaction(transaction);
1285
+ return struct([
1286
+ [
1287
+ "signatures",
1288
+ array(bytes({ size: 64 }), {
1289
+ ...{ description: "A compact array of 64-byte, base-64 encoded Ed25519 signatures" } ,
1290
+ size: shortU16()
1291
+ })
1292
+ ],
1293
+ ["compiledMessage", getCompiledMessageEncoder()]
1294
+ ]).serialize(compiledTransaction);
1295
+ }
1296
+ function getTransactionEncoder() {
1297
+ return {
1298
+ ...BASE_CONFIG3,
1299
+ deserialize: getUnimplementedDecoder("CompiledMessage"),
1300
+ serialize: serialize3
1301
+ };
1302
+ }
1303
+
1304
+ // src/wire-transaction.ts
1305
+ function getBase64EncodedWireTransaction(transaction) {
1306
+ const wireTransactionBytes = getTransactionEncoder().serialize(transaction);
1307
+ {
1308
+ return btoa(String.fromCharCode(...wireTransactionBytes));
1309
+ }
1310
+ }
1311
+
1178
1312
  exports.appendTransactionInstruction = appendTransactionInstruction;
1313
+ exports.assertIsBlockhash = assertIsBlockhash;
1314
+ exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
1179
1315
  exports.createTransaction = createTransaction;
1316
+ exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
1180
1317
  exports.prependTransactionInstruction = prependTransactionInstruction;
1181
1318
  exports.setTransactionFeePayer = setTransactionFeePayer;
1319
+ exports.setTransactionLifetimeUsingBlockhash = setTransactionLifetimeUsingBlockhash;
1320
+ exports.setTransactionLifetimeUsingDurableNonce = setTransactionLifetimeUsingDurableNonce;
1182
1321
  exports.signTransaction = signTransaction;
1183
1322
 
1184
1323
  return exports;