@solana/web3.js 1.43.1 → 1.43.2

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.cjs.js CHANGED
@@ -9,12 +9,12 @@ var bs58 = require('bs58');
9
9
  var borsh = require('borsh');
10
10
  var BufferLayout = require('@solana/buffer-layout');
11
11
  var bigintBuffer = require('bigint-buffer');
12
- var crossFetch = require('cross-fetch');
13
12
  var superstruct = require('superstruct');
14
13
  var rpcWebsockets = require('rpc-websockets');
15
14
  var RpcClient = require('jayson/lib/client/browser');
16
15
  var http = require('http');
17
16
  var https = require('https');
17
+ var nodeFetch = require('node-fetch');
18
18
  var secp256k1 = require('secp256k1');
19
19
  var sha3 = require('js-sha3');
20
20
 
@@ -42,10 +42,10 @@ var nacl__default = /*#__PURE__*/_interopDefaultLegacy(nacl);
42
42
  var BN__default = /*#__PURE__*/_interopDefaultLegacy(BN);
43
43
  var bs58__default = /*#__PURE__*/_interopDefaultLegacy(bs58);
44
44
  var BufferLayout__namespace = /*#__PURE__*/_interopNamespace(BufferLayout);
45
- var crossFetch__default = /*#__PURE__*/_interopDefaultLegacy(crossFetch);
46
45
  var RpcClient__default = /*#__PURE__*/_interopDefaultLegacy(RpcClient);
47
46
  var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
48
47
  var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
48
+ var nodeFetch__namespace = /*#__PURE__*/_interopNamespace(nodeFetch);
49
49
  var secp256k1__default = /*#__PURE__*/_interopDefaultLegacy(secp256k1);
50
50
  var sha3__default = /*#__PURE__*/_interopDefaultLegacy(sha3);
51
51
 
@@ -79,43 +79,52 @@ var inherits$1 = {exports: {}};
79
79
 
80
80
  var inherits_browser = {exports: {}};
81
81
 
82
- if (typeof Object.create === 'function') {
83
- // implementation from standard node.js 'util' module
84
- inherits_browser.exports = function inherits(ctor, superCtor) {
85
- if (superCtor) {
86
- ctor.super_ = superCtor;
87
- ctor.prototype = Object.create(superCtor.prototype, {
88
- constructor: {
89
- value: ctor,
90
- enumerable: false,
91
- writable: true,
92
- configurable: true
93
- }
94
- });
95
- }
96
- };
97
- } else {
98
- // old school shim for old browsers
99
- inherits_browser.exports = function inherits(ctor, superCtor) {
100
- if (superCtor) {
101
- ctor.super_ = superCtor;
102
- var TempCtor = function () {};
103
- TempCtor.prototype = superCtor.prototype;
104
- ctor.prototype = new TempCtor();
105
- ctor.prototype.constructor = ctor;
106
- }
107
- };
82
+ var hasRequiredInherits_browser;
83
+
84
+ function requireInherits_browser () {
85
+ if (hasRequiredInherits_browser) return inherits_browser.exports;
86
+ hasRequiredInherits_browser = 1;
87
+ if (typeof Object.create === 'function') {
88
+ // implementation from standard node.js 'util' module
89
+ inherits_browser.exports = function inherits(ctor, superCtor) {
90
+ if (superCtor) {
91
+ ctor.super_ = superCtor;
92
+ ctor.prototype = Object.create(superCtor.prototype, {
93
+ constructor: {
94
+ value: ctor,
95
+ enumerable: false,
96
+ writable: true,
97
+ configurable: true
98
+ }
99
+ });
100
+ }
101
+ };
102
+ } else {
103
+ // old school shim for old browsers
104
+ inherits_browser.exports = function inherits(ctor, superCtor) {
105
+ if (superCtor) {
106
+ ctor.super_ = superCtor;
107
+ var TempCtor = function () {};
108
+ TempCtor.prototype = superCtor.prototype;
109
+ ctor.prototype = new TempCtor();
110
+ ctor.prototype.constructor = ctor;
111
+ }
112
+ };
113
+ }
114
+ return inherits_browser.exports;
108
115
  }
109
116
 
110
- try {
111
- var util = require('util');
112
- /* istanbul ignore next */
113
- if (typeof util.inherits !== 'function') throw '';
114
- inherits$1.exports = util.inherits;
115
- } catch (e) {
116
- /* istanbul ignore next */
117
- inherits$1.exports = inherits_browser.exports;
118
- }
117
+ (function (module) {
118
+ try {
119
+ var util = require('util');
120
+ /* istanbul ignore next */
121
+ if (typeof util.inherits !== 'function') throw '';
122
+ module.exports = util.inherits;
123
+ } catch (e) {
124
+ /* istanbul ignore next */
125
+ module.exports = requireInherits_browser();
126
+ }
127
+ } (inherits$1));
119
128
 
120
129
  var assert$5 = minimalisticAssert;
121
130
  var inherits = inherits$1.exports;
@@ -1307,22 +1316,22 @@ Hmac.prototype.digest = function digest(enc) {
1307
1316
  };
1308
1317
 
1309
1318
  (function (exports) {
1310
- var hash = exports;
1311
-
1312
- hash.utils = utils$9;
1313
- hash.common = common$5;
1314
- hash.sha = sha;
1315
- hash.ripemd = ripemd;
1316
- hash.hmac = hmac;
1317
-
1318
- // Proxy hash functions to the main object
1319
- hash.sha1 = hash.sha.sha1;
1320
- hash.sha256 = hash.sha.sha256;
1321
- hash.sha224 = hash.sha.sha224;
1322
- hash.sha384 = hash.sha.sha384;
1323
- hash.sha512 = hash.sha.sha512;
1324
- hash.ripemd160 = hash.ripemd.ripemd160;
1325
- }(hash$1));
1319
+ var hash = exports;
1320
+
1321
+ hash.utils = utils$9;
1322
+ hash.common = common$5;
1323
+ hash.sha = sha;
1324
+ hash.ripemd = ripemd;
1325
+ hash.hmac = hmac;
1326
+
1327
+ // Proxy hash functions to the main object
1328
+ hash.sha1 = hash.sha.sha1;
1329
+ hash.sha256 = hash.sha.sha256;
1330
+ hash.sha224 = hash.sha.sha224;
1331
+ hash.sha384 = hash.sha.sha384;
1332
+ hash.sha512 = hash.sha.sha512;
1333
+ hash.ripemd160 = hash.ripemd.ripemd160;
1334
+ } (hash$1));
1326
1335
 
1327
1336
  var hash = hash$1;
1328
1337
 
@@ -4584,6 +4593,11 @@ class SendTransactionError extends Error {
4584
4593
 
4585
4594
  }
4586
4595
 
4596
+ async function fetchImpl (input, init) {
4597
+ const processedInput = typeof input === 'string' && input.slice(0, 2) === '//' ? 'https:' + input : input;
4598
+ return await nodeFetch__namespace.default(processedInput, init);
4599
+ }
4600
+
4587
4601
  // TODO: These constants should be removed in favor of reading them out of a
4588
4602
  // Syscall account
4589
4603
 
@@ -4833,7 +4847,7 @@ const BlockProductionResponseStruct = jsonRpcResultAndContext(superstruct.type({
4833
4847
  */
4834
4848
 
4835
4849
  function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit) {
4836
- const fetch = customFetch ? customFetch : crossFetch__default["default"];
4850
+ const fetch = customFetch ? customFetch : fetchImpl;
4837
4851
  let agentManager;
4838
4852
 
4839
4853
  {
@@ -4843,10 +4857,10 @@ function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddlewar
4843
4857
  let fetchWithMiddleware;
4844
4858
 
4845
4859
  if (fetchMiddleware) {
4846
- fetchWithMiddleware = async (url, options) => {
4860
+ fetchWithMiddleware = async (info, init) => {
4847
4861
  const modifiedFetchArgs = await new Promise((resolve, reject) => {
4848
4862
  try {
4849
- fetchMiddleware(url, options, (modifiedUrl, modifiedOptions) => resolve([modifiedUrl, modifiedOptions]));
4863
+ fetchMiddleware(info, init, (modifiedInfo, modifiedInit) => resolve([modifiedInfo, modifiedInit]));
4850
4864
  } catch (error) {
4851
4865
  reject(error);
4852
4866
  }