@solana/transactions 2.0.0-experimental.cc545f9 → 2.0.0-experimental.ce145c8
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 +201 -149
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +203 -152
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +820 -162
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +203 -152
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +203 -147
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +203 -152
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +17 -16
- package/dist/types/durable-nonce.d.ts +1 -0
- package/dist/types/serializers/address-table-lookup.d.ts +5 -3
- package/dist/types/serializers/header.d.ts +4 -2
- package/dist/types/serializers/instruction.d.ts +4 -2
- package/dist/types/serializers/transaction-version.d.ts +4 -4
- package/package.json +10 -7
- package/dist/types/accounts.d.ts.map +0 -1
- package/dist/types/blockhash.d.ts.map +0 -1
- package/dist/types/compile-address-table-lookups.d.ts.map +0 -1
- package/dist/types/compile-header.d.ts.map +0 -1
- package/dist/types/compile-instructions.d.ts.map +0 -1
- package/dist/types/compile-lifetime-token.d.ts.map +0 -1
- package/dist/types/compile-static-accounts.d.ts.map +0 -1
- package/dist/types/compile-transaction.d.ts.map +0 -1
- package/dist/types/create-transaction.d.ts.map +0 -1
- package/dist/types/durable-nonce.d.ts.map +0 -1
- package/dist/types/fee-payer.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/instructions.d.ts.map +0 -1
- package/dist/types/message.d.ts.map +0 -1
- package/dist/types/serializers/address-table-lookup.d.ts.map +0 -1
- package/dist/types/serializers/header.d.ts.map +0 -1
- package/dist/types/serializers/index.d.ts.map +0 -1
- package/dist/types/serializers/instruction.d.ts.map +0 -1
- package/dist/types/serializers/message.d.ts.map +0 -1
- package/dist/types/serializers/transaction-version.d.ts.map +0 -1
- package/dist/types/serializers/transaction.d.ts.map +0 -1
- package/dist/types/serializers/unimplemented.d.ts.map +0 -1
- package/dist/types/signatures.d.ts.map +0 -1
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/unsigned-transaction.d.ts.map +0 -1
- package/dist/types/wire-transaction.d.ts.map +0 -1
package/dist/index.browser.cjs
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var umiSerializers = require('@metaplex-foundation/umi-serializers');
|
|
4
4
|
var addresses = require('@solana/addresses');
|
|
5
|
+
var codecsCore = require('@solana/codecs-core');
|
|
6
|
+
var codecsDataStructures = require('@solana/codecs-data-structures');
|
|
7
|
+
var codecsNumbers = require('@solana/codecs-numbers');
|
|
5
8
|
var keys = require('@solana/keys');
|
|
6
9
|
|
|
7
10
|
// ../build-scripts/env-shim.ts
|
|
@@ -31,8 +34,8 @@ function assertIsBlockhash(putativeBlockhash) {
|
|
|
31
34
|
) {
|
|
32
35
|
throw new Error("Expected input string to decode to a byte array of length 32.");
|
|
33
36
|
}
|
|
34
|
-
const
|
|
35
|
-
const numBytes =
|
|
37
|
+
const bytes2 = umiSerializers.base58.serialize(putativeBlockhash);
|
|
38
|
+
const numBytes = bytes2.byteLength;
|
|
36
39
|
if (numBytes !== 32) {
|
|
37
40
|
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
38
41
|
}
|
|
@@ -462,151 +465,170 @@ function getCompiledTransaction(transaction) {
|
|
|
462
465
|
signatures
|
|
463
466
|
};
|
|
464
467
|
}
|
|
465
|
-
|
|
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 = codecsDataStructures.getStructEncoder(
|
|
468
476
|
[
|
|
469
|
-
"lookupTableAddress",
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
477
|
+
["lookupTableAddress", addresses.getAddressEncoder({ description: lookupTableAddressDescription })],
|
|
478
|
+
[
|
|
479
|
+
"writableIndices",
|
|
480
|
+
codecsDataStructures.getArrayEncoder(codecsNumbers.getU8Encoder(), {
|
|
481
|
+
description: writableIndicesDescription,
|
|
482
|
+
size: codecsNumbers.getShortU16Encoder()
|
|
483
|
+
})
|
|
484
|
+
],
|
|
485
|
+
[
|
|
486
|
+
"readableIndices",
|
|
487
|
+
codecsDataStructures.getArrayEncoder(codecsNumbers.getU8Encoder(), {
|
|
488
|
+
description: readableIndicesDescription,
|
|
489
|
+
size: codecsNumbers.getShortU16Encoder()
|
|
490
|
+
})
|
|
491
|
+
]
|
|
475
492
|
],
|
|
493
|
+
{ description: addressTableLookupDescription }
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
return memoizedAddressTableLookupEncoder;
|
|
497
|
+
}
|
|
498
|
+
var memoizedAddressTableLookupDecoder;
|
|
499
|
+
function getAddressTableLookupDecoder() {
|
|
500
|
+
if (!memoizedAddressTableLookupDecoder) {
|
|
501
|
+
memoizedAddressTableLookupDecoder = codecsDataStructures.getStructDecoder(
|
|
476
502
|
[
|
|
477
|
-
"
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
503
|
+
["lookupTableAddress", addresses.getAddressDecoder({ description: lookupTableAddressDescription })],
|
|
504
|
+
[
|
|
505
|
+
"writableIndices",
|
|
506
|
+
codecsDataStructures.getArrayDecoder(codecsNumbers.getU8Decoder(), {
|
|
507
|
+
description: writableIndicesDescription,
|
|
508
|
+
size: codecsNumbers.getShortU16Decoder()
|
|
509
|
+
})
|
|
510
|
+
],
|
|
511
|
+
[
|
|
512
|
+
"readableIndices",
|
|
513
|
+
codecsDataStructures.getArrayDecoder(codecsNumbers.getU8Decoder(), {
|
|
514
|
+
description: readableIndicesDescription,
|
|
515
|
+
size: codecsNumbers.getShortU16Decoder()
|
|
516
|
+
})
|
|
517
|
+
]
|
|
484
518
|
],
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
519
|
+
{ description: addressTableLookupDescription }
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
return memoizedAddressTableLookupDecoder;
|
|
523
|
+
}
|
|
524
|
+
function getAddressTableLookupCodec() {
|
|
525
|
+
return codecsCore.combineCodec(getAddressTableLookupEncoder(), getAddressTableLookupDecoder());
|
|
526
|
+
}
|
|
527
|
+
var memoizedU8Codec;
|
|
528
|
+
function getMemoizedU8Codec() {
|
|
529
|
+
if (!memoizedU8Codec)
|
|
530
|
+
memoizedU8Codec = codecsNumbers.getU8Codec();
|
|
531
|
+
return memoizedU8Codec;
|
|
532
|
+
}
|
|
533
|
+
function getMemoizedU8CodecDescription(description) {
|
|
534
|
+
const codec = getMemoizedU8Codec();
|
|
535
|
+
return {
|
|
536
|
+
...codec,
|
|
537
|
+
description: description ?? codec.description
|
|
538
|
+
};
|
|
499
539
|
}
|
|
540
|
+
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;
|
|
541
|
+
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;
|
|
542
|
+
var numReadonlyNonSignerAccountsDescription = __DEV__ ? "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable" : void 0;
|
|
543
|
+
var messageHeaderDescription = __DEV__ ? "The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses" : void 0;
|
|
500
544
|
function getMessageHeaderCodec() {
|
|
501
|
-
return
|
|
545
|
+
return codecsDataStructures.getStructCodec(
|
|
502
546
|
[
|
|
503
|
-
[
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
__DEV__ ? {
|
|
507
|
-
description: "The expected number of addresses in the static address list belonging to accounts that are required to sign this transaction"
|
|
508
|
-
} : void 0
|
|
509
|
-
)
|
|
510
|
-
],
|
|
511
|
-
[
|
|
512
|
-
"numReadonlySignerAccounts",
|
|
513
|
-
umiSerializers.u8(
|
|
514
|
-
__DEV__ ? {
|
|
515
|
-
description: "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"
|
|
516
|
-
} : void 0
|
|
517
|
-
)
|
|
518
|
-
],
|
|
519
|
-
[
|
|
520
|
-
"numReadonlyNonSignerAccounts",
|
|
521
|
-
umiSerializers.u8(
|
|
522
|
-
__DEV__ ? {
|
|
523
|
-
description: "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable"
|
|
524
|
-
} : void 0
|
|
525
|
-
)
|
|
526
|
-
]
|
|
547
|
+
["numSignerAccounts", getMemoizedU8CodecDescription(numSignerAccountsDescription)],
|
|
548
|
+
["numReadonlySignerAccounts", getMemoizedU8CodecDescription(numReadonlySignerAccountsDescription)],
|
|
549
|
+
["numReadonlyNonSignerAccounts", getMemoizedU8CodecDescription(numReadonlyNonSignerAccountsDescription)]
|
|
527
550
|
],
|
|
528
|
-
|
|
529
|
-
description:
|
|
530
|
-
}
|
|
551
|
+
{
|
|
552
|
+
description: messageHeaderDescription
|
|
553
|
+
}
|
|
531
554
|
);
|
|
532
555
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
)
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
)
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
}
|
|
562
|
-
]
|
|
563
|
-
]),
|
|
564
|
-
(value) => {
|
|
565
|
-
if (value.accountIndices !== void 0 && value.data !== void 0) {
|
|
566
|
-
return value;
|
|
556
|
+
var programAddressIndexDescription = __DEV__ ? "The index of the program being called, according to the well-ordered accounts list for this transaction" : "programAddressIndex";
|
|
557
|
+
var accountIndexDescription = __DEV__ ? "The index of an account, according to the well-ordered accounts list for this transaction" : void 0;
|
|
558
|
+
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";
|
|
559
|
+
var dataDescription = __DEV__ ? "An optional buffer of data passed to the instruction" : "data";
|
|
560
|
+
var memoizedGetInstructionEncoder;
|
|
561
|
+
function getInstructionEncoder() {
|
|
562
|
+
if (!memoizedGetInstructionEncoder) {
|
|
563
|
+
memoizedGetInstructionEncoder = codecsCore.mapEncoder(
|
|
564
|
+
codecsDataStructures.getStructEncoder([
|
|
565
|
+
["programAddressIndex", codecsNumbers.getU8Encoder({ description: programAddressIndexDescription })],
|
|
566
|
+
[
|
|
567
|
+
"accountIndices",
|
|
568
|
+
codecsDataStructures.getArrayEncoder(codecsNumbers.getU8Encoder({ description: accountIndexDescription }), {
|
|
569
|
+
description: accountIndicesDescription,
|
|
570
|
+
size: codecsNumbers.getShortU16Encoder()
|
|
571
|
+
})
|
|
572
|
+
],
|
|
573
|
+
["data", codecsDataStructures.getBytesEncoder({ description: dataDescription, size: codecsNumbers.getShortU16Encoder() })]
|
|
574
|
+
]),
|
|
575
|
+
// Convert an instruction to have all fields defined
|
|
576
|
+
(instruction) => {
|
|
577
|
+
if (instruction.accountIndices !== void 0 && instruction.data !== void 0) {
|
|
578
|
+
return instruction;
|
|
579
|
+
}
|
|
580
|
+
return {
|
|
581
|
+
...instruction,
|
|
582
|
+
accountIndices: instruction.accountIndices ?? [],
|
|
583
|
+
data: instruction.data ?? new Uint8Array(0)
|
|
584
|
+
};
|
|
567
585
|
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
return memoizedGetInstructionEncoder;
|
|
589
|
+
}
|
|
590
|
+
var memoizedGetInstructionDecoder;
|
|
591
|
+
function getInstructionDecoder() {
|
|
592
|
+
if (!memoizedGetInstructionDecoder) {
|
|
593
|
+
memoizedGetInstructionDecoder = codecsCore.mapDecoder(
|
|
594
|
+
codecsDataStructures.getStructDecoder([
|
|
595
|
+
["programAddressIndex", codecsNumbers.getU8Decoder({ description: programAddressIndexDescription })],
|
|
596
|
+
[
|
|
597
|
+
"accountIndices",
|
|
598
|
+
codecsDataStructures.getArrayDecoder(codecsNumbers.getU8Decoder({ description: accountIndexDescription }), {
|
|
599
|
+
description: accountIndicesDescription,
|
|
600
|
+
size: codecsNumbers.getShortU16Decoder()
|
|
601
|
+
})
|
|
602
|
+
],
|
|
603
|
+
["data", codecsDataStructures.getBytesDecoder({ description: dataDescription, size: codecsNumbers.getShortU16Decoder() })]
|
|
604
|
+
]),
|
|
605
|
+
// Convert an instruction to exclude optional fields if they are empty
|
|
606
|
+
(instruction) => {
|
|
607
|
+
if (instruction.accountIndices.length && instruction.data.byteLength) {
|
|
608
|
+
return instruction;
|
|
609
|
+
}
|
|
610
|
+
const { accountIndices, data, ...rest } = instruction;
|
|
611
|
+
return {
|
|
612
|
+
...rest,
|
|
613
|
+
...accountIndices.length ? { accountIndices } : null,
|
|
614
|
+
...data.byteLength ? { data } : null
|
|
615
|
+
};
|
|
577
616
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
...accountIndices.length ? { accountIndices } : null,
|
|
582
|
-
...data.byteLength ? { data } : null
|
|
583
|
-
};
|
|
584
|
-
}
|
|
585
|
-
);
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
// src/serializers/unimplemented.ts
|
|
589
|
-
function getError(type, name) {
|
|
590
|
-
const functionSuffix = name + type[0].toUpperCase() + type.slice(1);
|
|
591
|
-
return new Error(
|
|
592
|
-
`No ${type} exists for ${name}. Use \`get${functionSuffix}()\` if you need a ${type}, and \`get${name}Codec()\` if you need to both encode and decode ${name}`
|
|
593
|
-
);
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
return memoizedGetInstructionDecoder;
|
|
594
620
|
}
|
|
595
|
-
function
|
|
596
|
-
return ()
|
|
597
|
-
throw getError("decoder", name);
|
|
598
|
-
};
|
|
621
|
+
function getInstructionCodec() {
|
|
622
|
+
return codecsCore.combineCodec(getInstructionEncoder(), getInstructionDecoder());
|
|
599
623
|
}
|
|
600
|
-
|
|
601
|
-
// src/serializers/transaction-version.ts
|
|
602
624
|
var VERSION_FLAG_MASK = 128;
|
|
603
625
|
var BASE_CONFIG = {
|
|
604
626
|
description: __DEV__ ? "A single byte that encodes the version of the transaction" : "",
|
|
605
627
|
fixedSize: null,
|
|
606
628
|
maxSize: 1
|
|
607
629
|
};
|
|
608
|
-
function
|
|
609
|
-
const firstByte =
|
|
630
|
+
function decode(bytes2, offset = 0) {
|
|
631
|
+
const firstByte = bytes2[offset];
|
|
610
632
|
if ((firstByte & VERSION_FLAG_MASK) === 0) {
|
|
611
633
|
return ["legacy", offset];
|
|
612
634
|
} else {
|
|
@@ -614,7 +636,7 @@ function deserialize(bytes3, offset = 0) {
|
|
|
614
636
|
return [version, offset + 1];
|
|
615
637
|
}
|
|
616
638
|
}
|
|
617
|
-
function
|
|
639
|
+
function encode(value) {
|
|
618
640
|
if (value === "legacy") {
|
|
619
641
|
return new Uint8Array();
|
|
620
642
|
}
|
|
@@ -623,11 +645,32 @@ function serialize(value) {
|
|
|
623
645
|
}
|
|
624
646
|
return new Uint8Array([value | VERSION_FLAG_MASK]);
|
|
625
647
|
}
|
|
626
|
-
function
|
|
648
|
+
function getTransactionVersionDecoder() {
|
|
627
649
|
return {
|
|
628
650
|
...BASE_CONFIG,
|
|
629
|
-
|
|
630
|
-
|
|
651
|
+
decode
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
function getTransactionVersionEncoder() {
|
|
655
|
+
return {
|
|
656
|
+
...BASE_CONFIG,
|
|
657
|
+
encode
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
function getTransactionVersionCodec() {
|
|
661
|
+
return codecsCore.combineCodec(getTransactionVersionEncoder(), getTransactionVersionDecoder());
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// src/serializers/unimplemented.ts
|
|
665
|
+
function getError(type, name) {
|
|
666
|
+
const functionSuffix = name + type[0].toUpperCase() + type.slice(1);
|
|
667
|
+
return new Error(
|
|
668
|
+
`No ${type} exists for ${name}. Use \`get${functionSuffix}()\` if you need a ${type}, and \`get${name}Codec()\` if you need to both encode and decode ${name}`
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
function getUnimplementedDecoder(name) {
|
|
672
|
+
return () => {
|
|
673
|
+
throw getError("decoder", name);
|
|
631
674
|
};
|
|
632
675
|
}
|
|
633
676
|
|
|
@@ -637,7 +680,7 @@ var BASE_CONFIG2 = {
|
|
|
637
680
|
fixedSize: null,
|
|
638
681
|
maxSize: null
|
|
639
682
|
};
|
|
640
|
-
function
|
|
683
|
+
function serialize(compiledMessage) {
|
|
641
684
|
if (compiledMessage.version === "legacy") {
|
|
642
685
|
return umiSerializers.struct(getPreludeStructSerializerTuple()).serialize(compiledMessage);
|
|
643
686
|
} else {
|
|
@@ -658,13 +701,22 @@ function serialize2(compiledMessage) {
|
|
|
658
701
|
).serialize(compiledMessage);
|
|
659
702
|
}
|
|
660
703
|
}
|
|
704
|
+
function toSerializer(codec) {
|
|
705
|
+
return {
|
|
706
|
+
description: codec.description,
|
|
707
|
+
deserialize: codec.decode,
|
|
708
|
+
fixedSize: codec.fixedSize,
|
|
709
|
+
maxSize: codec.maxSize,
|
|
710
|
+
serialize: codec.encode
|
|
711
|
+
};
|
|
712
|
+
}
|
|
661
713
|
function getPreludeStructSerializerTuple() {
|
|
662
714
|
return [
|
|
663
|
-
["version", getTransactionVersionCodec()],
|
|
664
|
-
["header", getMessageHeaderCodec()],
|
|
715
|
+
["version", toSerializer(getTransactionVersionCodec())],
|
|
716
|
+
["header", toSerializer(getMessageHeaderCodec())],
|
|
665
717
|
[
|
|
666
718
|
"staticAccounts",
|
|
667
|
-
umiSerializers.array(addresses.getAddressCodec(), {
|
|
719
|
+
umiSerializers.array(toSerializer(addresses.getAddressCodec()), {
|
|
668
720
|
description: __DEV__ ? "A compact-array of static account addresses belonging to this transaction" : "",
|
|
669
721
|
size: umiSerializers.shortU16()
|
|
670
722
|
})
|
|
@@ -679,7 +731,7 @@ function getPreludeStructSerializerTuple() {
|
|
|
679
731
|
],
|
|
680
732
|
[
|
|
681
733
|
"instructions",
|
|
682
|
-
umiSerializers.array(getInstructionCodec(), {
|
|
734
|
+
umiSerializers.array(toSerializer(getInstructionCodec()), {
|
|
683
735
|
description: __DEV__ ? "A compact-array of instructions belonging to this transaction" : "",
|
|
684
736
|
size: umiSerializers.shortU16()
|
|
685
737
|
})
|
|
@@ -687,7 +739,7 @@ function getPreludeStructSerializerTuple() {
|
|
|
687
739
|
];
|
|
688
740
|
}
|
|
689
741
|
function getAddressTableLookupsSerializer() {
|
|
690
|
-
return umiSerializers.array(getAddressTableLookupCodec(), {
|
|
742
|
+
return umiSerializers.array(toSerializer(getAddressTableLookupCodec()), {
|
|
691
743
|
...__DEV__ ? { description: "A compact array of address table lookups belonging to this transaction" } : null,
|
|
692
744
|
size: umiSerializers.shortU16()
|
|
693
745
|
});
|
|
@@ -696,7 +748,7 @@ function getCompiledMessageEncoder() {
|
|
|
696
748
|
return {
|
|
697
749
|
...BASE_CONFIG2,
|
|
698
750
|
deserialize: getUnimplementedDecoder("CompiledMessage"),
|
|
699
|
-
serialize
|
|
751
|
+
serialize
|
|
700
752
|
};
|
|
701
753
|
}
|
|
702
754
|
|
|
@@ -706,7 +758,7 @@ var BASE_CONFIG3 = {
|
|
|
706
758
|
fixedSize: null,
|
|
707
759
|
maxSize: null
|
|
708
760
|
};
|
|
709
|
-
function
|
|
761
|
+
function serialize2(transaction) {
|
|
710
762
|
const compiledTransaction = getCompiledTransaction(transaction);
|
|
711
763
|
return umiSerializers.struct([
|
|
712
764
|
[
|
|
@@ -723,7 +775,7 @@ function getTransactionEncoder() {
|
|
|
723
775
|
return {
|
|
724
776
|
...BASE_CONFIG3,
|
|
725
777
|
deserialize: getUnimplementedDecoder("CompiledMessage"),
|
|
726
|
-
serialize:
|
|
778
|
+
serialize: serialize2
|
|
727
779
|
};
|
|
728
780
|
}
|
|
729
781
|
function assertIsTransactionSignature(putativeTransactionSignature) {
|
|
@@ -735,8 +787,8 @@ function assertIsTransactionSignature(putativeTransactionSignature) {
|
|
|
735
787
|
) {
|
|
736
788
|
throw new Error("Expected input string to decode to a byte array of length 64.");
|
|
737
789
|
}
|
|
738
|
-
const
|
|
739
|
-
const numBytes =
|
|
790
|
+
const bytes2 = umiSerializers.base58.serialize(putativeTransactionSignature);
|
|
791
|
+
const numBytes = bytes2.byteLength;
|
|
740
792
|
if (numBytes !== 64) {
|
|
741
793
|
throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
|
|
742
794
|
}
|
|
@@ -754,8 +806,8 @@ function isTransactionSignature(putativeTransactionSignature) {
|
|
|
754
806
|
) {
|
|
755
807
|
return false;
|
|
756
808
|
}
|
|
757
|
-
const
|
|
758
|
-
const numBytes =
|
|
809
|
+
const bytes2 = umiSerializers.base58.serialize(putativeTransactionSignature);
|
|
810
|
+
const numBytes = bytes2.byteLength;
|
|
759
811
|
if (numBytes !== 64) {
|
|
760
812
|
return false;
|
|
761
813
|
}
|
|
@@ -767,13 +819,14 @@ async function getCompiledMessageSignature(message, secretKey) {
|
|
|
767
819
|
return signature;
|
|
768
820
|
}
|
|
769
821
|
function getSignatureFromTransaction(transaction) {
|
|
770
|
-
const
|
|
771
|
-
if (!
|
|
822
|
+
const signatureBytes = transaction.signatures[transaction.feePayer];
|
|
823
|
+
if (!signatureBytes) {
|
|
772
824
|
throw new Error(
|
|
773
825
|
"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
|
|
774
826
|
);
|
|
775
827
|
}
|
|
776
|
-
|
|
828
|
+
const transactionSignature2 = umiSerializers.base58.deserialize(signatureBytes)[0];
|
|
829
|
+
return transactionSignature2;
|
|
777
830
|
}
|
|
778
831
|
async function signTransaction(keyPairs, transaction) {
|
|
779
832
|
const compiledMessage = compileMessage(transaction);
|
|
@@ -817,6 +870,7 @@ exports.createTransaction = createTransaction;
|
|
|
817
870
|
exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
|
|
818
871
|
exports.getSignatureFromTransaction = getSignatureFromTransaction;
|
|
819
872
|
exports.getTransactionEncoder = getTransactionEncoder;
|
|
873
|
+
exports.isAdvanceNonceAccountInstruction = isAdvanceNonceAccountInstruction;
|
|
820
874
|
exports.isTransactionSignature = isTransactionSignature;
|
|
821
875
|
exports.prependTransactionInstruction = prependTransactionInstruction;
|
|
822
876
|
exports.setTransactionFeePayer = setTransactionFeePayer;
|
|
@@ -824,5 +878,3 @@ exports.setTransactionLifetimeUsingBlockhash = setTransactionLifetimeUsingBlockh
|
|
|
824
878
|
exports.setTransactionLifetimeUsingDurableNonce = setTransactionLifetimeUsingDurableNonce;
|
|
825
879
|
exports.signTransaction = signTransaction;
|
|
826
880
|
exports.transactionSignature = transactionSignature;
|
|
827
|
-
//# sourceMappingURL=out.js.map
|
|
828
|
-
//# sourceMappingURL=index.browser.cjs.map
|