@solana/web3.js 1.87.6 → 1.88.0
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 -1
- package/lib/index.browser.cjs.js +26 -12
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +26 -12
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +44 -1626
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +41 -1621
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +204 -588
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +7 -8
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +26 -12
- package/lib/index.native.js.map +1 -1
- package/package.json +29 -29
- package/src/connection.ts +4 -6
- package/src/programs/stake.ts +3 -3
- package/src/transaction/legacy.ts +37 -15
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ This library requires a JavaScript runtime that supports [`BigInt`](https://deve
|
|
|
73
73
|
|
|
74
74
|
#### Unit tests
|
|
75
75
|
|
|
76
|
-
To run the full suite of unit tests,
|
|
76
|
+
To run the full suite of unit tests, execute the following in the root:
|
|
77
77
|
|
|
78
78
|
```shell
|
|
79
79
|
$ npm test
|
package/lib/index.browser.cjs.js
CHANGED
|
@@ -1152,6 +1152,8 @@ const VersionedMessage = {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
};
|
|
1154
1154
|
|
|
1155
|
+
/** @internal */
|
|
1156
|
+
|
|
1155
1157
|
/**
|
|
1156
1158
|
* Transaction signature as base-58 encoded string
|
|
1157
1159
|
*/
|
|
@@ -1767,29 +1769,31 @@ class Transaction {
|
|
|
1767
1769
|
*
|
|
1768
1770
|
* @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
|
|
1769
1771
|
*/
|
|
1770
|
-
verifySignatures(requireAllSignatures) {
|
|
1771
|
-
|
|
1772
|
+
verifySignatures(requireAllSignatures = true) {
|
|
1773
|
+
const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);
|
|
1774
|
+
return !signatureErrors;
|
|
1772
1775
|
}
|
|
1773
1776
|
|
|
1774
1777
|
/**
|
|
1775
1778
|
* @internal
|
|
1776
1779
|
*/
|
|
1777
|
-
|
|
1780
|
+
_getMessageSignednessErrors(message, requireAllSignatures) {
|
|
1781
|
+
const errors = {};
|
|
1778
1782
|
for (const {
|
|
1779
1783
|
signature,
|
|
1780
1784
|
publicKey
|
|
1781
1785
|
} of this.signatures) {
|
|
1782
1786
|
if (signature === null) {
|
|
1783
1787
|
if (requireAllSignatures) {
|
|
1784
|
-
|
|
1788
|
+
(errors.missing ||= []).push(publicKey);
|
|
1785
1789
|
}
|
|
1786
1790
|
} else {
|
|
1787
|
-
if (!verify(signature,
|
|
1788
|
-
|
|
1791
|
+
if (!verify(signature, message, publicKey.toBytes())) {
|
|
1792
|
+
(errors.invalid ||= []).push(publicKey);
|
|
1789
1793
|
}
|
|
1790
1794
|
}
|
|
1791
1795
|
}
|
|
1792
|
-
return
|
|
1796
|
+
return errors.invalid || errors.missing ? errors : undefined;
|
|
1793
1797
|
}
|
|
1794
1798
|
|
|
1795
1799
|
/**
|
|
@@ -1808,8 +1812,18 @@ class Transaction {
|
|
|
1808
1812
|
verifySignatures: true
|
|
1809
1813
|
}, config);
|
|
1810
1814
|
const signData = this.serializeMessage();
|
|
1811
|
-
if (verifySignatures
|
|
1812
|
-
|
|
1815
|
+
if (verifySignatures) {
|
|
1816
|
+
const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);
|
|
1817
|
+
if (sigErrors) {
|
|
1818
|
+
let errorMessage = 'Signature verification failed.';
|
|
1819
|
+
if (sigErrors.invalid) {
|
|
1820
|
+
errorMessage += `\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
1821
|
+
}
|
|
1822
|
+
if (sigErrors.missing) {
|
|
1823
|
+
errorMessage += `\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
1824
|
+
}
|
|
1825
|
+
throw new Error(errorMessage);
|
|
1826
|
+
}
|
|
1813
1827
|
}
|
|
1814
1828
|
return this._serialize(signData);
|
|
1815
1829
|
}
|
|
@@ -9279,7 +9293,7 @@ class StakeProgram {
|
|
|
9279
9293
|
if (custodianPubkey) {
|
|
9280
9294
|
keys.push({
|
|
9281
9295
|
pubkey: custodianPubkey,
|
|
9282
|
-
isSigner:
|
|
9296
|
+
isSigner: true,
|
|
9283
9297
|
isWritable: false
|
|
9284
9298
|
});
|
|
9285
9299
|
}
|
|
@@ -9327,7 +9341,7 @@ class StakeProgram {
|
|
|
9327
9341
|
if (custodianPubkey) {
|
|
9328
9342
|
keys.push({
|
|
9329
9343
|
pubkey: custodianPubkey,
|
|
9330
|
-
isSigner:
|
|
9344
|
+
isSigner: true,
|
|
9331
9345
|
isWritable: false
|
|
9332
9346
|
});
|
|
9333
9347
|
}
|
|
@@ -9492,7 +9506,7 @@ class StakeProgram {
|
|
|
9492
9506
|
if (custodianPubkey) {
|
|
9493
9507
|
keys.push({
|
|
9494
9508
|
pubkey: custodianPubkey,
|
|
9495
|
-
isSigner:
|
|
9509
|
+
isSigner: true,
|
|
9496
9510
|
isWritable: false
|
|
9497
9511
|
});
|
|
9498
9512
|
}
|