@solana/web3.js 1.77.3 → 1.78.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/lib/index.browser.cjs.js +879 -165
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +870 -157
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +911 -221
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +13 -0
- package/lib/index.esm.js +902 -213
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +1258 -486
- 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/lib/index.native.js +879 -165
- package/lib/index.native.js.map +1 -1
- package/package.json +12 -11
- package/src/connection.ts +40 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/web3.js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.78.0",
|
|
4
4
|
"description": "Solana Javascript API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"test:unit:node": "cross-env NODE_ENV=test TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"target\": \"es2019\" }' ts-mocha --require esm './test/**/*.test.ts'"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@babel/runtime": "^7.
|
|
57
|
+
"@babel/runtime": "^7.22.3",
|
|
58
58
|
"@noble/curves": "^1.0.0",
|
|
59
59
|
"@noble/hashes": "^1.3.0",
|
|
60
60
|
"@solana/buffer-layout": "^4.0.0",
|
|
@@ -66,28 +66,29 @@
|
|
|
66
66
|
"buffer": "6.0.3",
|
|
67
67
|
"fast-stable-stringify": "^1.0.0",
|
|
68
68
|
"jayson": "^4.1.0",
|
|
69
|
-
"node-fetch": "^2.6.
|
|
69
|
+
"node-fetch": "^2.6.11",
|
|
70
70
|
"rpc-websockets": "^7.5.1",
|
|
71
71
|
"superstruct": "^0.14.2"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@babel/core": "^7.12.13",
|
|
75
75
|
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
|
76
|
+
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
|
76
77
|
"@babel/plugin-transform-runtime": "^7.12.10",
|
|
77
|
-
"@babel/preset-env": "^7.
|
|
78
|
+
"@babel/preset-env": "^7.22.4",
|
|
78
79
|
"@babel/preset-typescript": "^7.12.16",
|
|
79
80
|
"@rollup/plugin-alias": "^4.0.3",
|
|
80
81
|
"@rollup/plugin-babel": "^6.0.3",
|
|
81
|
-
"@rollup/plugin-commonjs": "^
|
|
82
|
+
"@rollup/plugin-commonjs": "^25.0.0",
|
|
82
83
|
"@rollup/plugin-json": "^6.0.0",
|
|
83
84
|
"@rollup/plugin-multi-entry": "^6.0.0",
|
|
84
85
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
85
86
|
"@rollup/plugin-replace": "^5.0.2",
|
|
86
|
-
"@rollup/plugin-terser": "^0.4.
|
|
87
|
+
"@rollup/plugin-terser": "^0.4.3",
|
|
87
88
|
"@solana/spl-token": "^0.3.7",
|
|
88
89
|
"@types/bn.js": "^5.1.0",
|
|
89
90
|
"@types/bs58": "^4.0.1",
|
|
90
|
-
"@types/chai": "^4.
|
|
91
|
+
"@types/chai": "^4.3.5",
|
|
91
92
|
"@types/chai-as-promised": "^7.1.3",
|
|
92
93
|
"@types/express-serve-static-core": "^4.17.35",
|
|
93
94
|
"@types/mocha": "^10.0.0",
|
|
@@ -98,11 +99,11 @@
|
|
|
98
99
|
"@types/sinon-chai": "^3.2.8",
|
|
99
100
|
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
100
101
|
"@typescript-eslint/parser": "^5.57.1",
|
|
101
|
-
"chai": "^4.3.
|
|
102
|
+
"chai": "^4.3.7",
|
|
102
103
|
"chai-as-promised": "^7.1.1",
|
|
103
104
|
"cross-env": "7.0.3",
|
|
104
105
|
"eslint": "^8.37.0",
|
|
105
|
-
"eslint-config-prettier": "^8.
|
|
106
|
+
"eslint-config-prettier": "^8.8.0",
|
|
106
107
|
"eslint-plugin-import": "^2.26.0",
|
|
107
108
|
"eslint-plugin-mocha": "^10.1.0",
|
|
108
109
|
"eslint-plugin-prettier": "^4.2.1",
|
|
@@ -117,7 +118,7 @@
|
|
|
117
118
|
"rollup-plugin-dts": "^5.3.0",
|
|
118
119
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
119
120
|
"semantic-release": "^19.0.3",
|
|
120
|
-
"sinon": "^15.0
|
|
121
|
+
"sinon": "^15.1.0",
|
|
121
122
|
"sinon-chai": "^3.7.0",
|
|
122
123
|
"start-server-and-test": "^2.0.0",
|
|
123
124
|
"ts-mocha": "^10.0.0",
|
|
@@ -125,6 +126,6 @@
|
|
|
125
126
|
"tsconfig": "workspace:*",
|
|
126
127
|
"tslib": "^2.5.2",
|
|
127
128
|
"typedoc": "^0.23.28",
|
|
128
|
-
"typescript": "^5.0.
|
|
129
|
+
"typescript": "^5.0.4"
|
|
129
130
|
}
|
|
130
131
|
}
|
package/src/connection.ts
CHANGED
|
@@ -623,6 +623,16 @@ export type GetLatestBlockhashConfig = {
|
|
|
623
623
|
minContextSlot?: number;
|
|
624
624
|
};
|
|
625
625
|
|
|
626
|
+
/**
|
|
627
|
+
* Configuration object for changing `isBlockhashValid` query behavior
|
|
628
|
+
*/
|
|
629
|
+
export type IsBlockhashValidConfig = {
|
|
630
|
+
/** The level of commitment desired */
|
|
631
|
+
commitment?: Commitment;
|
|
632
|
+
/** The minimum slot that the request can be evaluated at */
|
|
633
|
+
minContextSlot?: number;
|
|
634
|
+
};
|
|
635
|
+
|
|
626
636
|
/**
|
|
627
637
|
* Configuration object for changing `getSlot` query behavior
|
|
628
638
|
*/
|
|
@@ -2561,6 +2571,11 @@ const GetLatestBlockhashRpcResult = jsonRpcResultAndContext(
|
|
|
2561
2571
|
}),
|
|
2562
2572
|
);
|
|
2563
2573
|
|
|
2574
|
+
/**
|
|
2575
|
+
* Expected JSON RPC response for the "isBlockhashValid" message
|
|
2576
|
+
*/
|
|
2577
|
+
const IsBlockhashValidRpcResult = jsonRpcResultAndContext(boolean());
|
|
2578
|
+
|
|
2564
2579
|
const PerfSampleResult = pick({
|
|
2565
2580
|
slot: number(),
|
|
2566
2581
|
numTransactions: number(),
|
|
@@ -4601,6 +4616,31 @@ export class Connection {
|
|
|
4601
4616
|
return res.result;
|
|
4602
4617
|
}
|
|
4603
4618
|
|
|
4619
|
+
/**
|
|
4620
|
+
* Returns whether a blockhash is still valid or not
|
|
4621
|
+
*/
|
|
4622
|
+
async isBlockhashValid(
|
|
4623
|
+
blockhash: Blockhash,
|
|
4624
|
+
rawConfig?: IsBlockhashValidConfig,
|
|
4625
|
+
): Promise<RpcResponseAndContext<boolean>> {
|
|
4626
|
+
const {commitment, config} = extractCommitmentFromConfig(rawConfig);
|
|
4627
|
+
const args = this._buildArgs(
|
|
4628
|
+
[blockhash],
|
|
4629
|
+
commitment,
|
|
4630
|
+
undefined /* encoding */,
|
|
4631
|
+
config,
|
|
4632
|
+
);
|
|
4633
|
+
const unsafeRes = await this._rpcRequest('isBlockhashValid', args);
|
|
4634
|
+
const res = create(unsafeRes, IsBlockhashValidRpcResult);
|
|
4635
|
+
if ('error' in res) {
|
|
4636
|
+
throw new SolanaJSONRPCError(
|
|
4637
|
+
res.error,
|
|
4638
|
+
'failed to determine if the blockhash `' + blockhash + '`is valid',
|
|
4639
|
+
);
|
|
4640
|
+
}
|
|
4641
|
+
return res.result;
|
|
4642
|
+
}
|
|
4643
|
+
|
|
4604
4644
|
/**
|
|
4605
4645
|
* Fetch the node version
|
|
4606
4646
|
*/
|