@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.
- package/dist/index.browser.cjs +115 -246
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +114 -248
- package/dist/index.browser.js.map +1 -1
- package/dist/index.native.js +114 -248
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +113 -246
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +114 -248
- package/dist/index.node.js.map +1 -1
- package/dist/types/accounts.d.ts.map +1 -0
- package/dist/types/blockhash.d.ts +4 -3
- package/dist/types/blockhash.d.ts.map +1 -0
- package/dist/types/compilable-transaction.d.ts +4 -4
- package/dist/types/compilable-transaction.d.ts.map +1 -0
- package/dist/types/compile-address-table-lookups.d.ts +1 -1
- package/dist/types/compile-address-table-lookups.d.ts.map +1 -0
- package/dist/types/compile-header.d.ts +1 -1
- package/dist/types/compile-header.d.ts.map +1 -0
- package/dist/types/compile-instructions.d.ts +1 -1
- package/dist/types/compile-instructions.d.ts.map +1 -0
- package/dist/types/compile-lifetime-token.d.ts +1 -1
- package/dist/types/compile-lifetime-token.d.ts.map +1 -0
- package/dist/types/compile-static-accounts.d.ts +1 -1
- package/dist/types/compile-static-accounts.d.ts.map +1 -0
- package/dist/types/compile-transaction.d.ts +3 -3
- package/dist/types/compile-transaction.d.ts.map +1 -0
- package/dist/types/create-transaction.d.ts +1 -1
- package/dist/types/create-transaction.d.ts.map +1 -0
- package/dist/types/decompile-transaction.d.ts +3 -3
- package/dist/types/decompile-transaction.d.ts.map +1 -0
- package/dist/types/durable-nonce.d.ts +2 -2
- package/dist/types/durable-nonce.d.ts.map +1 -0
- package/dist/types/fee-payer.d.ts +2 -2
- package/dist/types/fee-payer.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -11
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/instructions.d.ts +2 -2
- package/dist/types/instructions.d.ts.map +1 -0
- package/dist/types/message.d.ts +6 -6
- package/dist/types/message.d.ts.map +1 -0
- package/dist/types/serializers/address-table-lookup.d.ts +5 -5
- package/dist/types/serializers/address-table-lookup.d.ts.map +1 -0
- package/dist/types/serializers/header.d.ts +5 -5
- package/dist/types/serializers/header.d.ts.map +1 -0
- package/dist/types/serializers/index.d.ts +2 -2
- package/dist/types/serializers/index.d.ts.map +1 -0
- package/dist/types/serializers/instruction.d.ts +5 -5
- package/dist/types/serializers/instruction.d.ts.map +1 -0
- package/dist/types/serializers/message.d.ts +5 -5
- package/dist/types/serializers/message.d.ts.map +1 -0
- package/dist/types/serializers/transaction-version.d.ts +5 -5
- package/dist/types/serializers/transaction-version.d.ts.map +1 -0
- package/dist/types/serializers/transaction.d.ts +6 -6
- package/dist/types/serializers/transaction.d.ts.map +1 -0
- package/dist/types/signatures.d.ts +2 -2
- package/dist/types/signatures.d.ts.map +1 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/unsigned-transaction.d.ts +1 -1
- package/dist/types/unsigned-transaction.d.ts.map +1 -0
- package/dist/types/wire-transaction.d.ts +1 -1
- package/dist/types/wire-transaction.d.ts.map +1 -0
- package/package.json +15 -15
- package/dist/index.development.js +0 -1783
- package/dist/index.development.js.map +0 -1
- package/dist/index.production.min.js +0 -31
package/dist/index.browser.cjs
CHANGED
|
@@ -8,8 +8,7 @@ var codecsNumbers = require('@solana/codecs-numbers');
|
|
|
8
8
|
var functional = require('@solana/functional');
|
|
9
9
|
var keys = require('@solana/keys');
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
|
|
11
|
+
// src/blockhash.ts
|
|
13
12
|
|
|
14
13
|
// src/unsigned-transaction.ts
|
|
15
14
|
function getUnsignedTransaction(transaction) {
|
|
@@ -49,6 +48,22 @@ function assertIsBlockhash(putativeBlockhash) {
|
|
|
49
48
|
});
|
|
50
49
|
}
|
|
51
50
|
}
|
|
51
|
+
function isTransactionWithBlockhashLifetime(transaction) {
|
|
52
|
+
const lifetimeConstraintShapeMatches = "lifetimeConstraint" in transaction && typeof transaction.lifetimeConstraint.blockhash === "string" && typeof transaction.lifetimeConstraint.lastValidBlockHeight === "bigint";
|
|
53
|
+
if (!lifetimeConstraintShapeMatches)
|
|
54
|
+
return false;
|
|
55
|
+
try {
|
|
56
|
+
assertIsBlockhash(transaction.lifetimeConstraint.blockhash);
|
|
57
|
+
return true;
|
|
58
|
+
} catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function assertIsTransactionWithBlockhashLifetime(transaction) {
|
|
63
|
+
if (!isTransactionWithBlockhashLifetime(transaction)) {
|
|
64
|
+
throw new Error("Transaction does not have a blockhash lifetime");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
52
67
|
function setTransactionLifetimeUsingBlockhash(blockhashLifetimeConstraint, transaction) {
|
|
53
68
|
if ("lifetimeConstraint" in transaction && transaction.lifetimeConstraint.blockhash === blockhashLifetimeConstraint.blockhash && transaction.lifetimeConstraint.lastValidBlockHeight === blockhashLifetimeConstraint.lastValidBlockHeight) {
|
|
54
69
|
return transaction;
|
|
@@ -467,59 +482,31 @@ function compileMessage(transaction) {
|
|
|
467
482
|
version: transaction.version
|
|
468
483
|
};
|
|
469
484
|
}
|
|
470
|
-
var lookupTableAddressDescription = __DEV__ ? "The address of the address lookup table account from which instruction addresses should be looked up" : "lookupTableAddress";
|
|
471
|
-
var writableIndicesDescription = __DEV__ ? "The indices of the accounts in the lookup table that should be loaded as writeable" : "writableIndices";
|
|
472
|
-
var readableIndicesDescription = __DEV__ ? "The indices of the accounts in the lookup table that should be loaded as read-only" : "readableIndices";
|
|
473
|
-
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";
|
|
474
485
|
var memoizedAddressTableLookupEncoder;
|
|
475
486
|
function getAddressTableLookupEncoder() {
|
|
476
487
|
if (!memoizedAddressTableLookupEncoder) {
|
|
477
|
-
memoizedAddressTableLookupEncoder = codecsDataStructures.getStructEncoder(
|
|
488
|
+
memoizedAddressTableLookupEncoder = codecsDataStructures.getStructEncoder([
|
|
489
|
+
["lookupTableAddress", addresses.getAddressEncoder()],
|
|
478
490
|
[
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
"writableIndices",
|
|
482
|
-
codecsDataStructures.getArrayEncoder(codecsNumbers.getU8Encoder(), {
|
|
483
|
-
description: writableIndicesDescription,
|
|
484
|
-
size: codecsNumbers.getShortU16Encoder()
|
|
485
|
-
})
|
|
486
|
-
],
|
|
487
|
-
[
|
|
488
|
-
"readableIndices",
|
|
489
|
-
codecsDataStructures.getArrayEncoder(codecsNumbers.getU8Encoder(), {
|
|
490
|
-
description: readableIndicesDescription,
|
|
491
|
-
size: codecsNumbers.getShortU16Encoder()
|
|
492
|
-
})
|
|
493
|
-
]
|
|
491
|
+
"writableIndices",
|
|
492
|
+
codecsDataStructures.getArrayEncoder(codecsNumbers.getU8Encoder(), { size: codecsNumbers.getShortU16Encoder() })
|
|
494
493
|
],
|
|
495
|
-
|
|
496
|
-
|
|
494
|
+
[
|
|
495
|
+
"readableIndices",
|
|
496
|
+
codecsDataStructures.getArrayEncoder(codecsNumbers.getU8Encoder(), { size: codecsNumbers.getShortU16Encoder() })
|
|
497
|
+
]
|
|
498
|
+
]);
|
|
497
499
|
}
|
|
498
500
|
return memoizedAddressTableLookupEncoder;
|
|
499
501
|
}
|
|
500
502
|
var memoizedAddressTableLookupDecoder;
|
|
501
503
|
function getAddressTableLookupDecoder() {
|
|
502
504
|
if (!memoizedAddressTableLookupDecoder) {
|
|
503
|
-
memoizedAddressTableLookupDecoder = codecsDataStructures.getStructDecoder(
|
|
504
|
-
[
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
codecsDataStructures.getArrayDecoder(codecsNumbers.getU8Decoder(), {
|
|
509
|
-
description: writableIndicesDescription,
|
|
510
|
-
size: codecsNumbers.getShortU16Decoder()
|
|
511
|
-
})
|
|
512
|
-
],
|
|
513
|
-
[
|
|
514
|
-
"readableIndices",
|
|
515
|
-
codecsDataStructures.getArrayDecoder(codecsNumbers.getU8Decoder(), {
|
|
516
|
-
description: readableIndicesDescription,
|
|
517
|
-
size: codecsNumbers.getShortU16Decoder()
|
|
518
|
-
})
|
|
519
|
-
]
|
|
520
|
-
],
|
|
521
|
-
{ description: addressTableLookupDescription }
|
|
522
|
-
);
|
|
505
|
+
memoizedAddressTableLookupDecoder = codecsDataStructures.getStructDecoder([
|
|
506
|
+
["lookupTableAddress", addresses.getAddressDecoder()],
|
|
507
|
+
["writableIndices", codecsDataStructures.getArrayDecoder(codecsNumbers.getU8Decoder(), { size: codecsNumbers.getShortU16Decoder() })],
|
|
508
|
+
["readableIndices", codecsDataStructures.getArrayDecoder(codecsNumbers.getU8Decoder(), { size: codecsNumbers.getShortU16Decoder() })]
|
|
509
|
+
]);
|
|
523
510
|
}
|
|
524
511
|
return memoizedAddressTableLookupDecoder;
|
|
525
512
|
}
|
|
@@ -529,72 +516,34 @@ function getMemoizedU8Encoder() {
|
|
|
529
516
|
memoizedU8Encoder = codecsNumbers.getU8Encoder();
|
|
530
517
|
return memoizedU8Encoder;
|
|
531
518
|
}
|
|
532
|
-
function getMemoizedU8EncoderDescription(description) {
|
|
533
|
-
const encoder = getMemoizedU8Encoder();
|
|
534
|
-
return {
|
|
535
|
-
...encoder,
|
|
536
|
-
description: description ?? encoder.description
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
519
|
var memoizedU8Decoder;
|
|
540
520
|
function getMemoizedU8Decoder() {
|
|
541
521
|
if (!memoizedU8Decoder)
|
|
542
522
|
memoizedU8Decoder = codecsNumbers.getU8Decoder();
|
|
543
523
|
return memoizedU8Decoder;
|
|
544
524
|
}
|
|
545
|
-
function getMemoizedU8DecoderDescription(description) {
|
|
546
|
-
const decoder = getMemoizedU8Decoder();
|
|
547
|
-
return {
|
|
548
|
-
...decoder,
|
|
549
|
-
description: description ?? decoder.description
|
|
550
|
-
};
|
|
551
|
-
}
|
|
552
|
-
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;
|
|
553
|
-
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;
|
|
554
|
-
var numReadonlyNonSignerAccountsDescription = __DEV__ ? "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable" : void 0;
|
|
555
|
-
var messageHeaderDescription = __DEV__ ? "The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses" : void 0;
|
|
556
525
|
function getMessageHeaderEncoder() {
|
|
557
|
-
return codecsDataStructures.getStructEncoder(
|
|
558
|
-
[
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
],
|
|
563
|
-
{
|
|
564
|
-
description: messageHeaderDescription
|
|
565
|
-
}
|
|
566
|
-
);
|
|
526
|
+
return codecsDataStructures.getStructEncoder([
|
|
527
|
+
["numSignerAccounts", getMemoizedU8Encoder()],
|
|
528
|
+
["numReadonlySignerAccounts", getMemoizedU8Encoder()],
|
|
529
|
+
["numReadonlyNonSignerAccounts", getMemoizedU8Encoder()]
|
|
530
|
+
]);
|
|
567
531
|
}
|
|
568
532
|
function getMessageHeaderDecoder() {
|
|
569
|
-
return codecsDataStructures.getStructDecoder(
|
|
570
|
-
[
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
],
|
|
575
|
-
{
|
|
576
|
-
description: messageHeaderDescription
|
|
577
|
-
}
|
|
578
|
-
);
|
|
533
|
+
return codecsDataStructures.getStructDecoder([
|
|
534
|
+
["numSignerAccounts", getMemoizedU8Decoder()],
|
|
535
|
+
["numReadonlySignerAccounts", getMemoizedU8Decoder()],
|
|
536
|
+
["numReadonlyNonSignerAccounts", getMemoizedU8Decoder()]
|
|
537
|
+
]);
|
|
579
538
|
}
|
|
580
|
-
var programAddressIndexDescription = __DEV__ ? "The index of the program being called, according to the well-ordered accounts list for this transaction" : "programAddressIndex";
|
|
581
|
-
var accountIndexDescription = __DEV__ ? "The index of an account, according to the well-ordered accounts list for this transaction" : void 0;
|
|
582
|
-
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";
|
|
583
|
-
var dataDescription = __DEV__ ? "An optional buffer of data passed to the instruction" : "data";
|
|
584
539
|
var memoizedGetInstructionEncoder;
|
|
585
540
|
function getInstructionEncoder() {
|
|
586
541
|
if (!memoizedGetInstructionEncoder) {
|
|
587
542
|
memoizedGetInstructionEncoder = codecsCore.mapEncoder(
|
|
588
543
|
codecsDataStructures.getStructEncoder([
|
|
589
|
-
["programAddressIndex", codecsNumbers.getU8Encoder(
|
|
590
|
-
[
|
|
591
|
-
|
|
592
|
-
codecsDataStructures.getArrayEncoder(codecsNumbers.getU8Encoder({ description: accountIndexDescription }), {
|
|
593
|
-
description: accountIndicesDescription,
|
|
594
|
-
size: codecsNumbers.getShortU16Encoder()
|
|
595
|
-
})
|
|
596
|
-
],
|
|
597
|
-
["data", codecsDataStructures.getBytesEncoder({ description: dataDescription, size: codecsNumbers.getShortU16Encoder() })]
|
|
544
|
+
["programAddressIndex", codecsNumbers.getU8Encoder()],
|
|
545
|
+
["accountIndices", codecsDataStructures.getArrayEncoder(codecsNumbers.getU8Encoder(), { size: codecsNumbers.getShortU16Encoder() })],
|
|
546
|
+
["data", codecsDataStructures.getBytesEncoder({ size: codecsNumbers.getShortU16Encoder() })]
|
|
598
547
|
]),
|
|
599
548
|
// Convert an instruction to have all fields defined
|
|
600
549
|
(instruction) => {
|
|
@@ -616,15 +565,9 @@ function getInstructionDecoder() {
|
|
|
616
565
|
if (!memoizedGetInstructionDecoder) {
|
|
617
566
|
memoizedGetInstructionDecoder = codecsCore.mapDecoder(
|
|
618
567
|
codecsDataStructures.getStructDecoder([
|
|
619
|
-
["programAddressIndex", codecsNumbers.getU8Decoder(
|
|
620
|
-
[
|
|
621
|
-
|
|
622
|
-
codecsDataStructures.getArrayDecoder(codecsNumbers.getU8Decoder({ description: accountIndexDescription }), {
|
|
623
|
-
description: accountIndicesDescription,
|
|
624
|
-
size: codecsNumbers.getShortU16Decoder()
|
|
625
|
-
})
|
|
626
|
-
],
|
|
627
|
-
["data", codecsDataStructures.getBytesDecoder({ description: dataDescription, size: codecsNumbers.getShortU16Decoder() })]
|
|
568
|
+
["programAddressIndex", codecsNumbers.getU8Decoder()],
|
|
569
|
+
["accountIndices", codecsDataStructures.getArrayDecoder(codecsNumbers.getU8Decoder(), { size: codecsNumbers.getShortU16Decoder() })],
|
|
570
|
+
["data", codecsDataStructures.getBytesDecoder({ size: codecsNumbers.getShortU16Decoder() })]
|
|
628
571
|
]),
|
|
629
572
|
// Convert an instruction to exclude optional fields if they are empty
|
|
630
573
|
(instruction) => {
|
|
@@ -643,47 +586,38 @@ function getInstructionDecoder() {
|
|
|
643
586
|
return memoizedGetInstructionDecoder;
|
|
644
587
|
}
|
|
645
588
|
var VERSION_FLAG_MASK = 128;
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
if (value === "legacy") {
|
|
662
|
-
return new Uint8Array();
|
|
663
|
-
}
|
|
664
|
-
if (value < 0 || value > 127) {
|
|
665
|
-
throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`);
|
|
666
|
-
}
|
|
667
|
-
return new Uint8Array([value | VERSION_FLAG_MASK]);
|
|
589
|
+
function getTransactionVersionEncoder() {
|
|
590
|
+
return codecsCore.createEncoder({
|
|
591
|
+
getSizeFromValue: (value) => value === "legacy" ? 0 : 1,
|
|
592
|
+
maxSize: 1,
|
|
593
|
+
write: (value, bytes, offset) => {
|
|
594
|
+
if (value === "legacy") {
|
|
595
|
+
return offset;
|
|
596
|
+
}
|
|
597
|
+
if (value < 0 || value > 127) {
|
|
598
|
+
throw new Error(`Transaction version must be in the range [0, 127]. \`${value}\` given.`);
|
|
599
|
+
}
|
|
600
|
+
bytes.set([value | VERSION_FLAG_MASK], offset);
|
|
601
|
+
return offset + 1;
|
|
602
|
+
}
|
|
603
|
+
});
|
|
668
604
|
}
|
|
669
605
|
function getTransactionVersionDecoder() {
|
|
670
|
-
return {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
606
|
+
return codecsCore.createDecoder({
|
|
607
|
+
maxSize: 1,
|
|
608
|
+
read: (bytes, offset) => {
|
|
609
|
+
const firstByte = bytes[offset];
|
|
610
|
+
if ((firstByte & VERSION_FLAG_MASK) === 0) {
|
|
611
|
+
return ["legacy", offset];
|
|
612
|
+
} else {
|
|
613
|
+
const version = firstByte ^ VERSION_FLAG_MASK;
|
|
614
|
+
return [version, offset + 1];
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
});
|
|
680
618
|
}
|
|
681
619
|
|
|
682
620
|
// src/serializers/message.ts
|
|
683
|
-
var staticAccountsDescription = __DEV__ ? "A compact-array of static account addresses belonging to this transaction" : "staticAccounts";
|
|
684
|
-
var lifetimeTokenDescription = __DEV__ ? "A 32-byte token that specifies the lifetime of this transaction (eg. a recent blockhash, or a durable nonce)" : "lifetimeToken";
|
|
685
|
-
var instructionsDescription = __DEV__ ? "A compact-array of instructions belonging to this transaction" : "instructions";
|
|
686
|
-
var addressTableLookupsDescription = __DEV__ ? "A compact array of address table lookups belonging to this transaction" : "addressTableLookups";
|
|
687
621
|
function getCompiledMessageLegacyEncoder() {
|
|
688
622
|
return codecsDataStructures.getStructEncoder(getPreludeStructEncoderTuple());
|
|
689
623
|
}
|
|
@@ -708,98 +642,52 @@ function getPreludeStructEncoderTuple() {
|
|
|
708
642
|
return [
|
|
709
643
|
["version", getTransactionVersionEncoder()],
|
|
710
644
|
["header", getMessageHeaderEncoder()],
|
|
711
|
-
[
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
description: staticAccountsDescription,
|
|
715
|
-
size: codecsNumbers.getShortU16Encoder()
|
|
716
|
-
})
|
|
717
|
-
],
|
|
718
|
-
[
|
|
719
|
-
"lifetimeToken",
|
|
720
|
-
codecsStrings.getStringEncoder({
|
|
721
|
-
description: lifetimeTokenDescription,
|
|
722
|
-
encoding: codecsStrings.getBase58Encoder(),
|
|
723
|
-
size: 32
|
|
724
|
-
})
|
|
725
|
-
],
|
|
726
|
-
[
|
|
727
|
-
"instructions",
|
|
728
|
-
codecsDataStructures.getArrayEncoder(getInstructionEncoder(), {
|
|
729
|
-
description: instructionsDescription,
|
|
730
|
-
size: codecsNumbers.getShortU16Encoder()
|
|
731
|
-
})
|
|
732
|
-
]
|
|
645
|
+
["staticAccounts", codecsDataStructures.getArrayEncoder(addresses.getAddressEncoder(), { size: codecsNumbers.getShortU16Encoder() })],
|
|
646
|
+
["lifetimeToken", codecsStrings.getStringEncoder({ encoding: codecsStrings.getBase58Encoder(), size: 32 })],
|
|
647
|
+
["instructions", codecsDataStructures.getArrayEncoder(getInstructionEncoder(), { size: codecsNumbers.getShortU16Encoder() })]
|
|
733
648
|
];
|
|
734
649
|
}
|
|
735
650
|
function getPreludeStructDecoderTuple() {
|
|
736
651
|
return [
|
|
737
652
|
["version", getTransactionVersionDecoder()],
|
|
738
653
|
["header", getMessageHeaderDecoder()],
|
|
739
|
-
[
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
description: staticAccountsDescription,
|
|
743
|
-
size: codecsNumbers.getShortU16Decoder()
|
|
744
|
-
})
|
|
745
|
-
],
|
|
746
|
-
[
|
|
747
|
-
"lifetimeToken",
|
|
748
|
-
codecsStrings.getStringDecoder({
|
|
749
|
-
description: lifetimeTokenDescription,
|
|
750
|
-
encoding: codecsStrings.getBase58Decoder(),
|
|
751
|
-
size: 32
|
|
752
|
-
})
|
|
753
|
-
],
|
|
754
|
-
[
|
|
755
|
-
"instructions",
|
|
756
|
-
codecsDataStructures.getArrayDecoder(getInstructionDecoder(), {
|
|
757
|
-
description: instructionsDescription,
|
|
758
|
-
size: codecsNumbers.getShortU16Decoder()
|
|
759
|
-
})
|
|
760
|
-
],
|
|
654
|
+
["staticAccounts", codecsDataStructures.getArrayDecoder(addresses.getAddressDecoder(), { size: codecsNumbers.getShortU16Decoder() })],
|
|
655
|
+
["lifetimeToken", codecsStrings.getStringDecoder({ encoding: codecsStrings.getBase58Decoder(), size: 32 })],
|
|
656
|
+
["instructions", codecsDataStructures.getArrayDecoder(getInstructionDecoder(), { size: codecsNumbers.getShortU16Decoder() })],
|
|
761
657
|
["addressTableLookups", getAddressTableLookupArrayDecoder()]
|
|
762
658
|
];
|
|
763
659
|
}
|
|
764
660
|
function getAddressTableLookupArrayEncoder() {
|
|
765
|
-
return codecsDataStructures.getArrayEncoder(getAddressTableLookupEncoder(), {
|
|
766
|
-
description: addressTableLookupsDescription,
|
|
767
|
-
size: codecsNumbers.getShortU16Encoder()
|
|
768
|
-
});
|
|
661
|
+
return codecsDataStructures.getArrayEncoder(getAddressTableLookupEncoder(), { size: codecsNumbers.getShortU16Encoder() });
|
|
769
662
|
}
|
|
770
663
|
function getAddressTableLookupArrayDecoder() {
|
|
771
|
-
return codecsDataStructures.getArrayDecoder(getAddressTableLookupDecoder(), {
|
|
772
|
-
description: addressTableLookupsDescription,
|
|
773
|
-
size: codecsNumbers.getShortU16Decoder()
|
|
774
|
-
});
|
|
664
|
+
return codecsDataStructures.getArrayDecoder(getAddressTableLookupDecoder(), { size: codecsNumbers.getShortU16Decoder() });
|
|
775
665
|
}
|
|
776
|
-
var messageDescription = __DEV__ ? "The wire format of a Solana transaction message" : "message";
|
|
777
666
|
function getCompiledMessageEncoder() {
|
|
778
|
-
return {
|
|
779
|
-
|
|
780
|
-
encode: (compiledMessage) => {
|
|
667
|
+
return codecsCore.createEncoder({
|
|
668
|
+
getSizeFromValue: (compiledMessage) => {
|
|
781
669
|
if (compiledMessage.version === "legacy") {
|
|
782
|
-
return getCompiledMessageLegacyEncoder().
|
|
670
|
+
return getCompiledMessageLegacyEncoder().getSizeFromValue(compiledMessage);
|
|
783
671
|
} else {
|
|
784
|
-
return getCompiledMessageVersionedEncoder().
|
|
672
|
+
return getCompiledMessageVersionedEncoder().getSizeFromValue(compiledMessage);
|
|
785
673
|
}
|
|
786
674
|
},
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
675
|
+
write: (compiledMessage, bytes, offset) => {
|
|
676
|
+
if (compiledMessage.version === "legacy") {
|
|
677
|
+
return getCompiledMessageLegacyEncoder().write(compiledMessage, bytes, offset);
|
|
678
|
+
} else {
|
|
679
|
+
return getCompiledMessageVersionedEncoder().write(compiledMessage, bytes, offset);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
});
|
|
790
683
|
}
|
|
791
684
|
function getCompiledMessageDecoder() {
|
|
792
|
-
return codecsCore.mapDecoder(
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
}),
|
|
796
|
-
({ addressTableLookups, ...restOfMessage }) => {
|
|
797
|
-
if (restOfMessage.version === "legacy" || !addressTableLookups?.length) {
|
|
798
|
-
return restOfMessage;
|
|
799
|
-
}
|
|
800
|
-
return { ...restOfMessage, addressTableLookups };
|
|
685
|
+
return codecsCore.mapDecoder(codecsDataStructures.getStructDecoder(getPreludeStructDecoderTuple()), ({ addressTableLookups, ...restOfMessage }) => {
|
|
686
|
+
if (restOfMessage.version === "legacy" || !addressTableLookups?.length) {
|
|
687
|
+
return restOfMessage;
|
|
801
688
|
}
|
|
802
|
-
|
|
689
|
+
return { ...restOfMessage, addressTableLookups };
|
|
690
|
+
});
|
|
803
691
|
}
|
|
804
692
|
function getCompiledMessageCodec() {
|
|
805
693
|
return codecsCore.combineCodec(getCompiledMessageEncoder(), getCompiledMessageDecoder());
|
|
@@ -934,44 +822,22 @@ function decompileTransaction(compiledTransaction, lastValidBlockHeight) {
|
|
|
934
822
|
}
|
|
935
823
|
|
|
936
824
|
// src/serializers/transaction.ts
|
|
937
|
-
var signaturesDescription = __DEV__ ? "A compact array of 64-byte, base-64 encoded Ed25519 signatures" : "signatures";
|
|
938
|
-
var transactionDescription = __DEV__ ? "The wire format of a Solana transaction" : "transaction";
|
|
939
825
|
function getCompiledTransactionEncoder() {
|
|
940
|
-
return codecsDataStructures.getStructEncoder(
|
|
941
|
-
[
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
codecsDataStructures.getArrayEncoder(codecsDataStructures.getBytesEncoder({ size: 64 }), {
|
|
945
|
-
description: signaturesDescription,
|
|
946
|
-
size: codecsNumbers.getShortU16Encoder()
|
|
947
|
-
})
|
|
948
|
-
],
|
|
949
|
-
["compiledMessage", getCompiledMessageEncoder()]
|
|
950
|
-
],
|
|
951
|
-
{
|
|
952
|
-
description: transactionDescription
|
|
953
|
-
}
|
|
954
|
-
);
|
|
955
|
-
}
|
|
956
|
-
function getSignatureDecoder() {
|
|
957
|
-
return codecsCore.mapDecoder(codecsDataStructures.getBytesDecoder({ size: 64 }), (bytes) => bytes);
|
|
826
|
+
return codecsDataStructures.getStructEncoder([
|
|
827
|
+
["signatures", codecsDataStructures.getArrayEncoder(codecsDataStructures.getBytesEncoder({ size: 64 }), { size: codecsNumbers.getShortU16Encoder() })],
|
|
828
|
+
["compiledMessage", getCompiledMessageEncoder()]
|
|
829
|
+
]);
|
|
958
830
|
}
|
|
959
831
|
function getCompiledTransactionDecoder() {
|
|
960
|
-
return codecsDataStructures.getStructDecoder(
|
|
832
|
+
return codecsDataStructures.getStructDecoder([
|
|
961
833
|
[
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
size: codecsNumbers.getShortU16Decoder()
|
|
967
|
-
})
|
|
968
|
-
],
|
|
969
|
-
["compiledMessage", getCompiledMessageDecoder()]
|
|
834
|
+
"signatures",
|
|
835
|
+
codecsDataStructures.getArrayDecoder(codecsDataStructures.getBytesDecoder({ size: 64 }), {
|
|
836
|
+
size: codecsNumbers.getShortU16Decoder()
|
|
837
|
+
})
|
|
970
838
|
],
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
}
|
|
974
|
-
);
|
|
839
|
+
["compiledMessage", getCompiledMessageDecoder()]
|
|
840
|
+
]);
|
|
975
841
|
}
|
|
976
842
|
function getTransactionEncoder() {
|
|
977
843
|
return codecsCore.mapEncoder(getCompiledTransactionEncoder(), getCompiledTransaction);
|
|
@@ -995,7 +861,7 @@ function getSignatureFromTransaction(transaction) {
|
|
|
995
861
|
"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
|
|
996
862
|
);
|
|
997
863
|
}
|
|
998
|
-
const transactionSignature = base58Decoder.decode(signatureBytes)
|
|
864
|
+
const transactionSignature = base58Decoder.decode(signatureBytes);
|
|
999
865
|
return transactionSignature;
|
|
1000
866
|
}
|
|
1001
867
|
async function partiallySignTransaction(keyPairs, transaction) {
|
|
@@ -1034,12 +900,13 @@ function assertTransactionIsFullySigned(transaction) {
|
|
|
1034
900
|
}
|
|
1035
901
|
function getBase64EncodedWireTransaction(transaction) {
|
|
1036
902
|
const wireTransactionBytes = getTransactionEncoder().encode(transaction);
|
|
1037
|
-
return codecsStrings.getBase64Decoder().decode(wireTransactionBytes)
|
|
903
|
+
return codecsStrings.getBase64Decoder().decode(wireTransactionBytes);
|
|
1038
904
|
}
|
|
1039
905
|
|
|
1040
906
|
exports.appendTransactionInstruction = appendTransactionInstruction;
|
|
1041
907
|
exports.assertIsBlockhash = assertIsBlockhash;
|
|
1042
908
|
exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
|
|
909
|
+
exports.assertIsTransactionWithBlockhashLifetime = assertIsTransactionWithBlockhashLifetime;
|
|
1043
910
|
exports.assertTransactionIsFullySigned = assertTransactionIsFullySigned;
|
|
1044
911
|
exports.compileMessage = compileMessage;
|
|
1045
912
|
exports.createTransaction = createTransaction;
|
|
@@ -1058,3 +925,5 @@ exports.setTransactionFeePayer = setTransactionFeePayer;
|
|
|
1058
925
|
exports.setTransactionLifetimeUsingBlockhash = setTransactionLifetimeUsingBlockhash;
|
|
1059
926
|
exports.setTransactionLifetimeUsingDurableNonce = setTransactionLifetimeUsingDurableNonce;
|
|
1060
927
|
exports.signTransaction = signTransaction;
|
|
928
|
+
//# sourceMappingURL=out.js.map
|
|
929
|
+
//# sourceMappingURL=index.browser.cjs.map
|