@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.
@@ -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';
@@ -13,8 +12,7 @@ import RpcClient from 'jayson/lib/client/browser';
13
12
  import RpcWebSocketCommonClient from 'rpc-websockets/dist/lib/client';
14
13
  import createRpc from 'rpc-websockets/dist/lib/client/websocket.browser';
15
14
  import { keccak_256 } from '@noble/hashes/sha3';
16
- import { hmac } from '@noble/hashes/hmac';
17
- import * as secp256k1 from '@noble/secp256k1';
15
+ import { secp256k1 } from '@noble/curves/secp256k1';
18
16
 
19
17
  /**
20
18
  * A 64 byte secret key, the first 32 bytes of which is the
@@ -22,7 +20,6 @@ import * as secp256k1 from '@noble/secp256k1';
22
20
  * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
23
21
  */
24
22
 
25
- ed25519.utils.sha512Sync = (...m) => sha512(ed25519.utils.concatBytes(...m));
26
23
  const generatePrivateKey = ed25519.utils.randomPrivateKey;
27
24
  const generateKeypair = () => {
28
25
  const privateScalar = ed25519.utils.randomPrivateKey();
@@ -35,17 +32,17 @@ const generateKeypair = () => {
35
32
  secretKey
36
33
  };
37
34
  };
38
- const getPublicKey = ed25519.sync.getPublicKey;
35
+ const getPublicKey = ed25519.getPublicKey;
39
36
  function isOnCurve(publicKey) {
40
37
  try {
41
- ed25519.Point.fromHex(publicKey, true /* strict */);
38
+ ed25519.ExtendedPoint.fromHex(publicKey);
42
39
  return true;
43
40
  } catch {
44
41
  return false;
45
42
  }
46
43
  }
47
- const sign = (message, secretKey) => ed25519.sync.sign(message, secretKey.slice(0, 32));
48
- const verify = ed25519.sync.verify;
44
+ const sign = (message, secretKey) => ed25519.sign(message, secretKey.slice(0, 32));
45
+ const verify = ed25519.verify;
49
46
 
50
47
  const toBuffer = arr => {
51
48
  if (Buffer.isBuffer(arr)) {
@@ -4428,7 +4425,7 @@ const LogsNotificationResult = type({
4428
4425
 
4429
4426
  /** @internal */
4430
4427
  const COMMON_HTTP_HEADERS = {
4431
- 'solana-client': `js/${"1.75.1" }`
4428
+ 'solana-client': `js/${"1.76.1" }`
4432
4429
  };
4433
4430
 
4434
4431
  /**
@@ -7889,17 +7886,10 @@ class Ed25519Program {
7889
7886
  }
7890
7887
  Ed25519Program.programId = new PublicKey('Ed25519SigVerify111111111111111111111111111');
7891
7888
 
7892
- // Supply a synchronous hashing algorithm to make this
7893
- // library interoperable with the synchronous APIs in web3.js.
7894
- secp256k1.utils.hmacSha256Sync = (key, ...msgs) => {
7895
- const h = hmac.create(sha256, key);
7896
- msgs.forEach(msg => h.update(msg));
7897
- return h.digest();
7889
+ const ecdsaSign = (msgHash, privKey) => {
7890
+ const signature = secp256k1.sign(msgHash, privKey);
7891
+ return [signature.toCompactRawBytes(), signature.recovery];
7898
7892
  };
7899
- const ecdsaSign = (msgHash, privKey) => secp256k1.signSync(msgHash, privKey, {
7900
- der: false,
7901
- recovered: true
7902
- });
7903
7893
  secp256k1.utils.isValidPrivateKey;
7904
7894
  const publicKeyCreate = secp256k1.getPublicKey;
7905
7895