@solana/web3.js 1.75.1 → 1.76.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/lib/index.esm.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Buffer } from 'buffer';
2
- import { sha512 } from '@noble/hashes/sha512';
3
- import * as ed25519 from '@noble/ed25519';
2
+ import { ed25519 } from '@noble/curves/ed25519';
4
3
  import BN from 'bn.js';
5
4
  import bs58 from 'bs58';
6
5
  import { sha256 } from '@noble/hashes/sha256';
@@ -20,8 +19,7 @@ import * as nodeFetch from 'node-fetch';
20
19
  import RpcWebSocketCommonClient from 'rpc-websockets/dist/lib/client';
21
20
  import WebsocketFactory from 'rpc-websockets/dist/lib/client/websocket';
22
21
  import { keccak_256 } from '@noble/hashes/sha3';
23
- import { hmac } from '@noble/hashes/hmac';
24
- import * as secp256k1 from '@noble/secp256k1';
22
+ import { secp256k1 } from '@noble/curves/secp256k1';
25
23
 
26
24
  /**
27
25
  * A 64 byte secret key, the first 32 bytes of which is the
@@ -29,7 +27,6 @@ import * as secp256k1 from '@noble/secp256k1';
29
27
  * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
30
28
  */
31
29
 
32
- ed25519.utils.sha512Sync = (...m) => sha512(ed25519.utils.concatBytes(...m));
33
30
  const generatePrivateKey = ed25519.utils.randomPrivateKey;
34
31
  const generateKeypair = () => {
35
32
  const privateScalar = ed25519.utils.randomPrivateKey();
@@ -42,17 +39,17 @@ const generateKeypair = () => {
42
39
  secretKey
43
40
  };
44
41
  };
45
- const getPublicKey = ed25519.sync.getPublicKey;
42
+ const getPublicKey = ed25519.getPublicKey;
46
43
  function isOnCurve(publicKey) {
47
44
  try {
48
- ed25519.Point.fromHex(publicKey, true /* strict */);
45
+ ed25519.ExtendedPoint.fromHex(publicKey);
49
46
  return true;
50
47
  } catch {
51
48
  return false;
52
49
  }
53
50
  }
54
- const sign = (message, secretKey) => ed25519.sync.sign(message, secretKey.slice(0, 32));
55
- const verify = ed25519.sync.verify;
51
+ const sign = (message, secretKey) => ed25519.sign(message, secretKey.slice(0, 32));
52
+ const verify = ed25519.verify;
56
53
 
57
54
  const toBuffer = arr => {
58
55
  if (Buffer.isBuffer(arr)) {
@@ -6945,7 +6942,7 @@ const LogsNotificationResult = type({
6945
6942
 
6946
6943
  /** @internal */
6947
6944
  const COMMON_HTTP_HEADERS = {
6948
- 'solana-client': `js/${"1.75.1" }`
6945
+ 'solana-client': `js/${"1.76.1" }`
6949
6946
  };
6950
6947
 
6951
6948
  /**
@@ -10406,17 +10403,10 @@ class Ed25519Program {
10406
10403
  }
10407
10404
  Ed25519Program.programId = new PublicKey('Ed25519SigVerify111111111111111111111111111');
10408
10405
 
10409
- // Supply a synchronous hashing algorithm to make this
10410
- // library interoperable with the synchronous APIs in web3.js.
10411
- secp256k1.utils.hmacSha256Sync = (key, ...msgs) => {
10412
- const h = hmac.create(sha256, key);
10413
- msgs.forEach(msg => h.update(msg));
10414
- return h.digest();
10406
+ const ecdsaSign = (msgHash, privKey) => {
10407
+ const signature = secp256k1.sign(msgHash, privKey);
10408
+ return [signature.toCompactRawBytes(), signature.recovery];
10415
10409
  };
10416
- const ecdsaSign = (msgHash, privKey) => secp256k1.signSync(msgHash, privKey, {
10417
- der: false,
10418
- recovered: true
10419
- });
10420
10410
  secp256k1.utils.isValidPrivateKey;
10421
10411
  const publicKeyCreate = secp256k1.getPublicKey;
10422
10412