@solana/transactions 2.0.0-experimental.b755749 → 2.0.0-experimental.b7674ea
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 +1 -43
- package/dist/index.browser.cjs +9 -49
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +11 -47
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +20 -60
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +9 -47
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +9 -49
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +9 -47
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +12 -14
- package/dist/types/accounts.d.ts +2 -2
- package/dist/types/accounts.d.ts.map +1 -0
- package/dist/types/blockhash.d.ts.map +1 -0
- package/dist/types/compilable-transaction.d.ts +3 -2
- package/dist/types/compilable-transaction.d.ts.map +1 -0
- package/dist/types/compile-address-table-lookups.d.ts +2 -2
- package/dist/types/compile-address-table-lookups.d.ts.map +1 -0
- package/dist/types/compile-header.d.ts.map +1 -0
- package/dist/types/compile-instructions.d.ts.map +1 -0
- package/dist/types/compile-lifetime-token.d.ts.map +1 -0
- package/dist/types/compile-static-accounts.d.ts +2 -2
- package/dist/types/compile-static-accounts.d.ts.map +1 -0
- package/dist/types/compile-transaction.d.ts +2 -2
- package/dist/types/compile-transaction.d.ts.map +1 -0
- package/dist/types/create-transaction.d.ts.map +1 -0
- package/dist/types/decompile-transaction.d.ts.map +1 -0
- package/dist/types/durable-nonce.d.ts +3 -3
- package/dist/types/durable-nonce.d.ts.map +1 -0
- package/dist/types/fee-payer.d.ts +4 -4
- package/dist/types/fee-payer.d.ts.map +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/instructions.d.ts.map +1 -0
- package/dist/types/message.d.ts.map +1 -0
- package/dist/types/serializers/address-table-lookup.d.ts.map +1 -0
- package/dist/types/serializers/header.d.ts.map +1 -0
- package/dist/types/serializers/index.d.ts.map +1 -0
- package/dist/types/serializers/instruction.d.ts.map +1 -0
- package/dist/types/serializers/message.d.ts.map +1 -0
- package/dist/types/serializers/transaction-version.d.ts.map +1 -0
- package/dist/types/serializers/transaction.d.ts.map +1 -0
- package/dist/types/signatures.d.ts +6 -11
- package/dist/types/signatures.d.ts.map +1 -0
- package/dist/types/types.d.ts +6 -13
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/unsigned-transaction.d.ts.map +1 -0
- package/dist/types/wire-transaction.d.ts.map +1 -0
- package/package.json +11 -11
|
@@ -787,35 +787,35 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
787
787
|
memoizedBase58Decoder = getBase58Decoder();
|
|
788
788
|
return memoizedBase58Decoder;
|
|
789
789
|
}
|
|
790
|
-
function assertIsAddress(
|
|
790
|
+
function assertIsAddress(putativeAddress) {
|
|
791
791
|
try {
|
|
792
792
|
if (
|
|
793
793
|
// Lowest address (32 bytes of zeroes)
|
|
794
|
-
|
|
795
|
-
|
|
794
|
+
putativeAddress.length < 32 || // Highest address (32 bytes of 255)
|
|
795
|
+
putativeAddress.length > 44
|
|
796
796
|
) {
|
|
797
797
|
throw new Error("Expected input string to decode to a byte array of length 32.");
|
|
798
798
|
}
|
|
799
|
-
const
|
|
800
|
-
const bytes =
|
|
799
|
+
const base58Encoder2 = getMemoizedBase58Encoder();
|
|
800
|
+
const bytes = base58Encoder2.encode(putativeAddress);
|
|
801
801
|
const numBytes = bytes.byteLength;
|
|
802
802
|
if (numBytes !== 32) {
|
|
803
803
|
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
804
804
|
}
|
|
805
805
|
} catch (e2) {
|
|
806
|
-
throw new Error(`\`${
|
|
806
|
+
throw new Error(`\`${putativeAddress}\` is not a base-58 encoded address`, {
|
|
807
807
|
cause: e2
|
|
808
808
|
});
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
|
-
function address(
|
|
812
|
-
assertIsAddress(
|
|
813
|
-
return
|
|
811
|
+
function address(putativeAddress) {
|
|
812
|
+
assertIsAddress(putativeAddress);
|
|
813
|
+
return putativeAddress;
|
|
814
814
|
}
|
|
815
815
|
function getAddressEncoder(config) {
|
|
816
816
|
return mapEncoder(
|
|
817
817
|
getStringEncoder({
|
|
818
|
-
description: config?.description ?? "
|
|
818
|
+
description: config?.description ?? "Address",
|
|
819
819
|
encoding: getMemoizedBase58Encoder(),
|
|
820
820
|
size: 32
|
|
821
821
|
}),
|
|
@@ -824,7 +824,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
824
824
|
}
|
|
825
825
|
function getAddressDecoder(config) {
|
|
826
826
|
return getStringDecoder({
|
|
827
|
-
description: config?.description ?? "
|
|
827
|
+
description: config?.description ?? "Address",
|
|
828
828
|
encoding: getMemoizedBase58Decoder(),
|
|
829
829
|
size: 32
|
|
830
830
|
});
|
|
@@ -1657,47 +1657,7 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1657
1657
|
}
|
|
1658
1658
|
|
|
1659
1659
|
// src/signatures.ts
|
|
1660
|
-
var base58Encoder2;
|
|
1661
1660
|
var base58Decoder;
|
|
1662
|
-
function assertIsTransactionSignature(putativeTransactionSignature) {
|
|
1663
|
-
if (!base58Encoder2)
|
|
1664
|
-
base58Encoder2 = getBase58Encoder();
|
|
1665
|
-
try {
|
|
1666
|
-
if (
|
|
1667
|
-
// Lowest value (64 bytes of zeroes)
|
|
1668
|
-
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
|
|
1669
|
-
putativeTransactionSignature.length > 88
|
|
1670
|
-
) {
|
|
1671
|
-
throw new Error("Expected input string to decode to a byte array of length 64.");
|
|
1672
|
-
}
|
|
1673
|
-
const bytes = base58Encoder2.encode(putativeTransactionSignature);
|
|
1674
|
-
const numBytes = bytes.byteLength;
|
|
1675
|
-
if (numBytes !== 64) {
|
|
1676
|
-
throw new Error(`Expected input string to decode to a byte array of length 64. Actual length: ${numBytes}`);
|
|
1677
|
-
}
|
|
1678
|
-
} catch (e2) {
|
|
1679
|
-
throw new Error(`\`${putativeTransactionSignature}\` is not a transaction signature`, {
|
|
1680
|
-
cause: e2
|
|
1681
|
-
});
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
function isTransactionSignature(putativeTransactionSignature) {
|
|
1685
|
-
if (!base58Encoder2)
|
|
1686
|
-
base58Encoder2 = getBase58Encoder();
|
|
1687
|
-
if (
|
|
1688
|
-
// Lowest value (64 bytes of zeroes)
|
|
1689
|
-
putativeTransactionSignature.length < 64 || // Highest value (64 bytes of 255)
|
|
1690
|
-
putativeTransactionSignature.length > 88
|
|
1691
|
-
) {
|
|
1692
|
-
return false;
|
|
1693
|
-
}
|
|
1694
|
-
const bytes = base58Encoder2.encode(putativeTransactionSignature);
|
|
1695
|
-
const numBytes = bytes.byteLength;
|
|
1696
|
-
if (numBytes !== 64) {
|
|
1697
|
-
return false;
|
|
1698
|
-
}
|
|
1699
|
-
return true;
|
|
1700
|
-
}
|
|
1701
1661
|
function getSignatureFromTransaction(transaction) {
|
|
1702
1662
|
if (!base58Decoder)
|
|
1703
1663
|
base58Decoder = getBase58Decoder();
|
|
@@ -1707,10 +1667,10 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1707
1667
|
"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer."
|
|
1708
1668
|
);
|
|
1709
1669
|
}
|
|
1710
|
-
const
|
|
1711
|
-
return
|
|
1670
|
+
const transactionSignature = base58Decoder.decode(signatureBytes)[0];
|
|
1671
|
+
return transactionSignature;
|
|
1712
1672
|
}
|
|
1713
|
-
async function
|
|
1673
|
+
async function partiallySignTransaction(keyPairs, transaction) {
|
|
1714
1674
|
const compiledMessage = compileMessage(transaction);
|
|
1715
1675
|
const nextSignatures = "signatures" in transaction ? { ...transaction.signatures } : {};
|
|
1716
1676
|
const wireMessageBytes = getCompiledMessageEncoder().encode(compiledMessage);
|
|
@@ -1729,9 +1689,11 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1729
1689
|
Object.freeze(out);
|
|
1730
1690
|
return out;
|
|
1731
1691
|
}
|
|
1732
|
-
function
|
|
1733
|
-
|
|
1734
|
-
|
|
1692
|
+
async function signTransaction(keyPairs, transaction) {
|
|
1693
|
+
const out = await partiallySignTransaction(keyPairs, transaction);
|
|
1694
|
+
assertTransactionIsFullySigned(out);
|
|
1695
|
+
Object.freeze(out);
|
|
1696
|
+
return out;
|
|
1735
1697
|
}
|
|
1736
1698
|
function assertTransactionIsFullySigned(transaction) {
|
|
1737
1699
|
const signerAddressesFromInstructions = transaction.instructions.flatMap((i) => i.accounts?.filter((a) => isSignerRole(a.role)) ?? []).map((a) => a.address);
|
|
@@ -1754,7 +1716,6 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1754
1716
|
exports.appendTransactionInstruction = appendTransactionInstruction;
|
|
1755
1717
|
exports.assertIsBlockhash = assertIsBlockhash;
|
|
1756
1718
|
exports.assertIsDurableNonceTransaction = assertIsDurableNonceTransaction;
|
|
1757
|
-
exports.assertIsTransactionSignature = assertIsTransactionSignature;
|
|
1758
1719
|
exports.assertTransactionIsFullySigned = assertTransactionIsFullySigned;
|
|
1759
1720
|
exports.createTransaction = createTransaction;
|
|
1760
1721
|
exports.getBase64EncodedWireTransaction = getBase64EncodedWireTransaction;
|
|
@@ -1763,13 +1724,12 @@ this.globalThis.solanaWeb3 = (function (exports) {
|
|
|
1763
1724
|
exports.getTransactionDecoder = getTransactionDecoder;
|
|
1764
1725
|
exports.getTransactionEncoder = getTransactionEncoder;
|
|
1765
1726
|
exports.isAdvanceNonceAccountInstruction = isAdvanceNonceAccountInstruction;
|
|
1766
|
-
exports.
|
|
1727
|
+
exports.partiallySignTransaction = partiallySignTransaction;
|
|
1767
1728
|
exports.prependTransactionInstruction = prependTransactionInstruction;
|
|
1768
1729
|
exports.setTransactionFeePayer = setTransactionFeePayer;
|
|
1769
1730
|
exports.setTransactionLifetimeUsingBlockhash = setTransactionLifetimeUsingBlockhash;
|
|
1770
1731
|
exports.setTransactionLifetimeUsingDurableNonce = setTransactionLifetimeUsingDurableNonce;
|
|
1771
1732
|
exports.signTransaction = signTransaction;
|
|
1772
|
-
exports.transactionSignature = transactionSignature;
|
|
1773
1733
|
|
|
1774
1734
|
return exports;
|
|
1775
1735
|
|