starknet 4.0.0 → 4.0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [4.0.1](https://github.com/0xs34n/starknet.js/compare/v4.0.0...v4.0.1) (2022-08-03)
2
+
3
+ ### Bug Fixes
4
+
5
+ - use custom fetch ponyfill ([16e9a53](https://github.com/0xs34n/starknet.js/commit/16e9a530d62942da75ed1bc30d0048a35f9f0152))
6
+ - use isomorphic-unfetch ([aa7af66](https://github.com/0xs34n/starknet.js/commit/aa7af6622d918ad0d17fe28bf1e73635895537c5))
7
+
1
8
  # [4.0.0](https://github.com/0xs34n/starknet.js/compare/v3.19.0...v4.0.0) (2022-07-27)
2
9
 
3
10
  ### Documentation
@@ -1,9 +1,8 @@
1
+ import 'isomorphic-fetch';
2
+
1
3
  /* eslint-disable no-console */
2
- import fetch from 'cross-fetch';
3
4
  import { register } from 'fetch-intercept';
4
5
 
5
- global.fetch = fetch;
6
-
7
6
  jest.setTimeout(50 * 60 * 1000);
8
7
 
9
8
  if (process.env.DEBUG === 'true') {
@@ -40,7 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.RpcProvider = void 0;
43
- var cross_fetch_1 = __importDefault(require("cross-fetch"));
43
+ var fetchPonyfill_1 = __importDefault(require("../utils/fetchPonyfill"));
44
44
  var hash_1 = require("../utils/hash");
45
45
  var json_1 = require("../utils/json");
46
46
  var number_1 = require("../utils/number");
@@ -73,7 +73,7 @@ var RpcProvider = /** @class */ (function () {
73
73
  _c.label = 1;
74
74
  case 1:
75
75
  _c.trys.push([1, 4, , 5]);
76
- return [4 /*yield*/, (0, cross_fetch_1.default)(this.nodeUrl, {
76
+ return [4 /*yield*/, (0, fetchPonyfill_1.default)(this.nodeUrl, {
77
77
  method: 'POST',
78
78
  body: (0, json_1.stringify)(requestData),
79
79
  headers: {
@@ -58,6 +58,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
58
58
  exports.SequencerProvider = void 0;
59
59
  var url_join_1 = __importDefault(require("url-join"));
60
60
  var constants_1 = require("../constants");
61
+ var fetchPonyfill_1 = __importDefault(require("../utils/fetchPonyfill"));
61
62
  var hash_1 = require("../utils/hash");
62
63
  var json_1 = require("../utils/json");
63
64
  var number_1 = require("../utils/number");
@@ -180,7 +181,7 @@ var SequencerProvider = /** @class */ (function () {
180
181
  _c.label = 1;
181
182
  case 1:
182
183
  _c.trys.push([1, 4, , 5]);
183
- return [4 /*yield*/, fetch(url, {
184
+ return [4 /*yield*/, (0, fetchPonyfill_1.default)(url, {
184
185
  method: method,
185
186
  body: (0, json_1.stringify)(request),
186
187
  headers: headers,
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = (typeof window !== 'undefined' && window.fetch) || // use buildin fetch in browser if available
4
+ (typeof global !== 'undefined' && global.fetch) || // use buildin fetch in node, react-native and service worker if available
5
+ // eslint-disable-next-line global-require
6
+ require('isomorphic-fetch'); // ponyfill fetch in node and browsers that don't have it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starknet",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "JavaScript library for StarkNet",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -46,7 +46,6 @@
46
46
  "@types/whatwg-fetch": "^0.0.33",
47
47
  "@typescript-eslint/eslint-plugin": "^5.28.0",
48
48
  "@typescript-eslint/parser": "^5.28.0",
49
- "cross-fetch": "^3.1.5",
50
49
  "eslint": "^8.17.0",
51
50
  "eslint-config-airbnb-base": "^15.0.0",
52
51
  "eslint-config-airbnb-typescript": "^17.0.0",
@@ -68,10 +67,10 @@
68
67
  "dependencies": {
69
68
  "@ethersproject/bytes": "^5.6.1",
70
69
  "bn.js": "^5.2.1",
71
- "cross-fetch": "^3.1.5",
72
70
  "elliptic": "^6.5.4",
73
71
  "ethereum-cryptography": "^1.0.3",
74
72
  "hash.js": "^1.1.7",
73
+ "isomorphic-fetch": "^3.0.0",
75
74
  "json-bigint": "^1.0.0",
76
75
  "minimalistic-assert": "^1.0.1",
77
76
  "pako": "^2.0.4",
package/provider/rpc.js CHANGED
@@ -40,7 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
42
  exports.RpcProvider = void 0;
43
- var cross_fetch_1 = __importDefault(require("cross-fetch"));
43
+ var fetchPonyfill_1 = __importDefault(require("../utils/fetchPonyfill"));
44
44
  var hash_1 = require("../utils/hash");
45
45
  var json_1 = require("../utils/json");
46
46
  var number_1 = require("../utils/number");
@@ -73,7 +73,7 @@ var RpcProvider = /** @class */ (function () {
73
73
  _c.label = 1;
74
74
  case 1:
75
75
  _c.trys.push([1, 4, , 5]);
76
- return [4 /*yield*/, (0, cross_fetch_1.default)(this.nodeUrl, {
76
+ return [4 /*yield*/, (0, fetchPonyfill_1.default)(this.nodeUrl, {
77
77
  method: 'POST',
78
78
  body: (0, json_1.stringify)(requestData),
79
79
  headers: {
@@ -58,6 +58,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
58
58
  exports.SequencerProvider = void 0;
59
59
  var url_join_1 = __importDefault(require("url-join"));
60
60
  var constants_1 = require("../constants");
61
+ var fetchPonyfill_1 = __importDefault(require("../utils/fetchPonyfill"));
61
62
  var hash_1 = require("../utils/hash");
62
63
  var json_1 = require("../utils/json");
63
64
  var number_1 = require("../utils/number");
@@ -180,7 +181,7 @@ var SequencerProvider = /** @class */ (function () {
180
181
  _c.label = 1;
181
182
  case 1:
182
183
  _c.trys.push([1, 4, , 5]);
183
- return [4 /*yield*/, fetch(url, {
184
+ return [4 /*yield*/, (0, fetchPonyfill_1.default)(url, {
184
185
  method: method,
185
186
  body: (0, json_1.stringify)(request),
186
187
  headers: headers,
@@ -1,5 +1,3 @@
1
- import fetch from 'cross-fetch';
2
-
3
1
  import { StarknetChainId } from '../constants';
4
2
  import {
5
3
  BlockTag,
@@ -18,6 +16,7 @@ import {
18
16
  InvokeFunctionResponse,
19
17
  } from '../types';
20
18
  import { RPC } from '../types/api';
19
+ import fetch from '../utils/fetchPonyfill';
21
20
  import { getSelectorFromName } from '../utils/hash';
22
21
  import { stringify } from '../utils/json';
23
22
  import {
@@ -24,6 +24,7 @@ import {
24
24
  GetTransactionTraceResponse,
25
25
  Sequencer,
26
26
  } from '../types/api';
27
+ import fetch from '../utils/fetchPonyfill';
27
28
  import { getSelectorFromName } from '../utils/hash';
28
29
  import { parse, parseAlwaysAsBig, stringify } from '../utils/json';
29
30
  import { BigNumberish, bigNumberishArrayToDecimalStringArray, toBN, toHex } from '../utils/number';
@@ -0,0 +1,4 @@
1
+ export default (typeof window !== 'undefined' && window.fetch) || // use buildin fetch in browser if available
2
+ (typeof global !== 'undefined' && global.fetch) || // use buildin fetch in node, react-native and service worker if available
3
+ // eslint-disable-next-line global-require
4
+ require('isomorphic-fetch'); // ponyfill fetch in node and browsers that don't have it
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = (typeof window !== 'undefined' && window.fetch) || // use buildin fetch in browser if available
4
+ (typeof global !== 'undefined' && global.fetch) || // use buildin fetch in node, react-native and service worker if available
5
+ // eslint-disable-next-line global-require
6
+ require('isomorphic-fetch'); // ponyfill fetch in node and browsers that don't have it
@@ -22,7 +22,7 @@ contract.**address** => _string_
22
22
 
23
23
  The address the contract was constructed/connected with
24
24
 
25
- contract.**providerOrAcount** => ProviderInterface | AccountInterface_
25
+ contract.**providerOrAccount** => _ProviderInterface | AccountInterface_
26
26
 
27
27
  Provider or account that are used to interact with the network
28
28
 
@@ -175,7 +175,7 @@ Deploys a contract on Starknet
175
175
 
176
176
  <hr/>
177
177
 
178
- provider.\*\*waitForTransaction(txHash [ , retryInterval]) => _Promise < void >_
178
+ provider.**waitForTransaction**(txHash [ , retryInterval]) => _Promise < void >_
179
179
 
180
180
  Wait for the transaction to be accepted on L2 or L1.
181
181