@solana/web3.js 1.30.3 → 1.31.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 +2 -2
- package/lib/index.browser.esm.js +8 -9
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +12 -12
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +8 -9
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +14 -12
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +3 -3
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +7 -7
- package/src/account.ts +1 -1
- package/src/keypair.ts +1 -1
- package/src/secp256k1-program.ts +5 -5
package/lib/index.esm.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import nacl__default from 'tweetnacl';
|
|
1
|
+
import nacl from 'tweetnacl';
|
|
3
2
|
import { Buffer } from 'buffer';
|
|
4
3
|
import BN from 'bn.js';
|
|
5
4
|
import bs58 from 'bs58';
|
|
@@ -12,7 +11,7 @@ import RpcClient from 'jayson/lib/client/browser';
|
|
|
12
11
|
import http from 'http';
|
|
13
12
|
import https from 'https';
|
|
14
13
|
import secp256k1 from 'secp256k1';
|
|
15
|
-
import
|
|
14
|
+
import sha3 from 'js-sha3';
|
|
16
15
|
|
|
17
16
|
const toBuffer = arr => {
|
|
18
17
|
if (Buffer.isBuffer(arr)) {
|
|
@@ -1925,7 +1924,7 @@ SOLANA_SCHEMA.set(PublicKey, {
|
|
|
1925
1924
|
fields: [['_bn', 'u256']]
|
|
1926
1925
|
}); // @ts-ignore
|
|
1927
1926
|
|
|
1928
|
-
let naclLowLevel =
|
|
1927
|
+
let naclLowLevel = nacl.lowlevel; // Check that a pubkey is on the curve.
|
|
1929
1928
|
// This function and its dependents were sourced from:
|
|
1930
1929
|
// https://github.com/dchest/tweetnacl-js/blob/f1ec050ceae0861f34280e62498b1d3ed9c350c6/nacl.js#L792
|
|
1931
1930
|
|
|
@@ -2730,7 +2729,7 @@ class Transaction {
|
|
|
2730
2729
|
_partialSign(message, ...signers) {
|
|
2731
2730
|
const signData = message.serialize();
|
|
2732
2731
|
signers.forEach(signer => {
|
|
2733
|
-
const signature =
|
|
2732
|
+
const signature = nacl.sign.detached(signData, signer.secretKey);
|
|
2734
2733
|
|
|
2735
2734
|
this._addSignature(signer.publicKey, toBuffer(signature));
|
|
2736
2735
|
});
|
|
@@ -2786,7 +2785,7 @@ class Transaction {
|
|
|
2786
2785
|
return false;
|
|
2787
2786
|
}
|
|
2788
2787
|
} else {
|
|
2789
|
-
if (!
|
|
2788
|
+
if (!nacl.sign.detached.verify(signData, signature, publicKey.toBuffer())) {
|
|
2790
2789
|
return false;
|
|
2791
2790
|
}
|
|
2792
2791
|
}
|
|
@@ -7426,7 +7425,7 @@ class Ed25519Program {
|
|
|
7426
7425
|
try {
|
|
7427
7426
|
const keypair = Keypair.fromSecretKey(privateKey);
|
|
7428
7427
|
const publicKey = keypair.publicKey.toBytes();
|
|
7429
|
-
const signature =
|
|
7428
|
+
const signature = nacl.sign.detached(message, keypair.secretKey);
|
|
7430
7429
|
return this.createInstructionWithPublicKey({
|
|
7431
7430
|
publicKey,
|
|
7432
7431
|
message,
|
|
@@ -8223,7 +8222,7 @@ class Secp256k1Program {
|
|
|
8223
8222
|
assert(publicKey.length === PUBLIC_KEY_BYTES, `Public key must be ${PUBLIC_KEY_BYTES} bytes but received ${publicKey.length} bytes`);
|
|
8224
8223
|
|
|
8225
8224
|
try {
|
|
8226
|
-
return Buffer.from(keccak_256.update(toBuffer(publicKey)).digest()).slice(-ETHEREUM_ADDRESS_BYTES);
|
|
8225
|
+
return Buffer.from(sha3.keccak_256.update(toBuffer(publicKey)).digest()).slice(-ETHEREUM_ADDRESS_BYTES);
|
|
8227
8226
|
} catch (error) {
|
|
8228
8227
|
throw new Error(`Error constructing Ethereum address: ${error}`);
|
|
8229
8228
|
}
|
|
@@ -8321,7 +8320,7 @@ class Secp256k1Program {
|
|
|
8321
8320
|
const privateKey = toBuffer(pkey);
|
|
8322
8321
|
const publicKey = publicKeyCreate(privateKey, false).slice(1); // throw away leading byte
|
|
8323
8322
|
|
|
8324
|
-
const messageHash = Buffer.from(keccak_256.update(toBuffer(message)).digest());
|
|
8323
|
+
const messageHash = Buffer.from(sha3.keccak_256.update(toBuffer(message)).digest());
|
|
8325
8324
|
const {
|
|
8326
8325
|
signature,
|
|
8327
8326
|
recid: recoveryId
|