@solana/web3.js 1.75.0 → 1.76.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.75.0",
3
+ "version": "1.76.0",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
@@ -41,7 +41,7 @@
41
41
  "compile:js": "cross-env NODE_ENV=production rollup -c",
42
42
  "compile:typedefs": "./scripts/typegen.sh",
43
43
  "build:fixtures": "set -ex; ./test/fixtures/noop-program/build.sh",
44
- "clean": "rimraf ./docs ./declarations ./lib",
44
+ "clean": "rimraf ./doc ./declarations ./lib",
45
45
  "dev": "cross-env NODE_ENV=development rollup -c --watch",
46
46
  "publish-packages": "semantic-release --repository-url git@github.com:solana-labs/solana-web3.js.git",
47
47
  "test:lint": "eslint src/ test/ --ext .js,.ts",
@@ -55,9 +55,8 @@
55
55
  },
56
56
  "dependencies": {
57
57
  "@babel/runtime": "^7.12.5",
58
- "@noble/ed25519": "^1.7.0",
59
- "@noble/hashes": "^1.1.2",
60
- "@noble/secp256k1": "^1.6.3",
58
+ "@noble/curves": "^1.0.0",
59
+ "@noble/hashes": "^1.3.0",
61
60
  "@solana/buffer-layout": "^4.0.0",
62
61
  "agentkeepalive": "^4.2.1",
63
62
  "bigint-buffer": "^1.1.5",
@@ -84,6 +83,7 @@
84
83
  "@rollup/plugin-multi-entry": "^6.0.0",
85
84
  "@rollup/plugin-node-resolve": "^15.0.1",
86
85
  "@rollup/plugin-replace": "^5.0.2",
86
+ "@rollup/plugin-terser": "^0.4.0",
87
87
  "@solana/spl-token": "^0.3.7",
88
88
  "@types/bn.js": "^5.1.0",
89
89
  "@types/bs58": "^4.0.1",
@@ -96,12 +96,12 @@
96
96
  "@types/node-fetch": "2",
97
97
  "@types/sinon": "^10.0.0",
98
98
  "@types/sinon-chai": "^3.2.8",
99
- "@typescript-eslint/eslint-plugin": "^5.40.1",
100
- "@typescript-eslint/parser": "^5.40.1",
99
+ "@typescript-eslint/eslint-plugin": "^5.57.1",
100
+ "@typescript-eslint/parser": "^5.57.1",
101
101
  "chai": "^4.3.0",
102
102
  "chai-as-promised": "^7.1.1",
103
103
  "cross-env": "7.0.3",
104
- "eslint": "^8.25.0",
104
+ "eslint": "^8.37.0",
105
105
  "eslint-config-prettier": "^8.5.0",
106
106
  "eslint-plugin-import": "^2.26.0",
107
107
  "eslint-plugin-mocha": "^10.1.0",
@@ -113,10 +113,9 @@
113
113
  "node-abort-controller": "^3.0.1",
114
114
  "prettier": "^2.3.0",
115
115
  "rimraf": "4.1.2",
116
- "rollup": "2.79.1",
117
- "rollup-plugin-dts": "^4.0.0",
116
+ "rollup": "^3.20.2",
117
+ "rollup-plugin-dts": "^5.3.0",
118
118
  "rollup-plugin-node-polyfills": "^0.2.1",
119
- "rollup-plugin-terser": "^7.0.2",
120
119
  "semantic-release": "^19.0.3",
121
120
  "sinon": "^15.0.1",
122
121
  "sinon-chai": "^3.7.0",
@@ -125,7 +124,7 @@
125
124
  "ts-node": "^10.0.0",
126
125
  "tsconfig": "workspace:*",
127
126
  "tslib": "^2.1.0",
128
- "typedoc": "^0.23",
129
- "typescript": "^4.9"
127
+ "typedoc": "^0.23.28",
128
+ "typescript": "^5.0.3"
130
129
  }
131
130
  }
@@ -1,5 +1,4 @@
1
- import {sha512} from '@noble/hashes/sha512';
2
- import * as ed25519 from '@noble/ed25519';
1
+ import {ed25519} from '@noble/curves/ed25519';
3
2
 
4
3
  /**
5
4
  * A 64 byte secret key, the first 32 bytes of which is the
@@ -16,8 +15,6 @@ export interface Ed25519Keypair {
16
15
  secretKey: Ed25519SecretKey;
17
16
  }
18
17
 
19
- ed25519.utils.sha512Sync = (...m) => sha512(ed25519.utils.concatBytes(...m));
20
-
21
18
  export const generatePrivateKey = ed25519.utils.randomPrivateKey;
22
19
  export const generateKeypair = (): Ed25519Keypair => {
23
20
  const privateScalar = ed25519.utils.randomPrivateKey();
@@ -30,17 +27,17 @@ export const generateKeypair = (): Ed25519Keypair => {
30
27
  secretKey,
31
28
  };
32
29
  };
33
- export const getPublicKey = ed25519.sync.getPublicKey;
30
+ export const getPublicKey = ed25519.getPublicKey;
34
31
  export function isOnCurve(publicKey: Uint8Array): boolean {
35
32
  try {
36
- ed25519.Point.fromHex(publicKey, true /* strict */);
33
+ ed25519.ExtendedPoint.fromHex(publicKey);
37
34
  return true;
38
35
  } catch {
39
36
  return false;
40
37
  }
41
38
  }
42
39
  export const sign = (
43
- message: Parameters<typeof ed25519.sync.sign>[0],
40
+ message: Parameters<typeof ed25519.sign>[0],
44
41
  secretKey: Ed25519SecretKey,
45
- ) => ed25519.sync.sign(message, secretKey.slice(0, 32));
46
- export const verify = ed25519.sync.verify;
42
+ ) => ed25519.sign(message, secretKey.slice(0, 32));
43
+ export const verify = ed25519.verify;
@@ -1,18 +1,11 @@
1
- import {hmac} from '@noble/hashes/hmac';
2
- import {sha256} from '@noble/hashes/sha256';
3
- import * as secp256k1 from '@noble/secp256k1';
4
-
5
- // Supply a synchronous hashing algorithm to make this
6
- // library interoperable with the synchronous APIs in web3.js.
7
- secp256k1.utils.hmacSha256Sync = (key: Uint8Array, ...msgs: Uint8Array[]) => {
8
- const h = hmac.create(sha256, key);
9
- msgs.forEach(msg => h.update(msg));
10
- return h.digest();
11
- };
1
+ import {secp256k1} from '@noble/curves/secp256k1';
12
2
 
13
3
  export const ecdsaSign = (
14
- msgHash: Parameters<typeof secp256k1.signSync>[0],
15
- privKey: Parameters<typeof secp256k1.signSync>[1],
16
- ) => secp256k1.signSync(msgHash, privKey, {der: false, recovered: true});
4
+ msgHash: Parameters<typeof secp256k1.sign>[0],
5
+ privKey: Parameters<typeof secp256k1.sign>[1],
6
+ ) => {
7
+ const signature = secp256k1.sign(msgHash, privKey);
8
+ return [signature.toCompactRawBytes(), signature.recovery!] as const;
9
+ };
17
10
  export const isValidPrivateKey = secp256k1.utils.isValidPrivateKey;
18
11
  export const publicKeyCreate = secp256k1.getPublicKey;