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

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 (66) hide show
  1. package/dist/index.browser.cjs +115 -246
  2. package/dist/index.browser.cjs.map +1 -1
  3. package/dist/index.browser.js +114 -248
  4. package/dist/index.browser.js.map +1 -1
  5. package/dist/index.native.js +114 -248
  6. package/dist/index.native.js.map +1 -1
  7. package/dist/index.node.cjs +113 -246
  8. package/dist/index.node.cjs.map +1 -1
  9. package/dist/index.node.js +114 -248
  10. package/dist/index.node.js.map +1 -1
  11. package/dist/types/accounts.d.ts.map +1 -0
  12. package/dist/types/blockhash.d.ts +4 -3
  13. package/dist/types/blockhash.d.ts.map +1 -0
  14. package/dist/types/compilable-transaction.d.ts +4 -4
  15. package/dist/types/compilable-transaction.d.ts.map +1 -0
  16. package/dist/types/compile-address-table-lookups.d.ts +1 -1
  17. package/dist/types/compile-address-table-lookups.d.ts.map +1 -0
  18. package/dist/types/compile-header.d.ts +1 -1
  19. package/dist/types/compile-header.d.ts.map +1 -0
  20. package/dist/types/compile-instructions.d.ts +1 -1
  21. package/dist/types/compile-instructions.d.ts.map +1 -0
  22. package/dist/types/compile-lifetime-token.d.ts +1 -1
  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 +3 -3
  27. package/dist/types/compile-transaction.d.ts.map +1 -0
  28. package/dist/types/create-transaction.d.ts +1 -1
  29. package/dist/types/create-transaction.d.ts.map +1 -0
  30. package/dist/types/decompile-transaction.d.ts +3 -3
  31. package/dist/types/decompile-transaction.d.ts.map +1 -0
  32. package/dist/types/durable-nonce.d.ts +2 -2
  33. package/dist/types/durable-nonce.d.ts.map +1 -0
  34. package/dist/types/fee-payer.d.ts +2 -2
  35. package/dist/types/fee-payer.d.ts.map +1 -0
  36. package/dist/types/index.d.ts +11 -11
  37. package/dist/types/index.d.ts.map +1 -0
  38. package/dist/types/instructions.d.ts +2 -2
  39. package/dist/types/instructions.d.ts.map +1 -0
  40. package/dist/types/message.d.ts +6 -6
  41. package/dist/types/message.d.ts.map +1 -0
  42. package/dist/types/serializers/address-table-lookup.d.ts +5 -5
  43. package/dist/types/serializers/address-table-lookup.d.ts.map +1 -0
  44. package/dist/types/serializers/header.d.ts +5 -5
  45. package/dist/types/serializers/header.d.ts.map +1 -0
  46. package/dist/types/serializers/index.d.ts +2 -2
  47. package/dist/types/serializers/index.d.ts.map +1 -0
  48. package/dist/types/serializers/instruction.d.ts +5 -5
  49. package/dist/types/serializers/instruction.d.ts.map +1 -0
  50. package/dist/types/serializers/message.d.ts +5 -5
  51. package/dist/types/serializers/message.d.ts.map +1 -0
  52. package/dist/types/serializers/transaction-version.d.ts +5 -5
  53. package/dist/types/serializers/transaction-version.d.ts.map +1 -0
  54. package/dist/types/serializers/transaction.d.ts +6 -6
  55. package/dist/types/serializers/transaction.d.ts.map +1 -0
  56. package/dist/types/signatures.d.ts +2 -2
  57. package/dist/types/signatures.d.ts.map +1 -0
  58. package/dist/types/types.d.ts.map +1 -0
  59. package/dist/types/unsigned-transaction.d.ts +1 -1
  60. package/dist/types/unsigned-transaction.d.ts.map +1 -0
  61. package/dist/types/wire-transaction.d.ts +1 -1
  62. package/dist/types/wire-transaction.d.ts.map +1 -0
  63. package/package.json +15 -15
  64. package/dist/index.development.js +0 -1783
  65. package/dist/index.development.js.map +0 -1
  66. package/dist/index.production.min.js +0 -31
@@ -1,13 +1,12 @@
1
1
  import { getBase58Encoder, getBase58Decoder, getBase64Decoder, getStringEncoder, getStringDecoder } from '@solana/codecs-strings';
2
2
  import { getAddressFromPublicKey, getAddressComparator, getAddressEncoder, getAddressDecoder, assertIsAddress } from '@solana/addresses';
3
- import { mapDecoder, combineCodec, mapEncoder } from '@solana/codecs-core';
3
+ import { createEncoder, mapDecoder, combineCodec, mapEncoder, createDecoder } from '@solana/codecs-core';
4
4
  import { getStructDecoder, getStructEncoder, getArrayEncoder, getArrayDecoder, getBytesEncoder, getBytesDecoder } from '@solana/codecs-data-structures';
5
5
  import { getShortU16Encoder, getShortU16Decoder, getU8Encoder, getU8Decoder } from '@solana/codecs-numbers';
6
6
  import { pipe } from '@solana/functional';
7
7
  import { signBytes } from '@solana/keys';
8
8
 
9
- // ../build-scripts/env-shim.ts
10
- var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
9
+ // src/blockhash.ts
11
10
 
12
11
  // src/unsigned-transaction.ts
13
12
  function getUnsignedTransaction(transaction) {
@@ -47,6 +46,22 @@ function assertIsBlockhash(putativeBlockhash) {
47
46
  });
48
47
  }
49
48
  }
49
+ function isTransactionWithBlockhashLifetime(transaction) {
50
+ const lifetimeConstraintShapeMatches = "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.blockhash === "string" && typeof transaction.lifetimeConstraint.lastValidBlockHeight === "bigint";
51
+ if (!lifetimeConstraintShapeMatches)
52
+ return false;
53
+ try {
54
+ assertIsBlockhash(transaction.lifetimeConstraint.blockhash);
55
+ return true;
56
+ } catch {
57
+ return false;
58
+ }
59
+ }
60
+ function assertIsTransactionWithBlockhashLifetime(transaction) {
61
+ if (!isTransactionWithBlockhashLifetime(transaction)) {
62
+ throw new Error("Transaction does not have a blockhash lifetime");
63
+ }
64
+ }
50
65
  function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
51
66
  if ("lifetimeConstraint" in transaction && transaction.lifetimeConstraint.blockhash === blockhashLifetimeConstraint.blockhash && transaction.lifetimeConstraint.lastValidBlockHeight === blockhashLifetimeConstraint.lastValidBlockHeight) {
52
67
  return transaction;
@@ -465,59 +480,31 @@ function compileMessage(transaction) {
465
480
  version: transaction.version
466
481
  };
467
482
  }
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
483
  var memoizedAddressTableLookupEncoder;
473
484
  function getAddressTableLookupEncoder() {
474
485
  if (!memoizedAddressTableLookupEncoder) {
475
- memoizedAddressTableLookupEncoder = getStructEncoder(
486
+ memoizedAddressTableLookupEncoder = getStructEncoder([
487
+ ["lookupTableAddress", getAddressEncoder()],
476
488
  [
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
- ]
489
+ "writableIndices",
490
+ getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })
492
491
  ],
493
- { description: addressTableLookupDescription }
494
- );
492
+ [
493
+ "readableIndices",
494
+ getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })
495
+ ]
496
+ ]);
495
497
  }
496
498
  return memoizedAddressTableLookupEncoder;
497
499
  }
498
500
  var memoizedAddressTableLookupDecoder;
499
501
  function getAddressTableLookupDecoder() {
500
502
  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
- );
503
+ memoizedAddressTableLookupDecoder = getStructDecoder([
504
+ ["lookupTableAddress", getAddressDecoder()],
505
+ ["writableIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })],
506
+ ["readableIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })]
507
+ ]);
521
508
  }
522
509
  return memoizedAddressTableLookupDecoder;
523
510
  }
@@ -527,72 +514,34 @@ function getMemoizedU8Encoder() {
527
514
  memoizedU8Encoder = getU8Encoder();
528
515
  return memoizedU8Encoder;
529
516
  }
530
- function getMemoizedU8EncoderDescription(description) {
531
- const encoder = getMemoizedU8Encoder();
532
- return {
533
- ...encoder,
534
- description: description ?? encoder.description
535
- };
536
- }
537
517
  var memoizedU8Decoder;
538
518
  function getMemoizedU8Decoder() {
539
519
  if (!memoizedU8Decoder)
540
520
  memoizedU8Decoder = getU8Decoder();
541
521
  return memoizedU8Decoder;
542
522
  }
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
523
  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
- );
524
+ return getStructEncoder([
525
+ ["numSignerAccounts", getMemoizedU8Encoder()],
526
+ ["numReadonlySignerAccounts", getMemoizedU8Encoder()],
527
+ ["numReadonlyNonSignerAccounts", getMemoizedU8Encoder()]
528
+ ]);
565
529
  }
566
530
  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
- );
531
+ return getStructDecoder([
532
+ ["numSignerAccounts", getMemoizedU8Decoder()],
533
+ ["numReadonlySignerAccounts", getMemoizedU8Decoder()],
534
+ ["numReadonlyNonSignerAccounts", getMemoizedU8Decoder()]
535
+ ]);
577
536
  }
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
537
  var memoizedGetInstructionEncoder;
583
538
  function getInstructionEncoder() {
584
539
  if (!memoizedGetInstructionEncoder) {
585
540
  memoizedGetInstructionEncoder = mapEncoder(
586
541
  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() })]
542
+ ["programAddressIndex", getU8Encoder()],
543
+ ["accountIndices", getArrayEncoder(getU8Encoder(), { size: getShortU16Encoder() })],
544
+ ["data", getBytesEncoder({ size: getShortU16Encoder() })]
596
545
  ]),
597
546
  // Convert an instruction to have all fields defined
598
547
  (instruction) => {
@@ -614,15 +563,9 @@ function getInstructionDecoder() {
614
563
  if (!memoizedGetInstructionDecoder) {
615
564
  memoizedGetInstructionDecoder = mapDecoder(
616
565
  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() })]
566
+ ["programAddressIndex", getU8Decoder()],
567
+ ["accountIndices", getArrayDecoder(getU8Decoder(), { size: getShortU16Decoder() })],
568
+ ["data", getBytesDecoder({ size: getShortU16Decoder() })]
626
569
  ]),
627
570
  // Convert an instruction to exclude optional fields if they are empty
628
571
  (instruction) => {
@@ -641,47 +584,38 @@ function getInstructionDecoder() {
641
584
  return memoizedGetInstructionDecoder;
642
585
  }
643
586
  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]);
587
+ function getTransactionVersionEncoder() {
588
+ return createEncoder({
589
+ getSizeFromValue: (value) => value === "legacy" ? 0 : 1,
590
+ maxSize: 1,
591
+ write: (value, bytes, offset) => {
592
+ if (value === "legacy") {
593
+ return offset;
594
+ }
595
+ if (value < 0 || value > 127) {
596
+ throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`);
597
+ }
598
+ bytes.set([value | VERSION_FLAG_MASK], offset);
599
+ return offset + 1;
600
+ }
601
+ });
666
602
  }
667
603
  function getTransactionVersionDecoder() {
668
- return {
669
- ...BASE_CONFIG,
670
- decode
671
- };
672
- }
673
- function getTransactionVersionEncoder() {
674
- return {
675
- ...BASE_CONFIG,
676
- encode
677
- };
604
+ return createDecoder({
605
+ maxSize: 1,
606
+ read: (bytes, offset) => {
607
+ const firstByte = bytes[offset];
608
+ if ((firstByte & VERSION_FLAG_MASK) === 0) {
609
+ return ["legacy", offset];
610
+ } else {
611
+ const version = firstByte ^ VERSION_FLAG_MASK;
612
+ return [version, offset + 1];
613
+ }
614
+ }
615
+ });
678
616
  }
679
617
 
680
618
  // 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
619
  function getCompiledMessageLegacyEncoder() {
686
620
  return getStructEncoder(getPreludeStructEncoderTuple());
687
621
  }
@@ -706,98 +640,52 @@ function getPreludeStructEncoderTuple() {
706
640
  return [
707
641
  ["version", getTransactionVersionEncoder()],
708
642
  ["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
- ]
643
+ ["staticAccounts", getArrayEncoder(getAddressEncoder(), { size: getShortU16Encoder() })],
644
+ ["lifetimeToken", getStringEncoder({ encoding: getBase58Encoder(), size: 32 })],
645
+ ["instructions", getArrayEncoder(getInstructionEncoder(), { size: getShortU16Encoder() })]
731
646
  ];
732
647
  }
733
648
  function getPreludeStructDecoderTuple() {
734
649
  return [
735
650
  ["version", getTransactionVersionDecoder()],
736
651
  ["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
- ],
652
+ ["staticAccounts", getArrayDecoder(getAddressDecoder(), { size: getShortU16Decoder() })],
653
+ ["lifetimeToken", getStringDecoder({ encoding: getBase58Decoder(), size: 32 })],
654
+ ["instructions", getArrayDecoder(getInstructionDecoder(), { size: getShortU16Decoder() })],
759
655
  ["addressTableLookups", getAddressTableLookupArrayDecoder()]
760
656
  ];
761
657
  }
762
658
  function getAddressTableLookupArrayEncoder() {
763
- return getArrayEncoder(getAddressTableLookupEncoder(), {
764
- description: addressTableLookupsDescription,
765
- size: getShortU16Encoder()
766
- });
659
+ return getArrayEncoder(getAddressTableLookupEncoder(), { size: getShortU16Encoder() });
767
660
  }
768
661
  function getAddressTableLookupArrayDecoder() {
769
- return getArrayDecoder(getAddressTableLookupDecoder(), {
770
- description: addressTableLookupsDescription,
771
- size: getShortU16Decoder()
772
- });
662
+ return getArrayDecoder(getAddressTableLookupDecoder(), { size: getShortU16Decoder() });
773
663
  }
774
- var messageDescription = __DEV__ ? "The wire format of a Solana transaction message" : "message";
775
664
  function getCompiledMessageEncoder() {
776
- return {
777
- description: messageDescription,
778
- encode: (compiledMessage) => {
665
+ return createEncoder({
666
+ getSizeFromValue: (compiledMessage) => {
779
667
  if (compiledMessage.version === "legacy") {
780
- return getCompiledMessageLegacyEncoder().encode(compiledMessage);
668
+ return getCompiledMessageLegacyEncoder().getSizeFromValue(compiledMessage);
781
669
  } else {
782
- return getCompiledMessageVersionedEncoder().encode(compiledMessage);
670
+ return getCompiledMessageVersionedEncoder().getSizeFromValue(compiledMessage);
783
671
  }
784
672
  },
785
- fixedSize: null,
786
- maxSize: null
787
- };
673
+ write: (compiledMessage, bytes, offset) => {
674
+ if (compiledMessage.version === "legacy") {
675
+ return getCompiledMessageLegacyEncoder().write(compiledMessage, bytes, offset);
676
+ } else {
677
+ return getCompiledMessageVersionedEncoder().write(compiledMessage, bytes, offset);
678
+ }
679
+ }
680
+ });
788
681
  }
789
682
  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 };
683
+ return mapDecoder(getStructDecoder(getPreludeStructDecoderTuple()), ({ addressTableLookups, ...restOfMessage }) => {
684
+ if (restOfMessage.version === "legacy" || !addressTableLookups?.length) {
685
+ return restOfMessage;
799
686
  }
800
- );
687
+ return { ...restOfMessage, addressTableLookups };
688
+ });
801
689
  }
802
690
  function getCompiledMessageCodec() {
803
691
  return combineCodec(getCompiledMessageEncoder(), getCompiledMessageDecoder());
@@ -932,44 +820,22 @@ function decompileTransaction(compiledTransaction, lastValidBlockHeight) {
932
820
  }
933
821
 
934
822
  // 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
823
  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);
824
+ return getStructEncoder([
825
+ ["signatures", getArrayEncoder(getBytesEncoder({ size: 64 }), { size: getShortU16Encoder() })],
826
+ ["compiledMessage", getCompiledMessageEncoder()]
827
+ ]);
956
828
  }
957
829
  function getCompiledTransactionDecoder() {
958
- return getStructDecoder(
830
+ return getStructDecoder([
959
831
  [
960
- [
961
- "signatures",
962
- getArrayDecoder(getSignatureDecoder(), {
963
- description: signaturesDescription,
964
- size: getShortU16Decoder()
965
- })
966
- ],
967
- ["compiledMessage", getCompiledMessageDecoder()]
832
+ "signatures",
833
+ getArrayDecoder(getBytesDecoder({ size: 64 }), {
834
+ size: getShortU16Decoder()
835
+ })
968
836
  ],
969
- {
970
- description: transactionDescription
971
- }
972
- );
837
+ ["compiledMessage", getCompiledMessageDecoder()]
838
+ ]);
973
839
  }
974
840
  function getTransactionEncoder() {
975
841
  return mapEncoder(getCompiledTransactionEncoder(), getCompiledTransaction);
@@ -993,7 +859,7 @@ function getSignatureFromTransaction(transaction) {
993
859
  "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
994
860
  );
995
861
  }
996
- const transactionSignature = base58Decoder.decode(signatureBytes)[0];
862
+ const transactionSignature = base58Decoder.decode(signatureBytes);
997
863
  return transactionSignature;
998
864
  }
999
865
  async function partiallySignTransaction(keyPairs, transaction) {
@@ -1032,9 +898,9 @@ function assertTransactionIsFullySigned(transaction) {
1032
898
  }
1033
899
  function getBase64EncodedWireTransaction(transaction) {
1034
900
  const wireTransactionBytes = getTransactionEncoder().encode(transaction);
1035
- return getBase64Decoder().decode(wireTransactionBytes)[0];
901
+ return getBase64Decoder().decode(wireTransactionBytes);
1036
902
  }
1037
903
 
1038
- export { appendTransactionInstruction, assertIsBlockhash, assertIsDurableNonceTransaction, assertTransactionIsFullySigned, compileMessage, createTransaction, getBase64EncodedWireTransaction, getCompiledMessageCodec, getCompiledMessageDecoder, getCompiledMessageEncoder, getSignatureFromTransaction, getTransactionCodec, getTransactionDecoder, getTransactionEncoder, isAdvanceNonceAccountInstruction, partiallySignTransaction, prependTransactionInstruction, setTransactionFeePayer, setTransactionLifetimeUsingBlockhash, setTransactionLifetimeUsingDurableNonce, signTransaction };
904
+ export { appendTransactionInstruction, assertIsBlockhash, assertIsDurableNonceTransaction, assertIsTransactionWithBlockhashLifetime, assertTransactionIsFullySigned, compileMessage, createTransaction, getBase64EncodedWireTransaction, getCompiledMessageCodec, getCompiledMessageDecoder, getCompiledMessageEncoder, getSignatureFromTransaction, getTransactionCodec, getTransactionDecoder, getTransactionEncoder, isAdvanceNonceAccountInstruction, partiallySignTransaction, prependTransactionInstruction, setTransactionFeePayer, setTransactionLifetimeUsingBlockhash, setTransactionLifetimeUsingDurableNonce, signTransaction };
1039
905
  //# sourceMappingURL=out.js.map
1040
906
  //# sourceMappingURL=index.node.js.map