@solana/web3.js 1.87.7 → 1.88.1
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 +27 -13
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +27 -13
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +45 -1627
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +42 -1622
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +205 -589
- 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 +27 -13
- 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
|
@@ -1173,6 +1173,8 @@ const VersionedMessage = {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
};
|
|
1175
1175
|
|
|
1176
|
+
/** @internal */
|
|
1177
|
+
|
|
1176
1178
|
/**
|
|
1177
1179
|
* Transaction signature as base-58 encoded string
|
|
1178
1180
|
*/
|
|
@@ -1788,29 +1790,31 @@ class Transaction {
|
|
|
1788
1790
|
*
|
|
1789
1791
|
* @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
|
|
1790
1792
|
*/
|
|
1791
|
-
verifySignatures(requireAllSignatures) {
|
|
1792
|
-
|
|
1793
|
+
verifySignatures(requireAllSignatures = true) {
|
|
1794
|
+
const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);
|
|
1795
|
+
return !signatureErrors;
|
|
1793
1796
|
}
|
|
1794
1797
|
|
|
1795
1798
|
/**
|
|
1796
1799
|
* @internal
|
|
1797
1800
|
*/
|
|
1798
|
-
|
|
1801
|
+
_getMessageSignednessErrors(message, requireAllSignatures) {
|
|
1802
|
+
const errors = {};
|
|
1799
1803
|
for (const {
|
|
1800
1804
|
signature,
|
|
1801
1805
|
publicKey
|
|
1802
1806
|
} of this.signatures) {
|
|
1803
1807
|
if (signature === null) {
|
|
1804
1808
|
if (requireAllSignatures) {
|
|
1805
|
-
|
|
1809
|
+
(errors.missing ||= []).push(publicKey);
|
|
1806
1810
|
}
|
|
1807
1811
|
} else {
|
|
1808
|
-
if (!verify(signature,
|
|
1809
|
-
|
|
1812
|
+
if (!verify(signature, message, publicKey.toBytes())) {
|
|
1813
|
+
(errors.invalid ||= []).push(publicKey);
|
|
1810
1814
|
}
|
|
1811
1815
|
}
|
|
1812
1816
|
}
|
|
1813
|
-
return
|
|
1817
|
+
return errors.invalid || errors.missing ? errors : undefined;
|
|
1814
1818
|
}
|
|
1815
1819
|
|
|
1816
1820
|
/**
|
|
@@ -1829,8 +1833,18 @@ class Transaction {
|
|
|
1829
1833
|
verifySignatures: true
|
|
1830
1834
|
}, config);
|
|
1831
1835
|
const signData = this.serializeMessage();
|
|
1832
|
-
if (verifySignatures
|
|
1833
|
-
|
|
1836
|
+
if (verifySignatures) {
|
|
1837
|
+
const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);
|
|
1838
|
+
if (sigErrors) {
|
|
1839
|
+
let errorMessage = 'Signature verification failed.';
|
|
1840
|
+
if (sigErrors.invalid) {
|
|
1841
|
+
errorMessage += `\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
1842
|
+
}
|
|
1843
|
+
if (sigErrors.missing) {
|
|
1844
|
+
errorMessage += `\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
1845
|
+
}
|
|
1846
|
+
throw new Error(errorMessage);
|
|
1847
|
+
}
|
|
1834
1848
|
}
|
|
1835
1849
|
return this._serialize(signData);
|
|
1836
1850
|
}
|
|
@@ -5098,7 +5112,7 @@ const LogsNotificationResult = superstruct.type({
|
|
|
5098
5112
|
|
|
5099
5113
|
/** @internal */
|
|
5100
5114
|
const COMMON_HTTP_HEADERS = {
|
|
5101
|
-
'solana-client': `js/${"1.
|
|
5115
|
+
'solana-client': `js/${"1.88.1" }`
|
|
5102
5116
|
};
|
|
5103
5117
|
|
|
5104
5118
|
/**
|
|
@@ -9299,7 +9313,7 @@ class StakeProgram {
|
|
|
9299
9313
|
if (custodianPubkey) {
|
|
9300
9314
|
keys.push({
|
|
9301
9315
|
pubkey: custodianPubkey,
|
|
9302
|
-
isSigner:
|
|
9316
|
+
isSigner: true,
|
|
9303
9317
|
isWritable: false
|
|
9304
9318
|
});
|
|
9305
9319
|
}
|
|
@@ -9347,7 +9361,7 @@ class StakeProgram {
|
|
|
9347
9361
|
if (custodianPubkey) {
|
|
9348
9362
|
keys.push({
|
|
9349
9363
|
pubkey: custodianPubkey,
|
|
9350
|
-
isSigner:
|
|
9364
|
+
isSigner: true,
|
|
9351
9365
|
isWritable: false
|
|
9352
9366
|
});
|
|
9353
9367
|
}
|
|
@@ -9512,7 +9526,7 @@ class StakeProgram {
|
|
|
9512
9526
|
if (custodianPubkey) {
|
|
9513
9527
|
keys.push({
|
|
9514
9528
|
pubkey: custodianPubkey,
|
|
9515
|
-
isSigner:
|
|
9529
|
+
isSigner: true,
|
|
9516
9530
|
isWritable: false
|
|
9517
9531
|
});
|
|
9518
9532
|
}
|