@solana/web3.js 1.87.5 → 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 +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 +30 -30
- package/src/connection.ts +4 -6
- package/src/programs/stake.ts +3 -3
- package/src/transaction/legacy.ts +37 -15
- package/src/utils/makeWebsocketUrl.ts +1 -1
package/lib/index.browser.esm.js
CHANGED
|
@@ -1124,6 +1124,8 @@ const VersionedMessage = {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
};
|
|
1126
1126
|
|
|
1127
|
+
/** @internal */
|
|
1128
|
+
|
|
1127
1129
|
/**
|
|
1128
1130
|
* Transaction signature as base-58 encoded string
|
|
1129
1131
|
*/
|
|
@@ -1739,29 +1741,31 @@ class Transaction {
|
|
|
1739
1741
|
*
|
|
1740
1742
|
* @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
|
|
1741
1743
|
*/
|
|
1742
|
-
verifySignatures(requireAllSignatures) {
|
|
1743
|
-
|
|
1744
|
+
verifySignatures(requireAllSignatures = true) {
|
|
1745
|
+
const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);
|
|
1746
|
+
return !signatureErrors;
|
|
1744
1747
|
}
|
|
1745
1748
|
|
|
1746
1749
|
/**
|
|
1747
1750
|
* @internal
|
|
1748
1751
|
*/
|
|
1749
|
-
|
|
1752
|
+
_getMessageSignednessErrors(message, requireAllSignatures) {
|
|
1753
|
+
const errors = {};
|
|
1750
1754
|
for (const {
|
|
1751
1755
|
signature,
|
|
1752
1756
|
publicKey
|
|
1753
1757
|
} of this.signatures) {
|
|
1754
1758
|
if (signature === null) {
|
|
1755
1759
|
if (requireAllSignatures) {
|
|
1756
|
-
|
|
1760
|
+
(errors.missing ||= []).push(publicKey);
|
|
1757
1761
|
}
|
|
1758
1762
|
} else {
|
|
1759
|
-
if (!verify(signature,
|
|
1760
|
-
|
|
1763
|
+
if (!verify(signature, message, publicKey.toBytes())) {
|
|
1764
|
+
(errors.invalid ||= []).push(publicKey);
|
|
1761
1765
|
}
|
|
1762
1766
|
}
|
|
1763
1767
|
}
|
|
1764
|
-
return
|
|
1768
|
+
return errors.invalid || errors.missing ? errors : undefined;
|
|
1765
1769
|
}
|
|
1766
1770
|
|
|
1767
1771
|
/**
|
|
@@ -1780,8 +1784,18 @@ class Transaction {
|
|
|
1780
1784
|
verifySignatures: true
|
|
1781
1785
|
}, config);
|
|
1782
1786
|
const signData = this.serializeMessage();
|
|
1783
|
-
if (verifySignatures
|
|
1784
|
-
|
|
1787
|
+
if (verifySignatures) {
|
|
1788
|
+
const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);
|
|
1789
|
+
if (sigErrors) {
|
|
1790
|
+
let errorMessage = 'Signature verification failed.';
|
|
1791
|
+
if (sigErrors.invalid) {
|
|
1792
|
+
errorMessage += `\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
1793
|
+
}
|
|
1794
|
+
if (sigErrors.missing) {
|
|
1795
|
+
errorMessage += `\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
1796
|
+
}
|
|
1797
|
+
throw new Error(errorMessage);
|
|
1798
|
+
}
|
|
1785
1799
|
}
|
|
1786
1800
|
return this._serialize(signData);
|
|
1787
1801
|
}
|
|
@@ -3535,7 +3549,7 @@ function makeWebsocketUrl(endpoint) {
|
|
|
3535
3549
|
const startPort = portWithColon == null ? null : parseInt(portWithColon.slice(1), 10);
|
|
3536
3550
|
const websocketPort =
|
|
3537
3551
|
// Only shift the port by +1 as a convention for ws(s) only if given endpoint
|
|
3538
|
-
// is
|
|
3552
|
+
// is explicitly specifying the endpoint port (HTTP-based RPC), assuming
|
|
3539
3553
|
// we're directly trying to connect to solana-validator's ws listening port.
|
|
3540
3554
|
// When the endpoint omits the port, we're connecting to the protocol
|
|
3541
3555
|
// default ports: http(80) or https(443) and it's assumed we're behind a reverse
|
|
@@ -9251,7 +9265,7 @@ class StakeProgram {
|
|
|
9251
9265
|
if (custodianPubkey) {
|
|
9252
9266
|
keys.push({
|
|
9253
9267
|
pubkey: custodianPubkey,
|
|
9254
|
-
isSigner:
|
|
9268
|
+
isSigner: true,
|
|
9255
9269
|
isWritable: false
|
|
9256
9270
|
});
|
|
9257
9271
|
}
|
|
@@ -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
|
}
|
|
@@ -9464,7 +9478,7 @@ class StakeProgram {
|
|
|
9464
9478
|
if (custodianPubkey) {
|
|
9465
9479
|
keys.push({
|
|
9466
9480
|
pubkey: custodianPubkey,
|
|
9467
|
-
isSigner:
|
|
9481
|
+
isSigner: true,
|
|
9468
9482
|
isWritable: false
|
|
9469
9483
|
});
|
|
9470
9484
|
}
|