@solana/transactions 2.0.0-experimental.dacecb7 → 2.0.0-experimental.df45965
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/README.md +314 -5
- package/dist/index.browser.cjs +170 -217
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +172 -220
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +643 -649
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +172 -218
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +172 -215
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +172 -220
- 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/durable-nonce.d.ts.map +1 -1
- package/dist/types/serializers/address-table-lookup.d.ts +5 -3
- package/dist/types/serializers/address-table-lookup.d.ts.map +1 -1
- package/dist/types/serializers/header.d.ts +4 -2
- package/dist/types/serializers/header.d.ts.map +1 -1
- package/dist/types/serializers/instruction.d.ts +4 -2
- package/dist/types/serializers/instruction.d.ts.map +1 -1
- package/dist/types/serializers/message.d.ts +4 -4
- package/dist/types/serializers/message.d.ts.map +1 -1
- package/dist/types/serializers/transaction-version.d.ts +4 -4
- package/dist/types/serializers/transaction-version.d.ts.map +1 -1
- package/dist/types/serializers/transaction.d.ts +5 -4
- package/dist/types/serializers/transaction.d.ts.map +1 -1
- package/dist/types/signatures.d.ts.map +1 -1
- package/dist/types/wire-transaction.d.ts +1 -1
- package/dist/types/wire-transaction.d.ts.map +1 -1
- package/package.json +11 -7
- package/dist/types/serializers/unimplemented.d.ts +0 -3
- package/dist/types/serializers/unimplemented.d.ts.map +0 -1
package/dist/index.browser.cjs
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var umiSerializers = require('@metaplex-foundation/umi-serializers');
|
|
4
|
+
var codecsCore = require('@solana/codecs-core');
|
|
5
|
+
var codecsDataStructures = require('@solana/codecs-data-structures');
|
|
6
|
+
var codecsNumbers = require('@solana/codecs-numbers');
|
|
4
7
|
var addresses = require('@solana/addresses');
|
|
8
|
+
var codecsStrings = require('@solana/codecs-strings');
|
|
5
9
|
var keys = require('@solana/keys');
|
|
6
10
|
|
|
7
11
|
// ../build-scripts/env-shim.ts
|
|
@@ -31,8 +35,8 @@ function assertIsBlockhash(putativeBlockhash) {
|
|
|
31
35
|
) {
|
|
32
36
|
throw new Error("Expected input string to decode to a byte array of length 32.");
|
|
33
37
|
}
|
|
34
|
-
const
|
|
35
|
-
const numBytes =
|
|
38
|
+
const bytes = umiSerializers.base58.serialize(putativeBlockhash);
|
|
39
|
+
const numBytes = bytes.byteLength;
|
|
36
40
|
if (numBytes !== 32) {
|
|
37
41
|
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
38
42
|
}
|
|
@@ -462,159 +466,106 @@ function getCompiledTransaction(transaction) {
|
|
|
462
466
|
signatures
|
|
463
467
|
};
|
|
464
468
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
} : void 0
|
|
474
|
-
)
|
|
475
|
-
],
|
|
469
|
+
var lookupTableAddressDescription = __DEV__ ? "The address of the address lookup table account from which instruction addresses should be looked up" : "lookupTableAddress";
|
|
470
|
+
var writableIndicesDescription = __DEV__ ? "The indices of the accounts in the lookup table that should be loaded as writeable" : "writableIndices";
|
|
471
|
+
var readableIndicesDescription = __DEV__ ? "The indices of the accounts in the lookup table that should be loaded as read-only" : "readableIndices";
|
|
472
|
+
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";
|
|
473
|
+
var memoizedAddressTableLookupEncoder;
|
|
474
|
+
function getAddressTableLookupEncoder() {
|
|
475
|
+
if (!memoizedAddressTableLookupEncoder) {
|
|
476
|
+
memoizedAddressTableLookupEncoder = codecsDataStructures.getStructEncoder(
|
|
476
477
|
[
|
|
477
|
-
"
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
478
|
+
["lookupTableAddress", addresses.getAddressEncoder({ description: lookupTableAddressDescription })],
|
|
479
|
+
[
|
|
480
|
+
"writableIndices",
|
|
481
|
+
codecsDataStructures.getArrayEncoder(codecsNumbers.getU8Encoder(), {
|
|
482
|
+
description: writableIndicesDescription,
|
|
483
|
+
size: codecsNumbers.getShortU16Encoder()
|
|
484
|
+
})
|
|
485
|
+
],
|
|
486
|
+
[
|
|
487
|
+
"readableIndices",
|
|
488
|
+
codecsDataStructures.getArrayEncoder(codecsNumbers.getU8Encoder(), {
|
|
489
|
+
description: readableIndicesDescription,
|
|
490
|
+
size: codecsNumbers.getShortU16Encoder()
|
|
491
|
+
})
|
|
492
|
+
]
|
|
484
493
|
],
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
__DEV__ ? {
|
|
496
|
-
description: "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"
|
|
497
|
-
} : void 0
|
|
498
|
-
);
|
|
494
|
+
{ description: addressTableLookupDescription }
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
return memoizedAddressTableLookupEncoder;
|
|
498
|
+
}
|
|
499
|
+
var memoizedU8Encoder;
|
|
500
|
+
function getMemoizedU8Encoder() {
|
|
501
|
+
if (!memoizedU8Encoder)
|
|
502
|
+
memoizedU8Encoder = codecsNumbers.getU8Encoder();
|
|
503
|
+
return memoizedU8Encoder;
|
|
499
504
|
}
|
|
500
|
-
function
|
|
501
|
-
|
|
505
|
+
function getMemoizedU8EncoderDescription(description) {
|
|
506
|
+
const encoder = getMemoizedU8Encoder();
|
|
507
|
+
return {
|
|
508
|
+
...encoder,
|
|
509
|
+
description: description ?? encoder.description
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
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;
|
|
513
|
+
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;
|
|
514
|
+
var numReadonlyNonSignerAccountsDescription = __DEV__ ? "The expected number of addresses in the static address list belonging to accounts that are neither signers, nor writable" : void 0;
|
|
515
|
+
var messageHeaderDescription = __DEV__ ? "The transaction message header containing counts of the signer, readonly-signer, and readonly-nonsigner account addresses" : void 0;
|
|
516
|
+
function getMessageHeaderEncoder() {
|
|
517
|
+
return codecsDataStructures.getStructEncoder(
|
|
502
518
|
[
|
|
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
|
-
]
|
|
519
|
+
["numSignerAccounts", getMemoizedU8EncoderDescription(numSignerAccountsDescription)],
|
|
520
|
+
["numReadonlySignerAccounts", getMemoizedU8EncoderDescription(numReadonlySignerAccountsDescription)],
|
|
521
|
+
["numReadonlyNonSignerAccounts", getMemoizedU8EncoderDescription(numReadonlyNonSignerAccountsDescription)]
|
|
527
522
|
],
|
|
528
|
-
|
|
529
|
-
description:
|
|
530
|
-
} : void 0
|
|
531
|
-
);
|
|
532
|
-
}
|
|
533
|
-
function getInstructionCodec() {
|
|
534
|
-
return umiSerializers.mapSerializer(
|
|
535
|
-
umiSerializers.struct([
|
|
536
|
-
[
|
|
537
|
-
"programAddressIndex",
|
|
538
|
-
umiSerializers.u8(
|
|
539
|
-
__DEV__ ? {
|
|
540
|
-
description: "The index of the program being called, according to the well-ordered accounts list for this transaction"
|
|
541
|
-
} : void 0
|
|
542
|
-
)
|
|
543
|
-
],
|
|
544
|
-
[
|
|
545
|
-
"accountIndices",
|
|
546
|
-
umiSerializers.array(
|
|
547
|
-
umiSerializers.u8({
|
|
548
|
-
description: __DEV__ ? "The index of an account, according to the well-ordered accounts list for this transaction" : ""
|
|
549
|
-
}),
|
|
550
|
-
{
|
|
551
|
-
description: __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" : "",
|
|
552
|
-
size: umiSerializers.shortU16()
|
|
553
|
-
}
|
|
554
|
-
)
|
|
555
|
-
],
|
|
556
|
-
[
|
|
557
|
-
"data",
|
|
558
|
-
umiSerializers.bytes({
|
|
559
|
-
description: __DEV__ ? "An optional buffer of data passed to the instruction" : "",
|
|
560
|
-
size: umiSerializers.shortU16()
|
|
561
|
-
})
|
|
562
|
-
]
|
|
563
|
-
]),
|
|
564
|
-
(value) => {
|
|
565
|
-
if (value.accountIndices !== void 0 && value.data !== void 0) {
|
|
566
|
-
return value;
|
|
567
|
-
}
|
|
568
|
-
return {
|
|
569
|
-
...value,
|
|
570
|
-
accountIndices: value.accountIndices ?? [],
|
|
571
|
-
data: value.data ?? new Uint8Array(0)
|
|
572
|
-
};
|
|
573
|
-
},
|
|
574
|
-
(value) => {
|
|
575
|
-
if (value.accountIndices.length && value.data.byteLength) {
|
|
576
|
-
return value;
|
|
577
|
-
}
|
|
578
|
-
const { accountIndices, data, ...rest } = value;
|
|
579
|
-
return {
|
|
580
|
-
...rest,
|
|
581
|
-
...accountIndices.length ? { accountIndices } : null,
|
|
582
|
-
...data.byteLength ? { data } : null
|
|
583
|
-
};
|
|
523
|
+
{
|
|
524
|
+
description: messageHeaderDescription
|
|
584
525
|
}
|
|
585
526
|
);
|
|
586
527
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
)
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
528
|
+
var programAddressIndexDescription = __DEV__ ? "The index of the program being called, according to the well-ordered accounts list for this transaction" : "programAddressIndex";
|
|
529
|
+
var accountIndexDescription = __DEV__ ? "The index of an account, according to the well-ordered accounts list for this transaction" : void 0;
|
|
530
|
+
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";
|
|
531
|
+
var dataDescription = __DEV__ ? "An optional buffer of data passed to the instruction" : "data";
|
|
532
|
+
var memoizedGetInstructionEncoder;
|
|
533
|
+
function getInstructionEncoder() {
|
|
534
|
+
if (!memoizedGetInstructionEncoder) {
|
|
535
|
+
memoizedGetInstructionEncoder = codecsCore.mapEncoder(
|
|
536
|
+
codecsDataStructures.getStructEncoder([
|
|
537
|
+
["programAddressIndex", codecsNumbers.getU8Encoder({ description: programAddressIndexDescription })],
|
|
538
|
+
[
|
|
539
|
+
"accountIndices",
|
|
540
|
+
codecsDataStructures.getArrayEncoder(codecsNumbers.getU8Encoder({ description: accountIndexDescription }), {
|
|
541
|
+
description: accountIndicesDescription,
|
|
542
|
+
size: codecsNumbers.getShortU16Encoder()
|
|
543
|
+
})
|
|
544
|
+
],
|
|
545
|
+
["data", codecsDataStructures.getBytesEncoder({ description: dataDescription, size: codecsNumbers.getShortU16Encoder() })]
|
|
546
|
+
]),
|
|
547
|
+
// Convert an instruction to have all fields defined
|
|
548
|
+
(instruction) => {
|
|
549
|
+
if (instruction.accountIndices !== void 0 && instruction.data !== void 0) {
|
|
550
|
+
return instruction;
|
|
551
|
+
}
|
|
552
|
+
return {
|
|
553
|
+
...instruction,
|
|
554
|
+
accountIndices: instruction.accountIndices ?? [],
|
|
555
|
+
data: instruction.data ?? new Uint8Array(0)
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
return memoizedGetInstructionEncoder;
|
|
599
561
|
}
|
|
600
|
-
|
|
601
|
-
// src/serializers/transaction-version.ts
|
|
602
562
|
var VERSION_FLAG_MASK = 128;
|
|
603
563
|
var BASE_CONFIG = {
|
|
604
564
|
description: __DEV__ ? "A single byte that encodes the version of the transaction" : "",
|
|
605
565
|
fixedSize: null,
|
|
606
566
|
maxSize: 1
|
|
607
567
|
};
|
|
608
|
-
function
|
|
609
|
-
const firstByte = bytes3[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
|
-
function serialize(value) {
|
|
568
|
+
function encode(value) {
|
|
618
569
|
if (value === "legacy") {
|
|
619
570
|
return new Uint8Array();
|
|
620
571
|
}
|
|
@@ -623,108 +574,110 @@ function serialize(value) {
|
|
|
623
574
|
}
|
|
624
575
|
return new Uint8Array([value | VERSION_FLAG_MASK]);
|
|
625
576
|
}
|
|
626
|
-
function
|
|
577
|
+
function getTransactionVersionEncoder() {
|
|
627
578
|
return {
|
|
628
579
|
...BASE_CONFIG,
|
|
629
|
-
|
|
630
|
-
serialize
|
|
580
|
+
encode
|
|
631
581
|
};
|
|
632
582
|
}
|
|
633
583
|
|
|
634
584
|
// src/serializers/message.ts
|
|
635
|
-
var
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
(value)
|
|
650
|
-
|
|
651
|
-
return value;
|
|
652
|
-
}
|
|
653
|
-
return {
|
|
654
|
-
...value,
|
|
655
|
-
addressTableLookups: value.addressTableLookups ?? []
|
|
656
|
-
};
|
|
585
|
+
var staticAccountsDescription = __DEV__ ? "A compact-array of static account addresses belonging to this transaction" : "staticAccounts";
|
|
586
|
+
var lifetimeTokenDescription = __DEV__ ? "A 32-byte token that specifies the lifetime of this transaction (eg. a recent blockhash, or a durable nonce)" : "lifetimeToken";
|
|
587
|
+
var instructionsDescription = __DEV__ ? "A compact-array of instructions belonging to this transaction" : "instructions";
|
|
588
|
+
var addressTableLookupsDescription = __DEV__ ? "A compact array of address table lookups belonging to this transaction" : "addressTableLookups";
|
|
589
|
+
function getCompiledMessageLegacyEncoder() {
|
|
590
|
+
return codecsDataStructures.getStructEncoder(getPreludeStructEncoderTuple());
|
|
591
|
+
}
|
|
592
|
+
function getCompiledMessageVersionedEncoder() {
|
|
593
|
+
return codecsCore.mapEncoder(
|
|
594
|
+
codecsDataStructures.getStructEncoder([
|
|
595
|
+
...getPreludeStructEncoderTuple(),
|
|
596
|
+
["addressTableLookups", getAddressTableLookupArrayEncoder()]
|
|
597
|
+
]),
|
|
598
|
+
(value) => {
|
|
599
|
+
if (value.version === "legacy") {
|
|
600
|
+
return value;
|
|
657
601
|
}
|
|
658
|
-
|
|
659
|
-
|
|
602
|
+
return {
|
|
603
|
+
...value,
|
|
604
|
+
addressTableLookups: value.addressTableLookups ?? []
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
);
|
|
660
608
|
}
|
|
661
|
-
function
|
|
609
|
+
function getPreludeStructEncoderTuple() {
|
|
662
610
|
return [
|
|
663
|
-
["version",
|
|
664
|
-
["header",
|
|
611
|
+
["version", getTransactionVersionEncoder()],
|
|
612
|
+
["header", getMessageHeaderEncoder()],
|
|
665
613
|
[
|
|
666
614
|
"staticAccounts",
|
|
667
|
-
|
|
668
|
-
description:
|
|
669
|
-
size:
|
|
615
|
+
codecsDataStructures.getArrayEncoder(addresses.getAddressEncoder(), {
|
|
616
|
+
description: staticAccountsDescription,
|
|
617
|
+
size: codecsNumbers.getShortU16Encoder()
|
|
670
618
|
})
|
|
671
619
|
],
|
|
672
620
|
[
|
|
673
621
|
"lifetimeToken",
|
|
674
|
-
|
|
675
|
-
description:
|
|
676
|
-
encoding:
|
|
622
|
+
codecsStrings.getStringEncoder({
|
|
623
|
+
description: lifetimeTokenDescription,
|
|
624
|
+
encoding: codecsStrings.getBase58Encoder(),
|
|
677
625
|
size: 32
|
|
678
626
|
})
|
|
679
627
|
],
|
|
680
628
|
[
|
|
681
629
|
"instructions",
|
|
682
|
-
|
|
683
|
-
description:
|
|
684
|
-
size:
|
|
630
|
+
codecsDataStructures.getArrayEncoder(getInstructionEncoder(), {
|
|
631
|
+
description: instructionsDescription,
|
|
632
|
+
size: codecsNumbers.getShortU16Encoder()
|
|
685
633
|
})
|
|
686
634
|
]
|
|
687
635
|
];
|
|
688
636
|
}
|
|
689
|
-
function
|
|
690
|
-
return
|
|
691
|
-
|
|
692
|
-
size:
|
|
637
|
+
function getAddressTableLookupArrayEncoder() {
|
|
638
|
+
return codecsDataStructures.getArrayEncoder(getAddressTableLookupEncoder(), {
|
|
639
|
+
description: addressTableLookupsDescription,
|
|
640
|
+
size: codecsNumbers.getShortU16Encoder()
|
|
693
641
|
});
|
|
694
642
|
}
|
|
643
|
+
var messageDescription = __DEV__ ? "The wire format of a Solana transaction message" : "message";
|
|
695
644
|
function getCompiledMessageEncoder() {
|
|
696
645
|
return {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
646
|
+
description: messageDescription,
|
|
647
|
+
encode: (compiledMessage) => {
|
|
648
|
+
if (compiledMessage.version === "legacy") {
|
|
649
|
+
return getCompiledMessageLegacyEncoder().encode(compiledMessage);
|
|
650
|
+
} else {
|
|
651
|
+
return getCompiledMessageVersionedEncoder().encode(compiledMessage);
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
fixedSize: null,
|
|
655
|
+
maxSize: null
|
|
700
656
|
};
|
|
701
657
|
}
|
|
702
658
|
|
|
703
659
|
// src/serializers/transaction.ts
|
|
704
|
-
var
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
};
|
|
709
|
-
function serialize3(transaction) {
|
|
710
|
-
const compiledTransaction = getCompiledTransaction(transaction);
|
|
711
|
-
return umiSerializers.struct([
|
|
660
|
+
var transactionDescription = __DEV__ ? "The wire format of a Solana transaction" : "transaction";
|
|
661
|
+
var signaturesDescription = __DEV__ ? "A compact array of 64-byte, base-64 encoded Ed25519 signatures" : "signatures";
|
|
662
|
+
function getCompiledTransactionEncoder() {
|
|
663
|
+
return codecsDataStructures.getStructEncoder(
|
|
712
664
|
[
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
665
|
+
[
|
|
666
|
+
"signatures",
|
|
667
|
+
codecsDataStructures.getArrayEncoder(codecsDataStructures.getBytesEncoder({ size: 64 }), {
|
|
668
|
+
description: signaturesDescription,
|
|
669
|
+
size: codecsNumbers.getShortU16Encoder()
|
|
670
|
+
})
|
|
671
|
+
],
|
|
672
|
+
["compiledMessage", getCompiledMessageEncoder()]
|
|
718
673
|
],
|
|
719
|
-
|
|
720
|
-
|
|
674
|
+
{
|
|
675
|
+
description: transactionDescription
|
|
676
|
+
}
|
|
677
|
+
);
|
|
721
678
|
}
|
|
722
679
|
function getTransactionEncoder() {
|
|
723
|
-
return
|
|
724
|
-
...BASE_CONFIG3,
|
|
725
|
-
deserialize: getUnimplementedDecoder("CompiledMessage"),
|
|
726
|
-
serialize: serialize3
|
|
727
|
-
};
|
|
680
|
+
return codecsCore.mapEncoder(getCompiledTransactionEncoder(), getCompiledTransaction);
|
|
728
681
|
}
|
|
729
682
|
function assertIsTransactionSignature(putativeTransactionSignature) {
|
|
730
683
|
try {
|
|
@@ -735,8 +688,8 @@ function assertIsTransactionSignature(putativeTransactionSignature) {
|
|
|
735
688
|
) {
|
|
736
689
|
throw new Error("Expected input string to decode to a byte array of length 64.");
|
|
737
690
|
}
|
|
738
|
-
const
|
|
739
|
-
const numBytes =
|
|
691
|
+
const bytes = umiSerializers.base58.serialize(putativeTransactionSignature);
|
|
692
|
+
const numBytes = bytes.byteLength;
|
|
740
693
|
if (numBytes !== 64) {
|
|
741
694
|
throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
|
|
742
695
|
}
|
|
@@ -754,26 +707,27 @@ function isTransactionSignature(putativeTransactionSignature) {
|
|
|
754
707
|
) {
|
|
755
708
|
return false;
|
|
756
709
|
}
|
|
757
|
-
const
|
|
758
|
-
const numBytes =
|
|
710
|
+
const bytes = umiSerializers.base58.serialize(putativeTransactionSignature);
|
|
711
|
+
const numBytes = bytes.byteLength;
|
|
759
712
|
if (numBytes !== 64) {
|
|
760
713
|
return false;
|
|
761
714
|
}
|
|
762
715
|
return true;
|
|
763
716
|
}
|
|
764
717
|
async function getCompiledMessageSignature(message, secretKey) {
|
|
765
|
-
const wireMessageBytes = getCompiledMessageEncoder().
|
|
718
|
+
const wireMessageBytes = getCompiledMessageEncoder().encode(message);
|
|
766
719
|
const signature = await keys.signBytes(secretKey, wireMessageBytes);
|
|
767
720
|
return signature;
|
|
768
721
|
}
|
|
769
722
|
function getSignatureFromTransaction(transaction) {
|
|
770
|
-
const
|
|
771
|
-
if (!
|
|
723
|
+
const signatureBytes = transaction.signatures[transaction.feePayer];
|
|
724
|
+
if (!signatureBytes) {
|
|
772
725
|
throw new Error(
|
|
773
726
|
"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
|
|
774
727
|
);
|
|
775
728
|
}
|
|
776
|
-
|
|
729
|
+
const transactionSignature2 = umiSerializers.base58.deserialize(signatureBytes)[0];
|
|
730
|
+
return transactionSignature2;
|
|
777
731
|
}
|
|
778
732
|
async function signTransaction(keyPairs, transaction) {
|
|
779
733
|
const compiledMessage = compileMessage(transaction);
|
|
@@ -803,7 +757,7 @@ function transactionSignature(putativeTransactionSignature) {
|
|
|
803
757
|
|
|
804
758
|
// src/wire-transaction.ts
|
|
805
759
|
function getBase64EncodedWireTransaction(transaction) {
|
|
806
|
-
const wireTransactionBytes = getTransactionEncoder().
|
|
760
|
+
const wireTransactionBytes = getTransactionEncoder().encode(transaction);
|
|
807
761
|
{
|
|
808
762
|
return btoa(String.fromCharCode(...wireTransactionBytes));
|
|
809
763
|
}
|
|
@@ -817,6 +771,7 @@ exports.createTransaction = createTransaction;
|
|
|
817
771
|
exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
|
|
818
772
|
exports.getSignatureFromTransaction = getSignatureFromTransaction;
|
|
819
773
|
exports.getTransactionEncoder = getTransactionEncoder;
|
|
774
|
+
exports.isAdvanceNonceAccountInstruction = isAdvanceNonceAccountInstruction;
|
|
820
775
|
exports.isTransactionSignature = isTransactionSignature;
|
|
821
776
|
exports.prependTransactionInstruction = prependTransactionInstruction;
|
|
822
777
|
exports.setTransactionFeePayer = setTransactionFeePayer;
|
|
@@ -824,5 +779,3 @@ exports.setTransactionLifetimeUsingBlockhash = setTransactionLifetimeUsingBlockh
|
|
|
824
779
|
exports.setTransactionLifetimeUsingDurableNonce = setTransactionLifetimeUsingDurableNonce;
|
|
825
780
|
exports.signTransaction = signTransaction;
|
|
826
781
|
exports.transactionSignature = transactionSignature;
|
|
827
|
-
//# sourceMappingURL=out.js.map
|
|
828
|
-
//# sourceMappingURL=index.browser.cjs.map
|