@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.browser.esm.js
CHANGED
|
@@ -9,8 +9,9 @@ import * as BufferLayout from '@solana/buffer-layout';
|
|
|
9
9
|
import { blob } from '@solana/buffer-layout';
|
|
10
10
|
import { toBigIntLE, toBufferLE } from 'bigint-buffer';
|
|
11
11
|
import { coerce, instance, string, tuple, literal, unknown, union, type, optional, any, number, array, nullable, create, boolean, record, assert as assert$1 } from 'superstruct';
|
|
12
|
-
import { Client } from 'rpc-websockets';
|
|
13
12
|
import RpcClient from 'jayson/lib/client/browser';
|
|
13
|
+
import RpcWebSocketCommonClient from 'rpc-websockets/dist/lib/client';
|
|
14
|
+
import WebsocketFactory from 'rpc-websockets/dist/lib/client/websocket.browser';
|
|
14
15
|
import { keccak_256 } from '@noble/hashes/sha3';
|
|
15
16
|
import { hmac } from '@noble/hashes/hmac';
|
|
16
17
|
import * as secp256k1 from '@noble/secp256k1';
|
|
@@ -96,6 +97,7 @@ class Enum extends Struct {
|
|
|
96
97
|
}
|
|
97
98
|
const SOLANA_SCHEMA = new Map();
|
|
98
99
|
|
|
100
|
+
let _Symbol$toStringTag;
|
|
99
101
|
/**
|
|
100
102
|
* Maximum length of derived pubkey seed
|
|
101
103
|
*/
|
|
@@ -120,6 +122,7 @@ let uniquePublicKeyCounter = 1;
|
|
|
120
122
|
* A public key
|
|
121
123
|
*/
|
|
122
124
|
|
|
125
|
+
_Symbol$toStringTag = Symbol.toStringTag;
|
|
123
126
|
class PublicKey extends Struct {
|
|
124
127
|
/** @internal */
|
|
125
128
|
|
|
@@ -210,6 +213,10 @@ class PublicKey extends Struct {
|
|
|
210
213
|
b.copy(zeroPad, 32 - b.length);
|
|
211
214
|
return zeroPad;
|
|
212
215
|
}
|
|
216
|
+
|
|
217
|
+
get [_Symbol$toStringTag]() {
|
|
218
|
+
return `PublicKey(${this.toString()})`;
|
|
219
|
+
}
|
|
213
220
|
/**
|
|
214
221
|
* Return the base-58 representation of the public key
|
|
215
222
|
*/
|
|
@@ -3508,6 +3515,56 @@ class SolanaJSONRPCError extends Error {
|
|
|
3508
3515
|
|
|
3509
3516
|
var fetchImpl = globalThis.fetch;
|
|
3510
3517
|
|
|
3518
|
+
class RpcWebSocketClient extends RpcWebSocketCommonClient {
|
|
3519
|
+
constructor(address, options, generate_request_id) {
|
|
3520
|
+
const webSocketFactory = url => {
|
|
3521
|
+
const rpc = WebsocketFactory(url, {
|
|
3522
|
+
autoconnect: true,
|
|
3523
|
+
max_reconnects: 5,
|
|
3524
|
+
reconnect: true,
|
|
3525
|
+
reconnect_interval: 1000,
|
|
3526
|
+
...options
|
|
3527
|
+
});
|
|
3528
|
+
|
|
3529
|
+
if ('socket' in rpc) {
|
|
3530
|
+
this.underlyingSocket = rpc.socket;
|
|
3531
|
+
} else {
|
|
3532
|
+
this.underlyingSocket = rpc;
|
|
3533
|
+
}
|
|
3534
|
+
|
|
3535
|
+
return rpc;
|
|
3536
|
+
};
|
|
3537
|
+
|
|
3538
|
+
super(webSocketFactory, address, options, generate_request_id);
|
|
3539
|
+
this.underlyingSocket = void 0;
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
call(...args) {
|
|
3543
|
+
var _this$underlyingSocke;
|
|
3544
|
+
|
|
3545
|
+
const readyState = (_this$underlyingSocke = this.underlyingSocket) === null || _this$underlyingSocke === void 0 ? void 0 : _this$underlyingSocke.readyState;
|
|
3546
|
+
|
|
3547
|
+
if (readyState === WebSocket.OPEN) {
|
|
3548
|
+
return super.call(...args);
|
|
3549
|
+
}
|
|
3550
|
+
|
|
3551
|
+
throw new Error('Tried to call a JSON-RPC method `' + args[0] + '` but the socket was not `CONNECTING` or `OPEN` (`readyState` was ' + readyState + ')');
|
|
3552
|
+
}
|
|
3553
|
+
|
|
3554
|
+
notify(...args) {
|
|
3555
|
+
var _this$underlyingSocke2;
|
|
3556
|
+
|
|
3557
|
+
const readyState = (_this$underlyingSocke2 = this.underlyingSocket) === null || _this$underlyingSocke2 === void 0 ? void 0 : _this$underlyingSocke2.readyState;
|
|
3558
|
+
|
|
3559
|
+
if (readyState === WebSocket.OPEN) {
|
|
3560
|
+
return super.notify(...args);
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3563
|
+
throw new Error('Tried to send a JSON-RPC notification `' + args[0] + '` but the socket was not `CONNECTING` or `OPEN` (`readyState` was ' + readyState + ')');
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3566
|
+
}
|
|
3567
|
+
|
|
3511
3568
|
// TODO: These constants should be removed in favor of reading them out of a
|
|
3512
3569
|
// Syscall account
|
|
3513
3570
|
|
|
@@ -4666,7 +4723,7 @@ const LogsNotificationResult = type({
|
|
|
4666
4723
|
|
|
4667
4724
|
/** @internal */
|
|
4668
4725
|
const COMMON_HTTP_HEADERS = {
|
|
4669
|
-
'solana-client': `js/${(_process$env$npm_pack = "
|
|
4726
|
+
'solana-client': `js/${(_process$env$npm_pack = "1.70.1-pr-29195") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
4670
4727
|
};
|
|
4671
4728
|
/**
|
|
4672
4729
|
* A connection to a fullnode JSON RPC endpoint
|
|
@@ -4796,7 +4853,7 @@ class Connection {
|
|
|
4796
4853
|
this._rpcClient = createRpcClient(endpoint, httpHeaders, fetch, fetchMiddleware, disableRetryOnRateLimit, httpAgent);
|
|
4797
4854
|
this._rpcRequest = createRpcRequest(this._rpcClient);
|
|
4798
4855
|
this._rpcBatchRequest = createRpcBatchRequest(this._rpcClient);
|
|
4799
|
-
this._rpcWebSocket = new
|
|
4856
|
+
this._rpcWebSocket = new RpcWebSocketClient(this._rpcWsEndpoint, {
|
|
4800
4857
|
autoconnect: false,
|
|
4801
4858
|
max_reconnects: Infinity
|
|
4802
4859
|
});
|