@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.browser.cjs.js +45 -59
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +10 -20
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +59 -73
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +10 -20
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +3104 -1750
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +12 -5
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +45 -59
- package/lib/index.native.js.map +1 -1
- package/package.json +12 -13
- package/src/utils/ed25519.ts +6 -9
- package/src/utils/secp256k1.ts +7 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/web3.js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.76.1",
|
|
4
4
|
"description": "Solana Javascript API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -38,9 +38,8 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@babel/runtime": "^7.12.5",
|
|
41
|
-
"@noble/
|
|
42
|
-
"@noble/hashes": "^1.
|
|
43
|
-
"@noble/secp256k1": "^1.6.3",
|
|
41
|
+
"@noble/curves": "^1.0.0",
|
|
42
|
+
"@noble/hashes": "^1.3.0",
|
|
44
43
|
"@solana/buffer-layout": "^4.0.0",
|
|
45
44
|
"agentkeepalive": "^4.2.1",
|
|
46
45
|
"bigint-buffer": "^1.1.5",
|
|
@@ -67,6 +66,7 @@
|
|
|
67
66
|
"@rollup/plugin-multi-entry": "^6.0.0",
|
|
68
67
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
69
68
|
"@rollup/plugin-replace": "^5.0.2",
|
|
69
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
70
70
|
"@solana/spl-token": "^0.3.7",
|
|
71
71
|
"@types/bn.js": "^5.1.0",
|
|
72
72
|
"@types/bs58": "^4.0.1",
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"@types/node-fetch": "2",
|
|
80
80
|
"@types/sinon": "^10.0.0",
|
|
81
81
|
"@types/sinon-chai": "^3.2.8",
|
|
82
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
83
|
-
"@typescript-eslint/parser": "^5.
|
|
82
|
+
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
83
|
+
"@typescript-eslint/parser": "^5.57.1",
|
|
84
84
|
"chai": "^4.3.0",
|
|
85
85
|
"chai-as-promised": "^7.1.1",
|
|
86
86
|
"cross-env": "7.0.3",
|
|
87
|
-
"eslint": "^8.
|
|
87
|
+
"eslint": "^8.37.0",
|
|
88
88
|
"eslint-config-prettier": "^8.5.0",
|
|
89
89
|
"eslint-plugin-import": "^2.26.0",
|
|
90
90
|
"eslint-plugin-mocha": "^10.1.0",
|
|
@@ -96,10 +96,9 @@
|
|
|
96
96
|
"node-abort-controller": "^3.0.1",
|
|
97
97
|
"prettier": "^2.3.0",
|
|
98
98
|
"rimraf": "4.1.2",
|
|
99
|
-
"rollup": "
|
|
100
|
-
"rollup-plugin-dts": "^
|
|
99
|
+
"rollup": "^3.20.2",
|
|
100
|
+
"rollup-plugin-dts": "^5.3.0",
|
|
101
101
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
102
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
103
102
|
"semantic-release": "^19.0.3",
|
|
104
103
|
"sinon": "^15.0.1",
|
|
105
104
|
"sinon-chai": "^3.7.0",
|
|
@@ -107,8 +106,8 @@
|
|
|
107
106
|
"ts-mocha": "^10.0.0",
|
|
108
107
|
"ts-node": "^10.0.0",
|
|
109
108
|
"tslib": "^2.1.0",
|
|
110
|
-
"typedoc": "^0.23",
|
|
111
|
-
"typescript": "^
|
|
109
|
+
"typedoc": "^0.23.28",
|
|
110
|
+
"typescript": "^5.0.3",
|
|
112
111
|
"tsconfig": "0.0.0"
|
|
113
112
|
},
|
|
114
113
|
"scripts": {
|
|
@@ -116,7 +115,7 @@
|
|
|
116
115
|
"compile:js": "cross-env NODE_ENV=production rollup -c",
|
|
117
116
|
"compile:typedefs": "./scripts/typegen.sh",
|
|
118
117
|
"build:fixtures": "set -ex; ./test/fixtures/noop-program/build.sh",
|
|
119
|
-
"clean": "rimraf ./
|
|
118
|
+
"clean": "rimraf ./doc ./declarations ./lib",
|
|
120
119
|
"dev": "cross-env NODE_ENV=development rollup -c --watch",
|
|
121
120
|
"publish-packages": "semantic-release --repository-url git@github.com:solana-labs/solana-web3.js.git",
|
|
122
121
|
"test:lint": "eslint src/ test/ --ext .js,.ts",
|
package/src/utils/ed25519.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
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.
|
|
30
|
+
export const getPublicKey = ed25519.getPublicKey;
|
|
34
31
|
export function isOnCurve(publicKey: Uint8Array): boolean {
|
|
35
32
|
try {
|
|
36
|
-
ed25519.
|
|
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.
|
|
40
|
+
message: Parameters<typeof ed25519.sign>[0],
|
|
44
41
|
secretKey: Ed25519SecretKey,
|
|
45
|
-
) => ed25519.
|
|
46
|
-
export const verify = ed25519.
|
|
42
|
+
) => ed25519.sign(message, secretKey.slice(0, 32));
|
|
43
|
+
export const verify = ed25519.verify;
|
package/src/utils/secp256k1.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import {
|
|
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.
|
|
15
|
-
privKey: Parameters<typeof secp256k1.
|
|
16
|
-
) =>
|
|
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;
|