starknet 3.12.1 → 3.13.0

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.
Files changed (65) hide show
  1. package/.github/workflows/pr.yml +3 -0
  2. package/.github/workflows/release.yml +4 -0
  3. package/CHANGELOG.md +39 -0
  4. package/README.md +2 -0
  5. package/__mocks__/Account.json +25468 -0
  6. package/__tests__/account.test.ts +102 -65
  7. package/__tests__/contract.test.ts +23 -65
  8. package/__tests__/fixtures.ts +21 -1
  9. package/__tests__/jest.setup.ts +23 -4
  10. package/__tests__/provider.test.ts +20 -1
  11. package/account/index.js +10 -6
  12. package/contract/default.js +20 -21
  13. package/contract/index.js +10 -6
  14. package/dist/account/index.js +5 -1
  15. package/dist/contract/default.js +18 -18
  16. package/dist/contract/index.js +5 -1
  17. package/dist/index.js +5 -1
  18. package/dist/provider/default.d.ts +1 -1
  19. package/dist/provider/default.js +35 -49
  20. package/dist/provider/index.js +5 -1
  21. package/dist/provider/interface.d.ts +1 -1
  22. package/dist/provider/utils.js +5 -5
  23. package/dist/signer/index.js +5 -1
  24. package/dist/types/api.d.ts +1 -1
  25. package/dist/types/index.js +5 -1
  26. package/dist/utils/ellipticCurve.js +1 -1
  27. package/dist/utils/encode.js +1 -1
  28. package/dist/utils/hash.js +1 -1
  29. package/dist/utils/number.js +8 -4
  30. package/dist/utils/shortString.js +2 -2
  31. package/dist/utils/typedData/index.d.ts +2 -36
  32. package/dist/utils/typedData/index.js +8 -4
  33. package/dist/utils/typedData/types.d.ts +15 -70
  34. package/dist/utils/typedData/types.js +0 -45
  35. package/dist/utils/typedData/utils.d.ts +2 -18
  36. package/dist/utils/typedData/utils.js +4 -3
  37. package/index.js +10 -6
  38. package/package.json +33 -31
  39. package/provider/default.d.ts +1 -1
  40. package/provider/default.js +44 -65
  41. package/provider/index.js +10 -6
  42. package/provider/interface.d.ts +1 -1
  43. package/provider/utils.js +5 -5
  44. package/signer/index.js +10 -6
  45. package/src/provider/default.ts +24 -31
  46. package/src/provider/interface.ts +1 -1
  47. package/src/types/api.ts +1 -1
  48. package/src/utils/typedData/types.ts +15 -68
  49. package/src/utils/typedData/utils.ts +7 -4
  50. package/types/api.d.ts +1 -1
  51. package/types/index.js +10 -6
  52. package/utils/ellipticCurve.js +1 -1
  53. package/utils/encode.js +1 -1
  54. package/utils/hash.js +1 -1
  55. package/utils/number.js +13 -9
  56. package/utils/shortString.js +2 -2
  57. package/utils/typedData/index.d.ts +2 -46
  58. package/utils/typedData/index.js +15 -13
  59. package/utils/typedData/types.d.ts +15 -91
  60. package/utils/typedData/types.js +0 -55
  61. package/utils/typedData/utils.d.ts +2 -21
  62. package/utils/typedData/utils.js +4 -3
  63. package/www/guides/account.md +21 -7
  64. package/www/guides/erc20.md +15 -27
  65. package/__tests__/accountContract.test.ts +0 -110
@@ -1,82 +1,27 @@
1
- import { Infer } from 'superstruct';
2
- export declare const ATOMIC_TYPES: string[];
3
- /**
4
- * Checks if a type is valid with the given `typedData`. The following types are valid:
5
- * - Atomic types: felt, felt*
6
- * - Reference types: struct type (e.g. SomeStruct)
7
- *
8
- * @param {Record<string, unknown>} types
9
- * @param {string} type
10
- * @return {boolean}
11
- */
12
- export declare const isValidType: (types: Record<string, unknown>, type: string) => boolean;
13
- export declare const STARKNET_TYPE: import("superstruct").Struct<{
14
- type: string;
15
- name: string;
16
- }, {
17
- name: import("superstruct").Struct<string, null>;
18
- type: import("superstruct").Struct<string, null>;
19
- }>;
20
1
  /**
21
2
  * A single type, as part of a struct. The `type` field can be any of the EIP-712 supported types.
22
3
  *
23
4
  * Note that the `uint` and `int` aliases like in Solidity, and fixed point numbers are not supported by the EIP-712
24
5
  * standard.
25
6
  */
26
- export declare type StarkNetType = Infer<typeof STARKNET_TYPE>;
27
- export declare const STARKNET_DOMAIN_TYPE: import("superstruct").Struct<{
28
- version?: string | undefined;
29
- chainId?: string | number | undefined;
30
- name?: string | undefined;
31
- }, {
32
- name: import("superstruct").Struct<string | undefined, null>;
33
- version: import("superstruct").Struct<string | undefined, null>;
34
- chainId: import("superstruct").Struct<string | number | undefined, null>;
35
- }>;
7
+ export interface StarkNetType {
8
+ name: string;
9
+ type: 'felt' | 'felt*' | string;
10
+ }
36
11
  /**
37
12
  * The EIP712 domain struct. Any of these fields are optional, but it must contain at least one field.
38
13
  */
39
- export declare type StarkNetDomain = Infer<typeof STARKNET_DOMAIN_TYPE>;
40
- export declare const STARKNET_TYPED_DATA_TYPE: import("superstruct").Struct<{
41
- types: {
42
- StarkNetDomain: {
43
- type: string;
44
- name: string;
45
- }[];
46
- } & Record<string, {
47
- type: string;
48
- name: string;
49
- }[]>;
50
- primaryType: string;
51
- domain: {
52
- version?: string | undefined;
53
- chainId?: string | number | undefined;
54
- name?: string | undefined;
55
- };
56
- message: Record<string, unknown>;
57
- }, {
58
- types: import("superstruct").Struct<{
59
- StarkNetDomain: {
60
- type: string;
61
- name: string;
62
- }[];
63
- } & Record<string, {
64
- type: string;
65
- name: string;
66
- }[]>, null>;
67
- primaryType: import("superstruct").Struct<string, null>;
68
- domain: import("superstruct").Struct<{
69
- version?: string | undefined;
70
- chainId?: string | number | undefined;
71
- name?: string | undefined;
72
- }, {
73
- name: import("superstruct").Struct<string | undefined, null>;
74
- version: import("superstruct").Struct<string | undefined, null>;
75
- chainId: import("superstruct").Struct<string | number | undefined, null>;
76
- }>;
77
- message: import("superstruct").Struct<Record<string, unknown>, null>;
78
- }>;
14
+ export interface StarkNetDomain extends Record<string, unknown> {
15
+ name?: string;
16
+ version?: string;
17
+ chainId?: string | number;
18
+ }
79
19
  /**
80
20
  * The complete typed data, with all the structs, domain data, primary type of the message, and the message itself.
81
21
  */
82
- export declare type TypedData = Infer<typeof STARKNET_TYPED_DATA_TYPE>;
22
+ export interface TypedData {
23
+ types: Record<string, StarkNetType[]>;
24
+ primaryType: string;
25
+ domain: StarkNetDomain;
26
+ message: Record<string, unknown>;
27
+ }
@@ -1,47 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STARKNET_TYPED_DATA_TYPE = exports.STARKNET_DOMAIN_TYPE = exports.STARKNET_TYPE = exports.isValidType = exports.ATOMIC_TYPES = void 0;
4
- var superstruct_1 = require("superstruct");
5
- exports.ATOMIC_TYPES = ['felt', 'felt*'];
6
- // Source: https://github.com/Mrtenz/eip-712/blob/master/src/eip-712.ts
7
- // and modified to support starknet types
8
- /**
9
- * Checks if a type is valid with the given `typedData`. The following types are valid:
10
- * - Atomic types: felt, felt*
11
- * - Reference types: struct type (e.g. SomeStruct)
12
- *
13
- * @param {Record<string, unknown>} types
14
- * @param {string} type
15
- * @return {boolean}
16
- */
17
- var isValidType = function (types, type) {
18
- if (exports.ATOMIC_TYPES.includes(type)) {
19
- return true;
20
- }
21
- if (types[type]) {
22
- return true;
23
- }
24
- return false;
25
- };
26
- exports.isValidType = isValidType;
27
- var TYPE = (0, superstruct_1.refine)((0, superstruct_1.string)(), 'Type', function (type, context) {
28
- return (0, exports.isValidType)(context.branch[0].types, type);
29
- });
30
- exports.STARKNET_TYPE = (0, superstruct_1.object)({
31
- name: (0, superstruct_1.string)(),
32
- type: TYPE,
33
- });
34
- exports.STARKNET_DOMAIN_TYPE = (0, superstruct_1.object)({
35
- name: (0, superstruct_1.optional)((0, superstruct_1.string)()),
36
- version: (0, superstruct_1.optional)((0, superstruct_1.string)()),
37
- chainId: (0, superstruct_1.optional)((0, superstruct_1.union)([(0, superstruct_1.string)(), (0, superstruct_1.number)()])),
38
- });
39
- exports.STARKNET_TYPED_DATA_TYPE = (0, superstruct_1.object)({
40
- types: (0, superstruct_1.intersection)([
41
- (0, superstruct_1.type)({ StarkNetDomain: (0, superstruct_1.array)(exports.STARKNET_TYPE) }),
42
- (0, superstruct_1.record)((0, superstruct_1.string)(), (0, superstruct_1.array)(exports.STARKNET_TYPE)),
43
- ]),
44
- primaryType: (0, superstruct_1.string)(),
45
- domain: exports.STARKNET_DOMAIN_TYPE,
46
- message: (0, superstruct_1.object)(),
47
- });
@@ -1,24 +1,8 @@
1
+ import { TypedData } from './types';
1
2
  /**
2
3
  * Validates that `data` matches the EIP-712 JSON schema.
3
4
  *
4
5
  * @param {any} data
5
6
  * @return {boolean}
6
7
  */
7
- export declare const validateTypedData: (data: unknown) => data is {
8
- types: {
9
- StarkNetDomain: {
10
- type: string;
11
- name: string;
12
- }[];
13
- } & Record<string, {
14
- type: string;
15
- name: string;
16
- }[]>;
17
- primaryType: string;
18
- domain: {
19
- version?: string | undefined;
20
- chainId?: string | number | undefined;
21
- name?: string | undefined;
22
- };
23
- message: Record<string, unknown>;
24
- };
8
+ export declare const validateTypedData: (data: unknown) => data is TypedData;
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateTypedData = void 0;
4
- var superstruct_1 = require("superstruct");
5
- var types_1 = require("./types");
6
4
  /**
7
5
  * Validates that `data` matches the EIP-712 JSON schema.
8
6
  *
@@ -10,6 +8,9 @@ var types_1 = require("./types");
10
8
  * @return {boolean}
11
9
  */
12
10
  var validateTypedData = function (data) {
13
- return (0, superstruct_1.is)(data, types_1.STARKNET_TYPED_DATA_TYPE);
11
+ var typedData = data;
12
+ // Validate that the data matches the EIP-712 JSON schema
13
+ var valid = Boolean(typedData.types && typedData.primaryType && typedData.message);
14
+ return valid;
14
15
  };
15
16
  exports.validateTypedData = validateTypedData;
package/index.js CHANGED
@@ -4,12 +4,16 @@ var __createBinding =
4
4
  (Object.create
5
5
  ? function (o, m, k, k2) {
6
6
  if (k2 === undefined) k2 = k;
7
- Object.defineProperty(o, k2, {
8
- enumerable: true,
9
- get: function () {
10
- return m[k];
11
- },
12
- });
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k];
13
+ },
14
+ };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
13
17
  }
14
18
  : function (o, m, k, k2) {
15
19
  if (k2 === undefined) k2 = k;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starknet",
3
- "version": "3.12.1",
3
+ "version": "3.13.0",
4
4
  "description": "JavaScript library for StarkNet",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,50 +27,52 @@
27
27
  "author": "Sean Han",
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@babel/preset-env": "^7.15.8",
31
- "@babel/preset-typescript": "^7.15.0",
32
- "@commitlint/cli": "^13.2.1",
33
- "@commitlint/config-conventional": "^13.2.0",
34
- "@semantic-release/changelog": "^6.0.0",
35
- "@semantic-release/commit-analyzer": "^9.0.1",
36
- "@semantic-release/git": "^10.0.0",
37
- "@semantic-release/npm": "^8.0.2",
38
- "@semantic-release/release-notes-generator": "^10.0.2",
39
- "@types/elliptic": "^6.4.13",
40
- "@types/jest": "^27.0.2",
30
+ "@babel/plugin-transform-modules-commonjs": "^7.18.2",
31
+ "@babel/preset-env": "^7.18.2",
32
+ "@babel/preset-typescript": "^7.17.12",
33
+ "@commitlint/cli": "^17.0.2",
34
+ "@commitlint/config-conventional": "^17.0.2",
35
+ "@semantic-release/changelog": "^6.0.1",
36
+ "@semantic-release/commit-analyzer": "^9.0.2",
37
+ "@semantic-release/git": "^10.0.1",
38
+ "@semantic-release/npm": "^9.0.1",
39
+ "@semantic-release/release-notes-generator": "^10.0.3",
40
+ "@types/elliptic": "^6.4.14",
41
+ "@types/jest": "^28.1.1",
41
42
  "@types/json-bigint": "^1.0.1",
42
43
  "@types/minimalistic-assert": "^1.0.1",
43
- "@types/pako": "^1.0.2",
44
+ "@types/pako": "^2.0.0",
44
45
  "@types/url-join": "^4.0.1",
45
- "@typescript-eslint/eslint-plugin": "^5.0.0",
46
- "@typescript-eslint/parser": "^5.0.0",
47
- "axios-logger": "^2.6.0",
48
- "eslint": "^7.32.0",
49
- "eslint-config-airbnb-base": "^14.2.1",
50
- "eslint-config-airbnb-typescript": "^14.0.1",
51
- "eslint-config-prettier": "^8.3.0",
52
- "eslint-plugin-import": "^2.25.2",
46
+ "@typescript-eslint/eslint-plugin": "^5.28.0",
47
+ "@typescript-eslint/parser": "^5.28.0",
48
+ "eslint": "^8.17.0",
49
+ "eslint-config-airbnb-base": "^15.0.0",
50
+ "eslint-config-airbnb-typescript": "^17.0.0",
51
+ "eslint-config-prettier": "^8.5.0",
52
+ "eslint-plugin-import": "^2.26.0",
53
53
  "eslint-plugin-prettier": "^4.0.0",
54
- "husky": "^7.0.2",
54
+ "husky": "^8.0.1",
55
55
  "import-sort-style-module": "^6.0.0",
56
- "jest": "^27.3.0",
57
- "lint-staged": "^11.2.3",
58
- "prettier": "^2.4.1",
56
+ "jest": "^28.1.1",
57
+ "jest-environment-jsdom": "^28.1.1",
58
+ "lint-staged": "^13.0.1",
59
+ "prettier": "^2.7.0",
59
60
  "prettier-plugin-import-sort": "^0.0.7",
60
- "typedoc": "^0.22.6",
61
- "typescript": "^4.4.4"
61
+ "typedoc": "^0.22.17",
62
+ "typescript": "^4.7.3",
63
+ "whatwg-fetch": "^3.6.2"
62
64
  },
63
65
  "dependencies": {
64
66
  "@ethersproject/bytes": "^5.6.1",
65
- "axios": "^0.23.0",
66
- "bn.js": "^5.2.0",
67
+ "bn.js": "^5.2.1",
68
+ "cross-fetch": "^3.1.5",
67
69
  "elliptic": "^6.5.4",
68
- "ethereum-cryptography": "^0.2.0",
70
+ "ethereum-cryptography": "^1.0.3",
71
+ "fetch-intercept": "^2.4.0",
69
72
  "hash.js": "^1.1.7",
70
73
  "json-bigint": "^1.0.0",
71
74
  "minimalistic-assert": "^1.0.1",
72
75
  "pako": "^2.0.4",
73
- "superstruct": "^0.15.3",
74
76
  "url-join": "^4.0.1"
75
77
  },
76
78
  "lint-staged": {
@@ -109,7 +109,7 @@ export declare class Provider implements ProviderInterface {
109
109
  */
110
110
  getStorageAt(
111
111
  contractAddress: string,
112
- key: number,
112
+ key: BigNumberish,
113
113
  blockIdentifier?: BlockIdentifier
114
114
  ): Promise<object>;
115
115
  /**
@@ -173,7 +173,7 @@ var __importDefault =
173
173
  };
174
174
  Object.defineProperty(exports, '__esModule', { value: true });
175
175
  exports.Provider = void 0;
176
- var axios_1 = __importDefault(require('axios'));
176
+ var cross_fetch_1 = __importDefault(require('cross-fetch'));
177
177
  var url_join_1 = __importDefault(require('url-join'));
178
178
  var constants_1 = require('../constants');
179
179
  var hash_1 = require('../utils/hash');
@@ -184,7 +184,7 @@ var interface_1 = require('./interface');
184
184
  var utils_1 = require('./utils');
185
185
  function wait(delay) {
186
186
  return new Promise(function (res) {
187
- return setTimeout(res, delay);
187
+ setTimeout(res, delay);
188
188
  });
189
189
  }
190
190
  function isEmptyQueryObject(obj) {
@@ -242,7 +242,7 @@ var Provider = /** @class */ (function () {
242
242
  }
243
243
  } catch (_a) {
244
244
  // eslint-disable-next-line no-console
245
- console.error('Could not parse baseUrl: ' + baseUrl);
245
+ console.error('Could not parse baseUrl: '.concat(baseUrl));
246
246
  }
247
247
  return constants_1.StarknetChainId.TESTNET;
248
248
  };
@@ -264,12 +264,12 @@ var Provider = /** @class */ (function () {
264
264
  key = _b[0],
265
265
  value = _b[1];
266
266
  if (key === 'blockIdentifier') {
267
- return '' + (0, utils_1.getFormattedBlockIdentifier)(value);
267
+ return ''.concat((0, utils_1.getFormattedBlockIdentifier)(value));
268
268
  }
269
- return key + '=' + value;
269
+ return ''.concat(key, '=').concat(value);
270
270
  })
271
271
  .join('&');
272
- return '?' + queryString;
272
+ return '?'.concat(queryString);
273
273
  };
274
274
  Provider.prototype.getHeaders = function (method) {
275
275
  if (method === 'POST') {
@@ -281,9 +281,8 @@ var Provider = /** @class */ (function () {
281
281
  };
282
282
  // typesafe fetch
283
283
  Provider.prototype.fetchEndpoint = function (endpoint) {
284
- var _a;
285
284
  // typescript type magiuc to create a nice fitting function interface
286
- var _b = []; // when both query and request are needed, we cant omit anything
285
+ var _a = []; // when both query and request are needed, we cant omit anything
287
286
  for (
288
287
  // typescript type magiuc to create a nice fitting function interface
289
288
  var _i = 1; // when both query and request are needed, we cant omit anything
@@ -293,61 +292,42 @@ var Provider = /** @class */ (function () {
293
292
  _i++ // when both query and request are needed, we cant omit anything
294
293
  ) {
295
294
  // typescript type magiuc to create a nice fitting function interface
296
- _b[_i - 1] = arguments[_i]; // when both query and request are needed, we cant omit anything
295
+ _a[_i - 1] = arguments[_i]; // when both query and request are needed, we cant omit anything
297
296
  }
298
297
  // typescript type magiuc to create a nice fitting function interface
299
- var _c = __read(_b, 2),
300
- query = _c[0],
301
- request = _c[1]; // when both query and request are needed, we cant omit anything
298
+ var _b = __read(_a, 2),
299
+ query = _b[0],
300
+ request = _b[1]; // when both query and request are needed, we cant omit anything
302
301
  return __awaiter(this, void 0, void 0, function () {
303
- var baseUrl, method, queryString, headers, data, error_1, data;
304
- return __generator(this, function (_d) {
305
- switch (_d.label) {
306
- case 0:
307
- baseUrl = this.getFetchUrl(endpoint);
308
- method = this.getFetchMethod(endpoint);
309
- queryString = this.getQueryString(query);
310
- headers = this.getHeaders(method);
311
- _d.label = 1;
312
- case 1:
313
- _d.trys.push([1, 3, , 4]);
314
- return [
315
- 4 /*yield*/,
316
- axios_1.default.request({
317
- method: method,
318
- transformResponse:
319
- endpoint === 'estimate_fee'
320
- ? function (res) {
321
- return (0, json_1.parse)(res, function (_, v) {
322
- if (v && typeof v === 'bigint') {
323
- return (0, number_1.toBN)(v.toString());
324
- }
325
- return v;
326
- });
327
- }
328
- : axios_1.default.defaults.transformResponse,
329
- url: (0, url_join_1.default)(baseUrl, endpoint, queryString),
330
- data: (0, json_1.stringify)(request),
331
- headers: headers,
332
- }),
333
- ];
334
- case 2:
335
- data = _d.sent().data;
336
- return [2 /*return*/, data];
337
- case 3:
338
- error_1 = _d.sent();
339
- data =
340
- (_a = error_1 === null || error_1 === void 0 ? void 0 : error_1.response) === null ||
341
- _a === void 0
342
- ? void 0
343
- : _a.data;
344
- if (data === null || data === void 0 ? void 0 : data.message) {
345
- throw new Error(data.code + ': ' + data.message);
346
- }
347
- throw error_1;
348
- case 4:
349
- return [2 /*return*/];
350
- }
302
+ var baseUrl, method, queryString, headers, url;
303
+ return __generator(this, function (_c) {
304
+ baseUrl = this.getFetchUrl(endpoint);
305
+ method = this.getFetchMethod(endpoint);
306
+ queryString = this.getQueryString(query);
307
+ headers = this.getHeaders(method);
308
+ url = (0, url_join_1.default)(baseUrl, endpoint, queryString);
309
+ return [
310
+ 2 /*return*/,
311
+ (0, cross_fetch_1.default)(url, {
312
+ method: method,
313
+ body: (0, json_1.stringify)(request),
314
+ headers: headers,
315
+ })
316
+ .then(function (res) {
317
+ return res.text();
318
+ })
319
+ .then(function (res) {
320
+ if (endpoint === 'estimate_fee') {
321
+ return (0, json_1.parse)(res, function (_, v) {
322
+ if (v && typeof v === 'bigint') {
323
+ return (0, number_1.toBN)(v.toString());
324
+ }
325
+ return v;
326
+ });
327
+ }
328
+ return (0, json_1.parse)(res);
329
+ }),
330
+ ];
351
331
  });
352
332
  });
353
333
  };
@@ -629,11 +609,10 @@ var Provider = /** @class */ (function () {
629
609
  onchain = true;
630
610
  } else if (errorStates.includes(res.tx_status)) {
631
611
  message = res.tx_failure_reason
632
- ? res.tx_status +
633
- ': ' +
634
- res.tx_failure_reason.code +
635
- '\n' +
636
- res.tx_failure_reason.error_message
612
+ ? ''
613
+ .concat(res.tx_status, ': ')
614
+ .concat(res.tx_failure_reason.code, '\n')
615
+ .concat(res.tx_failure_reason.error_message)
637
616
  : res.tx_status;
638
617
  error = new Error(message);
639
618
  error.response = res;
package/provider/index.js CHANGED
@@ -4,12 +4,16 @@ var __createBinding =
4
4
  (Object.create
5
5
  ? function (o, m, k, k2) {
6
6
  if (k2 === undefined) k2 = k;
7
- Object.defineProperty(o, k2, {
8
- enumerable: true,
9
- get: function () {
10
- return m[k];
11
- },
12
- });
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k];
13
+ },
14
+ };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
13
17
  }
14
18
  : function (o, m, k, k2) {
15
19
  if (k2 === undefined) k2 = k;
@@ -75,7 +75,7 @@ export declare abstract class ProviderInterface {
75
75
  */
76
76
  abstract getStorageAt(
77
77
  contractAddress: string,
78
- key: number,
78
+ key: BigNumberish,
79
79
  blockIdentifier?: BlockIdentifier
80
80
  ): Promise<object>;
81
81
  /**
package/provider/utils.js CHANGED
@@ -26,10 +26,10 @@ exports.formatHash = formatHash;
26
26
  */
27
27
  function txIdentifier(txHash, txId) {
28
28
  if (!txHash) {
29
- return 'transactionId=' + JSON.stringify(txId);
29
+ return 'transactionId='.concat(JSON.stringify(txId));
30
30
  }
31
31
  var hashString = formatHash(txHash);
32
- return 'transactionHash=' + hashString;
32
+ return 'transactionHash='.concat(hashString);
33
33
  }
34
34
  exports.txIdentifier = txIdentifier;
35
35
  /**
@@ -55,7 +55,7 @@ function getBlockIdentifier(blockIdentifier) {
55
55
  return { type: 'BLOCK_NUMBER', data: parseInt(blockIdentifier, 10) };
56
56
  }
57
57
  if (typeof blockIdentifier === 'string') {
58
- throw new Error('Invalid block identifier: ' + blockIdentifier);
58
+ throw new Error('Invalid block identifier: '.concat(blockIdentifier));
59
59
  }
60
60
  return { type: 'BLOCK_HASH', data: blockIdentifier };
61
61
  }
@@ -77,8 +77,8 @@ function getFormattedBlockIdentifier(blockIdentifier) {
77
77
  return '';
78
78
  }
79
79
  if (blockIdentifierObject.type === 'BLOCK_NUMBER') {
80
- return 'blockNumber=' + blockIdentifierObject.data;
80
+ return 'blockNumber='.concat(blockIdentifierObject.data);
81
81
  }
82
- return 'blockHash=' + (0, number_1.toHex)((0, number_1.toBN)(blockIdentifierObject.data));
82
+ return 'blockHash='.concat((0, number_1.toHex)((0, number_1.toBN)(blockIdentifierObject.data)));
83
83
  }
84
84
  exports.getFormattedBlockIdentifier = getFormattedBlockIdentifier;
package/signer/index.js CHANGED
@@ -4,12 +4,16 @@ var __createBinding =
4
4
  (Object.create
5
5
  ? function (o, m, k, k2) {
6
6
  if (k2 === undefined) k2 = k;
7
- Object.defineProperty(o, k2, {
8
- enumerable: true,
9
- get: function () {
10
- return m[k];
11
- },
12
- });
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k];
13
+ },
14
+ };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
13
17
  }
14
18
  : function (o, m, k, k2) {
15
19
  if (k2 === undefined) k2 = k;