@solana/web3.js 1.14.1 → 1.15.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.esm.js +34 -20
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +34 -20
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.esm.js +35 -21
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +34 -20
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/module.flow.js +5 -0
- package/package.json +3 -3
- package/src/connection.ts +16 -23
- package/src/util/url.ts +20 -0
package/lib/index.iife.js
CHANGED
|
@@ -17962,6 +17962,24 @@ var solanaWeb3 = (function (exports) {
|
|
|
17962
17962
|
});
|
|
17963
17963
|
}
|
|
17964
17964
|
|
|
17965
|
+
function makeWebsocketUrl(endpoint) {
|
|
17966
|
+
let url = urlParse(endpoint);
|
|
17967
|
+
const useHttps = url.protocol === 'https:';
|
|
17968
|
+
url.protocol = useHttps ? 'wss:' : 'ws:';
|
|
17969
|
+
url.host = ''; // Only shift the port by +1 as a convention for ws(s) only if given endpoint
|
|
17970
|
+
// is explictly specifying the endpoint port (HTTP-based RPC), assuming
|
|
17971
|
+
// we're directly trying to connect to solana-validator's ws listening port.
|
|
17972
|
+
// When the endpoint omits the port, we're connecting to the protocol
|
|
17973
|
+
// default ports: http(80) or https(443) and it's assumed we're behind a reverse
|
|
17974
|
+
// proxy which manages WebSocket upgrade and backend port redirection.
|
|
17975
|
+
|
|
17976
|
+
if (url.port !== null) {
|
|
17977
|
+
url.port = String(Number(url.port) + 1);
|
|
17978
|
+
}
|
|
17979
|
+
|
|
17980
|
+
return urlFormat(url);
|
|
17981
|
+
}
|
|
17982
|
+
|
|
17965
17983
|
const PublicKeyFromString = coerce(instance(PublicKey), string(), value => new PublicKey(value));
|
|
17966
17984
|
const RawAccountDataResult = tuple([string(), literal('base64')]);
|
|
17967
17985
|
const BufferFromRawAccountData = coerce(instance(buffer.Buffer), RawAccountDataResult, value => buffer.Buffer.from(value[0], 'base64'));
|
|
@@ -18827,6 +18845,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
18827
18845
|
|
|
18828
18846
|
/** @internal */
|
|
18829
18847
|
|
|
18848
|
+
/** @internal */
|
|
18849
|
+
|
|
18850
|
+
/** @internal */
|
|
18851
|
+
|
|
18830
18852
|
/**
|
|
18831
18853
|
* Establish a JSON RPC connection
|
|
18832
18854
|
*
|
|
@@ -18844,6 +18866,13 @@ var solanaWeb3 = (function (exports) {
|
|
|
18844
18866
|
|
|
18845
18867
|
_defineProperty(this, "_pollingBlockhash", false);
|
|
18846
18868
|
|
|
18869
|
+
_defineProperty(this, "_blockhashInfo", {
|
|
18870
|
+
recentBlockhash: null,
|
|
18871
|
+
lastFetch: 0,
|
|
18872
|
+
transactionSignatures: [],
|
|
18873
|
+
simulatedSignatures: []
|
|
18874
|
+
});
|
|
18875
|
+
|
|
18847
18876
|
_defineProperty(this, "_accountChangeSubscriptionCounter", 0);
|
|
18848
18877
|
|
|
18849
18878
|
_defineProperty(this, "_accountChangeSubscriptions", {});
|
|
@@ -18872,9 +18901,9 @@ var solanaWeb3 = (function (exports) {
|
|
|
18872
18901
|
|
|
18873
18902
|
_defineProperty(this, "_slotUpdateSubscriptions", {});
|
|
18874
18903
|
|
|
18875
|
-
this._rpcEndpoint = endpoint;
|
|
18876
18904
|
let url = urlParse(endpoint);
|
|
18877
18905
|
const useHttps = url.protocol === 'https:';
|
|
18906
|
+
let wsEndpoint;
|
|
18878
18907
|
let httpHeaders;
|
|
18879
18908
|
let fetchMiddleware;
|
|
18880
18909
|
|
|
@@ -18882,32 +18911,17 @@ var solanaWeb3 = (function (exports) {
|
|
|
18882
18911
|
this._commitment = commitmentOrConfig;
|
|
18883
18912
|
} else if (commitmentOrConfig) {
|
|
18884
18913
|
this._commitment = commitmentOrConfig.commitment;
|
|
18914
|
+
wsEndpoint = commitmentOrConfig.wsEndpoint;
|
|
18885
18915
|
httpHeaders = commitmentOrConfig.httpHeaders;
|
|
18886
18916
|
fetchMiddleware = commitmentOrConfig.fetchMiddleware;
|
|
18887
18917
|
}
|
|
18888
18918
|
|
|
18919
|
+
this._rpcEndpoint = endpoint;
|
|
18920
|
+
this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
|
|
18889
18921
|
this._rpcClient = createRpcClient(url.href, useHttps, httpHeaders, fetchMiddleware);
|
|
18890
18922
|
this._rpcRequest = createRpcRequest(this._rpcClient);
|
|
18891
18923
|
this._rpcBatchRequest = createRpcBatchRequest(this._rpcClient);
|
|
18892
|
-
this.
|
|
18893
|
-
recentBlockhash: null,
|
|
18894
|
-
lastFetch: 0,
|
|
18895
|
-
transactionSignatures: [],
|
|
18896
|
-
simulatedSignatures: []
|
|
18897
|
-
};
|
|
18898
|
-
url.protocol = useHttps ? 'wss:' : 'ws:';
|
|
18899
|
-
url.host = ''; // Only shift the port by +1 as a convention for ws(s) only if given endpoint
|
|
18900
|
-
// is explictly specifying the endpoint port (HTTP-based RPC), assuming
|
|
18901
|
-
// we're directly trying to connect to solana-validator's ws listening port.
|
|
18902
|
-
// When the endpoint omits the port, we're connecting to the protocol
|
|
18903
|
-
// default ports: http(80) or https(443) and it's assumed we're behind a reverse
|
|
18904
|
-
// proxy which manages WebSocket upgrade and backend port redirection.
|
|
18905
|
-
|
|
18906
|
-
if (url.port !== null) {
|
|
18907
|
-
url.port = String(Number(url.port) + 1);
|
|
18908
|
-
}
|
|
18909
|
-
|
|
18910
|
-
this._rpcWebSocket = new Client_1(urlFormat(url), {
|
|
18924
|
+
this._rpcWebSocket = new Client_1(this._rpcWsEndpoint, {
|
|
18911
18925
|
autoconnect: false,
|
|
18912
18926
|
max_reconnects: Infinity
|
|
18913
18927
|
});
|