@solana/web3.js 1.70.0 → 1.70.1-pr-29195
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 +62 -3
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +60 -3
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +62 -3
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.esm.js +60 -3
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +2190 -2200
- 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 +62 -3
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/__forks__/node/rpc-websocket-factory.ts +1 -0
- package/src/connection.ts +1 -1
- package/src/publickey.ts +4 -0
- package/src/rpc-websocket-factory.ts +4 -0
- package/src/rpc-websocket.ts +75 -0
package/lib/index.d.ts
CHANGED
package/lib/index.esm.js
CHANGED
|
@@ -10,10 +10,11 @@ import { blob } from '@solana/buffer-layout';
|
|
|
10
10
|
import { toBigIntLE, toBufferLE } from 'bigint-buffer';
|
|
11
11
|
import https, { Agent } from 'https';
|
|
12
12
|
import { coerce, instance, string, tuple, literal, unknown, union, type, optional, any, number, array, nullable, create, boolean, record, assert as assert$1 } from 'superstruct';
|
|
13
|
-
import { Client } from 'rpc-websockets';
|
|
14
13
|
import RpcClient from 'jayson/lib/client/browser';
|
|
15
14
|
import http from 'http';
|
|
16
15
|
import * as nodeFetch from 'node-fetch';
|
|
16
|
+
import RpcWebSocketCommonClient from 'rpc-websockets/dist/lib/client';
|
|
17
|
+
import createRpc from 'rpc-websockets/dist/lib/client/websocket';
|
|
17
18
|
import { keccak_256 } from '@noble/hashes/sha3';
|
|
18
19
|
import { hmac } from '@noble/hashes/hmac';
|
|
19
20
|
import * as secp256k1 from '@noble/secp256k1';
|
|
@@ -99,6 +100,7 @@ class Enum extends Struct {
|
|
|
99
100
|
}
|
|
100
101
|
const SOLANA_SCHEMA = new Map();
|
|
101
102
|
|
|
103
|
+
let _Symbol$toStringTag;
|
|
102
104
|
/**
|
|
103
105
|
* Maximum length of derived pubkey seed
|
|
104
106
|
*/
|
|
@@ -123,6 +125,7 @@ let uniquePublicKeyCounter = 1;
|
|
|
123
125
|
* A public key
|
|
124
126
|
*/
|
|
125
127
|
|
|
128
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
126
129
|
class PublicKey extends Struct {
|
|
127
130
|
/** @internal */
|
|
128
131
|
|
|
@@ -213,6 +216,10 @@ class PublicKey extends Struct {
|
|
|
213
216
|
b.copy(zeroPad, 32 - b.length);
|
|
214
217
|
return zeroPad;
|
|
215
218
|
}
|
|
219
|
+
|
|
220
|
+
get [_Symbol$toStringTag]() {
|
|
221
|
+
return `PublicKey(${this.toString()})`;
|
|
222
|
+
}
|
|
216
223
|
/**
|
|
217
224
|
* Return the base-58 representation of the public key
|
|
218
225
|
*/
|
|
@@ -3563,6 +3570,56 @@ async function fetchImpl (input, init) {
|
|
|
3563
3570
|
return await nodeFetch.default(processedInput, init);
|
|
3564
3571
|
}
|
|
3565
3572
|
|
|
3573
|
+
class RpcWebSocketClient extends RpcWebSocketCommonClient {
|
|
3574
|
+
constructor(address, options, generate_request_id) {
|
|
3575
|
+
const webSocketFactory = url => {
|
|
3576
|
+
const rpc = createRpc(url, {
|
|
3577
|
+
autoconnect: true,
|
|
3578
|
+
max_reconnects: 5,
|
|
3579
|
+
reconnect: true,
|
|
3580
|
+
reconnect_interval: 1000,
|
|
3581
|
+
...options
|
|
3582
|
+
});
|
|
3583
|
+
|
|
3584
|
+
if ('socket' in rpc) {
|
|
3585
|
+
this.underlyingSocket = rpc.socket;
|
|
3586
|
+
} else {
|
|
3587
|
+
this.underlyingSocket = rpc;
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3590
|
+
return rpc;
|
|
3591
|
+
};
|
|
3592
|
+
|
|
3593
|
+
super(webSocketFactory, address, options, generate_request_id);
|
|
3594
|
+
this.underlyingSocket = void 0;
|
|
3595
|
+
}
|
|
3596
|
+
|
|
3597
|
+
call(...args) {
|
|
3598
|
+
var _this$underlyingSocke;
|
|
3599
|
+
|
|
3600
|
+
const readyState = (_this$underlyingSocke = this.underlyingSocket) === null || _this$underlyingSocke === void 0 ? void 0 : _this$underlyingSocke.readyState;
|
|
3601
|
+
|
|
3602
|
+
if (readyState === WebSocket.OPEN) {
|
|
3603
|
+
return super.call(...args);
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3606
|
+
throw new Error('Tried to call a JSON-RPC method `' + args[0] + '` but the socket was not `CONNECTING` or `OPEN` (`readyState` was ' + readyState + ')');
|
|
3607
|
+
}
|
|
3608
|
+
|
|
3609
|
+
notify(...args) {
|
|
3610
|
+
var _this$underlyingSocke2;
|
|
3611
|
+
|
|
3612
|
+
const readyState = (_this$underlyingSocke2 = this.underlyingSocket) === null || _this$underlyingSocke2 === void 0 ? void 0 : _this$underlyingSocke2.readyState;
|
|
3613
|
+
|
|
3614
|
+
if (readyState === WebSocket.OPEN) {
|
|
3615
|
+
return super.notify(...args);
|
|
3616
|
+
}
|
|
3617
|
+
|
|
3618
|
+
throw new Error('Tried to send a JSON-RPC notification `' + args[0] + '` but the socket was not `CONNECTING` or `OPEN` (`readyState` was ' + readyState + ')');
|
|
3619
|
+
}
|
|
3620
|
+
|
|
3621
|
+
}
|
|
3622
|
+
|
|
3566
3623
|
// TODO: These constants should be removed in favor of reading them out of a
|
|
3567
3624
|
// Syscall account
|
|
3568
3625
|
|
|
@@ -4743,7 +4800,7 @@ const LogsNotificationResult = type({
|
|
|
4743
4800
|
|
|
4744
4801
|
/** @internal */
|
|
4745
4802
|
const COMMON_HTTP_HEADERS = {
|
|
4746
|
-
'solana-client': `js/${(_process$env$npm_pack = "
|
|
4803
|
+
'solana-client': `js/${(_process$env$npm_pack = "1.70.1-pr-29195") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
4747
4804
|
};
|
|
4748
4805
|
/**
|
|
4749
4806
|
* A connection to a fullnode JSON RPC endpoint
|
|
@@ -4873,7 +4930,7 @@ class Connection {
|
|
|
4873
4930
|
this._rpcClient = createRpcClient(endpoint, httpHeaders, fetch, fetchMiddleware, disableRetryOnRateLimit, httpAgent);
|
|
4874
4931
|
this._rpcRequest = createRpcRequest(this._rpcClient);
|
|
4875
4932
|
this._rpcBatchRequest = createRpcBatchRequest(this._rpcClient);
|
|
4876
|
-
this._rpcWebSocket = new
|
|
4933
|
+
this._rpcWebSocket = new RpcWebSocketClient(this._rpcWsEndpoint, {
|
|
4877
4934
|
autoconnect: false,
|
|
4878
4935
|
max_reconnects: Infinity
|
|
4879
4936
|
});
|