@metamask-previews/controller-utils 12.3.0-preview-4f4c98e → 12.3.0-preview-5b293ee50

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 (83) hide show
  1. package/CHANGELOG.md +0 -4
  2. package/dist/abi.cjs +58 -0
  3. package/dist/abi.cjs.map +1 -0
  4. package/dist/{abi.d.ts → abi.d.cts} +3 -3
  5. package/dist/abi.d.cts.map +1 -0
  6. package/dist/abi.d.mts +16 -0
  7. package/dist/abi.d.mts.map +1 -0
  8. package/dist/{abi.js → abi.mjs} +3 -3
  9. package/dist/{abi.js.map → abi.mjs.map} +1 -1
  10. package/dist/constants.cjs +308 -0
  11. package/dist/constants.cjs.map +1 -0
  12. package/dist/{constants.d.ts → constants.d.cts} +3 -3
  13. package/dist/constants.d.cts.map +1 -0
  14. package/dist/constants.d.mts +283 -0
  15. package/dist/constants.d.mts.map +1 -0
  16. package/dist/{constants.js → constants.mjs} +2 -2
  17. package/dist/constants.mjs.map +1 -0
  18. package/dist/create-service-policy.cjs +250 -0
  19. package/dist/create-service-policy.cjs.map +1 -0
  20. package/dist/{create-service-policy.d.ts → create-service-policy.d.cts} +3 -3
  21. package/dist/create-service-policy.d.cts.map +1 -0
  22. package/dist/create-service-policy.d.mts +249 -0
  23. package/dist/create-service-policy.d.mts.map +1 -0
  24. package/dist/{create-service-policy.js → create-service-policy.mjs} +3 -3
  25. package/dist/create-service-policy.mjs.map +1 -0
  26. package/dist/index.cjs +102 -0
  27. package/dist/index.cjs.map +1 -0
  28. package/dist/{index.d.ts → index.d.cts} +9 -9
  29. package/dist/index.d.cts.map +1 -0
  30. package/dist/index.d.mts +9 -0
  31. package/dist/index.d.mts.map +1 -0
  32. package/dist/{index.js → index.mjs} +7 -7
  33. package/dist/index.mjs.map +1 -0
  34. package/dist/logger.cjs +7 -0
  35. package/dist/logger.cjs.map +1 -0
  36. package/dist/logger.d.cts +5 -0
  37. package/dist/logger.d.cts.map +1 -0
  38. package/dist/logger.d.mts +5 -0
  39. package/dist/logger.d.mts.map +1 -0
  40. package/dist/logger.mjs +4 -0
  41. package/dist/logger.mjs.map +1 -0
  42. package/dist/siwe.cjs +131 -0
  43. package/dist/siwe.cjs.map +1 -0
  44. package/dist/{siwe.d.ts → siwe.d.cts} +2 -2
  45. package/dist/siwe.d.cts.map +1 -0
  46. package/dist/siwe.d.mts +69 -0
  47. package/dist/siwe.d.mts.map +1 -0
  48. package/dist/{siwe.js → siwe.mjs} +4 -4
  49. package/dist/siwe.mjs.map +1 -0
  50. package/dist/types.cjs +232 -0
  51. package/dist/types.cjs.map +1 -0
  52. package/dist/{types.d.ts → types.d.cts} +98 -98
  53. package/dist/types.d.cts.map +1 -0
  54. package/dist/types.d.mts +267 -0
  55. package/dist/types.d.mts.map +1 -0
  56. package/dist/{types.js → types.mjs} +1 -1
  57. package/dist/types.mjs.map +1 -0
  58. package/dist/util.cjs +569 -0
  59. package/dist/util.cjs.map +1 -0
  60. package/dist/{util.d.ts → util.d.cts} +6 -6
  61. package/dist/util.d.cts.map +1 -0
  62. package/dist/util.d.mts +261 -0
  63. package/dist/util.d.mts.map +1 -0
  64. package/dist/{util.js → util.mjs} +18 -8
  65. package/dist/util.mjs.map +1 -0
  66. package/package.json +18 -14
  67. package/dist/abi.d.ts.map +0 -1
  68. package/dist/constants.d.ts.map +0 -1
  69. package/dist/constants.js.map +0 -1
  70. package/dist/create-service-policy.d.ts.map +0 -1
  71. package/dist/create-service-policy.js.map +0 -1
  72. package/dist/index.d.ts.map +0 -1
  73. package/dist/index.js.map +0 -1
  74. package/dist/logger.d.ts +0 -4
  75. package/dist/logger.d.ts.map +0 -1
  76. package/dist/logger.js +0 -4
  77. package/dist/logger.js.map +0 -1
  78. package/dist/siwe.d.ts.map +0 -1
  79. package/dist/siwe.js.map +0 -1
  80. package/dist/types.d.ts.map +0 -1
  81. package/dist/types.js.map +0 -1
  82. package/dist/util.d.ts.map +0 -1
  83. package/dist/util.js.map +0 -1
@@ -0,0 +1,261 @@
1
+ import type EthQuery from "@metamask/eth-query";
2
+ import type { Hex, Json } from "@metamask/utils";
3
+ import type { BigNumber } from "bignumber.js";
4
+ import BN from "bn.js";
5
+ export type { BigNumber };
6
+ export declare const PROTOTYPE_POLLUTION_BLOCKLIST: readonly ["__proto__", "constructor", "prototype"];
7
+ /**
8
+ * Checks whether a dynamic property key could be used in
9
+ * a [prototype pollution attack](https://portswigger.net/web-security/prototype-pollution).
10
+ *
11
+ * @param key - The dynamic key to validate.
12
+ * @returns Whether the given dynamic key is safe to use.
13
+ */
14
+ export declare function isSafeDynamicKey(key: string): boolean;
15
+ /**
16
+ * Checks whether the given number primitive chain ID is safe.
17
+ * Because some cryptographic libraries we use expect the chain ID to be a
18
+ * number primitive, it must not exceed a certain size.
19
+ *
20
+ * @param chainId - The chain ID to check for safety.
21
+ * @returns Whether the given chain ID is safe.
22
+ */
23
+ export declare function isSafeChainId(chainId: Hex): boolean;
24
+ /**
25
+ * Converts a BN or BigNumber object to a hex string with a '0x' prefix.
26
+ *
27
+ * @param inputBn - BN|BigNumber instance to convert to a hex string.
28
+ * @returns A '0x'-prefixed hex string.
29
+ */
30
+ export declare function BNToHex(inputBn: BN | BigNumber): Hex;
31
+ /**
32
+ * Used to multiply a BN by a fraction.
33
+ *
34
+ * @param targetBN - Number to multiply by a fraction.
35
+ * @param numerator - Numerator of the fraction multiplier.
36
+ * @param denominator - Denominator of the fraction multiplier.
37
+ * @returns Product of the multiplication.
38
+ */
39
+ export declare function fractionBN(targetBN: BN, numerator: number | string, denominator: number | string): BN;
40
+ /**
41
+ * Used to convert a base-10 number from GWEI to WEI. Can handle numbers with decimal parts.
42
+ *
43
+ * @param value - The base 10 number to convert to WEI.
44
+ * @returns The number in WEI, as a BN.
45
+ */
46
+ export declare function gweiDecToWEIBN(value: number | string): BN;
47
+ /**
48
+ * Used to convert values from wei hex format to dec gwei format.
49
+ *
50
+ * @param hexValue - The value in hex wei.
51
+ * @returns The value in dec gwei as string.
52
+ */
53
+ export declare function weiHexToGweiDec(hexValue: string): string;
54
+ /**
55
+ * Return a URL that can be used to obtain ETH for a given network.
56
+ *
57
+ * @param networkCode - Network code of desired network.
58
+ * @param address - Address to deposit obtained ETH.
59
+ * @param amount - How much ETH is desired.
60
+ * @returns URL to buy ETH based on network.
61
+ */
62
+ export declare function getBuyURL(networkCode?: string, address?: string, amount?: number): string | undefined;
63
+ /**
64
+ * Converts a hex string to a BN object.
65
+ *
66
+ * @param inputHex - Number represented as a hex string.
67
+ * @returns A BN instance.
68
+ */
69
+ export declare function hexToBN(inputHex: string): BN;
70
+ /**
71
+ * A helper function that converts hex data to human readable string.
72
+ *
73
+ * @param hexValue - The hex string to convert to string.
74
+ * @returns A human readable string conversion.
75
+ */
76
+ export declare function hexToText(hexValue: string): string;
77
+ /**
78
+ * Parses a hex string and converts it into a number that can be operated on in a bignum-safe,
79
+ * base-10 way.
80
+ *
81
+ * @param value - A base-16 number encoded as a string.
82
+ * @returns The number as a BN object in base-16 mode.
83
+ */
84
+ export declare function fromHex(value: string | BN): BN;
85
+ /**
86
+ * Converts an integer to a hexadecimal representation.
87
+ *
88
+ * @param value - An integer, an integer encoded as a base-10 string, or a BN.
89
+ * @returns The integer encoded as a hex string.
90
+ */
91
+ export declare function toHex(value: number | bigint | string | BN): Hex;
92
+ /**
93
+ * Execute and return an asynchronous operation without throwing errors.
94
+ *
95
+ * @param operation - Function returning a Promise.
96
+ * @param logError - Determines if the error should be logged.
97
+ * @template Result - Type of the result of the async operation
98
+ * @returns Promise resolving to the result of the async operation.
99
+ */
100
+ export declare function safelyExecute<Result>(operation: () => Promise<Result>, logError?: boolean): Promise<Result | undefined>;
101
+ /**
102
+ * Execute and return an asynchronous operation with a timeout.
103
+ *
104
+ * @param operation - Function returning a Promise.
105
+ * @param logError - Determines if the error should be logged.
106
+ * @param timeout - Timeout to fail the operation.
107
+ * @template Result - Type of the result of the async operation
108
+ * @returns Promise resolving to the result of the async operation.
109
+ */
110
+ export declare function safelyExecuteWithTimeout<Result>(operation: () => Promise<Result>, logError?: boolean, timeout?: number): Promise<Result | undefined>;
111
+ /**
112
+ * Convert an address to a checksummed hexadecimal address.
113
+ *
114
+ * @param address - The address to convert. For backward compatibility reasons,
115
+ * this can be anything, even a non-hex string with an 0x prefix, but that usage
116
+ * is deprecated. Please use a valid hex string (with or without the `0x`
117
+ * prefix).
118
+ * @returns A 0x-prefixed checksummed version of `address` if it is a valid hex
119
+ * string, or the address as given otherwise.
120
+ */
121
+ export declare const toChecksumHexAddress: {
122
+ (address: string): string;
123
+ <Type>(address: Type): Type;
124
+ };
125
+ /**
126
+ * Validates that the input is a hex address. This utility method is a thin
127
+ * wrapper around `isValidHexAddress` from `@metamask/utils`, with the exception
128
+ * that it may return true for non-0x-prefixed hex strings (depending on the
129
+ * option below).
130
+ *
131
+ * @param possibleAddress - Input parameter to check against.
132
+ * @param options - The validation options.
133
+ * @param options.allowNonPrefixed - If true will regard addresses without a
134
+ * `0x` prefix as valid.
135
+ * @returns Whether or not the input is a valid hex address.
136
+ */
137
+ export declare const isValidHexAddress: (possibleAddress: string, options?: {
138
+ allowNonPrefixed?: boolean;
139
+ }) => boolean;
140
+ /**
141
+ * Returns whether the given code corresponds to a smart contract.
142
+ *
143
+ * @param code - The potential smart contract code.
144
+ * @returns Whether the code was smart contract code or not.
145
+ */
146
+ export declare function isSmartContractCode(code: string): boolean;
147
+ /**
148
+ * An error representing a non-200 HTTP response.
149
+ */
150
+ export declare class HttpError extends Error {
151
+ httpStatus: number;
152
+ /**
153
+ * Construct an HTTP error.
154
+ *
155
+ * @param status - The HTTP response status.
156
+ * @param message - The error message.
157
+ */
158
+ constructor(status: number, message?: string);
159
+ }
160
+ /**
161
+ * Execute fetch and verify that the response was successful.
162
+ *
163
+ * @param request - Request information.
164
+ * @param options - Fetch options.
165
+ * @returns The fetch response.
166
+ */
167
+ export declare function successfulFetch(request: URL | RequestInfo, options?: RequestInit): Promise<Response>;
168
+ /**
169
+ * Execute fetch and return object response.
170
+ *
171
+ * @param request - The request information.
172
+ * @param options - The fetch options.
173
+ * @returns The fetch response JSON data.
174
+ */
175
+ export declare function handleFetch(request: URL | RequestInfo, options?: RequestInit): Promise<any>;
176
+ /**
177
+ * Execute fetch and return object response, log if known error thrown, otherwise rethrow error.
178
+ *
179
+ * @param request - the request options object
180
+ * @param request.url - The request url to query.
181
+ * @param request.options - The fetch options.
182
+ * @param request.timeout - Timeout to fail request
183
+ * @param request.errorCodesToCatch - array of error codes for errors we want to catch in a particular context
184
+ * @returns The fetch response JSON data or undefined (if error occurs).
185
+ */
186
+ export declare function fetchWithErrorHandling({ url, options, timeout, errorCodesToCatch, }: {
187
+ url: string;
188
+ options?: RequestInit;
189
+ timeout?: number;
190
+ errorCodesToCatch?: number[];
191
+ }): Promise<any>;
192
+ /**
193
+ * Fetch that fails after timeout.
194
+ *
195
+ * @param url - Url to fetch.
196
+ * @param options - Options to send with the request.
197
+ * @param timeout - Timeout to fail request.
198
+ * @returns Promise resolving the request.
199
+ */
200
+ export declare function timeoutFetch(url: string, options?: RequestInit, timeout?: number): Promise<Response>;
201
+ /**
202
+ * Normalizes the given ENS name.
203
+ *
204
+ * @param ensName - The ENS name.
205
+ * @returns The normalized ENS name string.
206
+ */
207
+ export declare function normalizeEnsName(ensName: string): string | null;
208
+ /**
209
+ * Wrapper method to handle EthQuery requests.
210
+ *
211
+ * @param ethQuery - EthQuery object initialized with a provider.
212
+ * @param method - Method to request.
213
+ * @param args - Arguments to send.
214
+ * @returns Promise resolving the request.
215
+ */
216
+ export declare function query(ethQuery: EthQuery, method: string, args?: any[]): Promise<any>;
217
+ /**
218
+ * Converts valid hex strings to decimal numbers, and handles unexpected arg types.
219
+ *
220
+ * @param value - a string that is either a hexadecimal with `0x` prefix or a decimal string.
221
+ * @returns a decimal number.
222
+ */
223
+ export declare const convertHexToDecimal: (value?: string | undefined) => number;
224
+ type PlainObject = Record<number | string | symbol, unknown>;
225
+ /**
226
+ * Determines whether a value is a "plain" object.
227
+ *
228
+ * @param value - A value to check
229
+ * @returns True if the passed value is a plain object
230
+ */
231
+ export declare function isPlainObject(value: unknown): value is PlainObject;
232
+ /**
233
+ * Like {@link Array}, but always non-empty.
234
+ *
235
+ * @template T - The non-empty array member type.
236
+ */
237
+ export type NonEmptyArray<Type> = [Type, ...Type[]];
238
+ /**
239
+ * Type guard for {@link NonEmptyArray}.
240
+ *
241
+ * @template T - The non-empty array member type.
242
+ * @param value - The value to check.
243
+ * @returns Whether the value is a non-empty array.
244
+ */
245
+ export declare function isNonEmptyArray<Type>(value: Type[]): value is NonEmptyArray<Type>;
246
+ /**
247
+ * Type guard for {@link Json}.
248
+ *
249
+ * @param value - The value to check.
250
+ * @returns Whether the value is valid JSON.
251
+ */
252
+ export declare function isValidJson(value: unknown): value is Json;
253
+ /**
254
+ * Checks if two strings are equal, ignoring case.
255
+ *
256
+ * @param value1 - The first string to compare.
257
+ * @param value2 - The second string to compare.
258
+ * @returns `true` if the strings are equal, ignoring case; otherwise, `false`.
259
+ */
260
+ export declare function isEqualCaseInsensitive(value1: string, value2: string): boolean;
261
+ //# sourceMappingURL=util.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.mts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,4BAA4B;AAEhD,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,wBAAwB;AASjD,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB;AAC9C,OAAO,EAAE,cAAc;AAOvB,YAAY,EAAE,SAAS,EAAE,CAAC;AAI1B,eAAO,MAAM,6BAA6B,oDAIhC,CAAC;AAEX;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAKrD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAanD;AACD;;;;;GAKG;AAGH,wBAAgB,OAAO,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AAO,CAAC,EAAE,WAAW,EACrB,OAAO,SAAM,GACZ,OAAO,CAAC,QAAQ,CAAC,CASnB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiB/D;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CACnB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EAGd,IAAI,GAAE,GAAG,EAAO,GAGf,OAAO,CAAC,GAAG,CAAC,CAqBd;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,WACvB,MAAM,GAAG,SAAS,KACxB,MAMF,CAAC;AAEF,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7D;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;AAEpD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAClC,KAAK,EAAE,IAAI,EAAE,GACZ,KAAK,IAAI,aAAa,CAAC,IAAI,CAAC,CAE9B;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAMzD;AAiCD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,OAAO,CAKT"}
@@ -1,10 +1,20 @@
1
- import { fromWei, toWei } from '@metamask/ethjs-unit';
2
- import { isStrictHexString, add0x, isHexString, remove0x, getChecksumAddress, isHexChecksumAddress, } from '@metamask/utils';
3
- import BN from 'bn.js';
4
- import ensNamehash from 'eth-ens-namehash';
5
- import deepEqual from 'fast-deep-equal';
6
- import { memoize } from 'lodash-es';
7
- import { MAX_SAFE_CHAIN_ID } from './constants.js';
1
+ function $importDefault(module) {
2
+ if (module?.__esModule) {
3
+ return module.default;
4
+ }
5
+ return module;
6
+ }
7
+ import { fromWei, toWei } from "@metamask/ethjs-unit";
8
+ import { isStrictHexString, add0x, isHexString, remove0x, getChecksumAddress, isHexChecksumAddress } from "@metamask/utils";
9
+ import $BN from "bn.js";
10
+ const BN = $importDefault($BN);
11
+ import $ensNamehash from "eth-ens-namehash";
12
+ const ensNamehash = $importDefault($ensNamehash);
13
+ import $deepEqual from "fast-deep-equal";
14
+ const deepEqual = $importDefault($deepEqual);
15
+ import $lodash from "lodash";
16
+ const { memoize } = $lodash;
17
+ import { MAX_SAFE_CHAIN_ID } from "./constants.mjs";
8
18
  const TIMEOUT_ERROR = new Error('timeout');
9
19
  export const PROTOTYPE_POLLUTION_BLOCKLIST = [
10
20
  '__proto__',
@@ -534,4 +544,4 @@ export function isEqualCaseInsensitive(value1, value2) {
534
544
  }
535
545
  return value1.toLowerCase() === value2.toLowerCase();
536
546
  }
537
- //# sourceMappingURL=util.js.map
547
+ //# sourceMappingURL=util.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.mjs","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,6BAA6B;AAEtD,OAAO,EACL,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,oBAAoB,EACrB,wBAAwB;AAEzB,OAAO,GAAE,cAAc;;AACvB,OAAO,YAAW,yBAAyB;;AAC3C,OAAO,UAAS,wBAAwB;;;;AAGxC,OAAO,EAAE,iBAAiB,EAAE,wBAAuB;AAInD,MAAM,aAAa,GAAG,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;AAE3C,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,WAAW;IACX,aAAa;IACb,WAAW;CACH,CAAC;AAEX;;;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E,EAAE,CAC1D,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,6BAA6B,IAAI,GAAG,CAAC,CAC7D,CAAC;QAEF,IACE,wBAAwB;YACxB,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC;YACzC,KAAK,KAAK,aAAa,EACvB,CAAC;YACD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;SAAM,CAAC;QACN,+DAA+D;QAC/D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAc,EACd,MAAc;IAEd,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,WAAW,EAAE,CAAC;AACvD,CAAC","sourcesContent":["import type EthQuery from '@metamask/eth-query';\nimport { fromWei, toWei } from '@metamask/ethjs-unit';\nimport type { Hex, Json } from '@metamask/utils';\nimport {\n isStrictHexString,\n add0x,\n isHexString,\n remove0x,\n getChecksumAddress,\n isHexChecksumAddress,\n} from '@metamask/utils';\nimport type { BigNumber } from 'bignumber.js';\nimport BN from 'bn.js';\nimport ensNamehash from 'eth-ens-namehash';\nimport deepEqual from 'fast-deep-equal';\nimport { memoize } from 'lodash';\n\nimport { MAX_SAFE_CHAIN_ID } from './constants.js';\n\nexport type { BigNumber };\n\nconst TIMEOUT_ERROR = new Error('timeout');\n\nexport const PROTOTYPE_POLLUTION_BLOCKLIST = [\n '__proto__',\n 'constructor',\n 'prototype',\n] as const;\n\n/**\n * Checks whether a dynamic property key could be used in\n * a [prototype pollution attack](https://portswigger.net/web-security/prototype-pollution).\n *\n * @param key - The dynamic key to validate.\n * @returns Whether the given dynamic key is safe to use.\n */\nexport function isSafeDynamicKey(key: string): boolean {\n return (\n typeof key === 'string' &&\n !PROTOTYPE_POLLUTION_BLOCKLIST.some((blockedKey) => key === blockedKey)\n );\n}\n\n/**\n * Checks whether the given number primitive chain ID is safe.\n * Because some cryptographic libraries we use expect the chain ID to be a\n * number primitive, it must not exceed a certain size.\n *\n * @param chainId - The chain ID to check for safety.\n * @returns Whether the given chain ID is safe.\n */\nexport function isSafeChainId(chainId: Hex): boolean {\n if (!isHexString(chainId)) {\n return false;\n }\n const decimalChainId = Number.parseInt(\n chainId,\n isStrictHexString(chainId) ? 16 : 10,\n );\n return (\n Number.isSafeInteger(decimalChainId) &&\n decimalChainId > 0 &&\n decimalChainId <= MAX_SAFE_CHAIN_ID\n );\n}\n/**\n * Converts a BN or BigNumber object to a hex string with a '0x' prefix.\n *\n * @param inputBn - BN|BigNumber instance to convert to a hex string.\n * @returns A '0x'-prefixed hex string.\n */\n// TODO: Fix naming convention.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function BNToHex(inputBn: BN | BigNumber): Hex {\n return add0x(inputBn.toString(16));\n}\n\n/**\n * Used to multiply a BN by a fraction.\n *\n * @param targetBN - Number to multiply by a fraction.\n * @param numerator - Numerator of the fraction multiplier.\n * @param denominator - Denominator of the fraction multiplier.\n * @returns Product of the multiplication.\n */\nexport function fractionBN(\n targetBN: BN,\n numerator: number | string,\n denominator: number | string,\n): BN {\n const numBN = new BN(numerator);\n const denomBN = new BN(denominator);\n return targetBN.mul(numBN).div(denomBN);\n}\n\n/**\n * Used to convert a base-10 number from GWEI to WEI. Can handle numbers with decimal parts.\n *\n * @param value - The base 10 number to convert to WEI.\n * @returns The number in WEI, as a BN.\n */\nexport function gweiDecToWEIBN(value: number | string): BN {\n if (Number.isNaN(value)) {\n return new BN(0);\n }\n\n const parts = value.toString().split('.');\n const wholePart = parts[0] || '0';\n let decimalPart = parts[1] || '';\n\n if (!decimalPart) {\n return toWei(wholePart, 'gwei');\n }\n\n if (decimalPart.length <= 9) {\n return toWei(`${wholePart}.${decimalPart}`, 'gwei');\n }\n\n const decimalPartToRemove = decimalPart.slice(9);\n const decimalRoundingDigit = decimalPartToRemove[0];\n\n decimalPart = decimalPart.slice(0, 9);\n let wei = toWei(`${wholePart}.${decimalPart}`, 'gwei');\n\n if (Number(decimalRoundingDigit) >= 5) {\n wei = wei.add(new BN(1));\n }\n\n return wei;\n}\n\n/**\n * Used to convert values from wei hex format to dec gwei format.\n *\n * @param hexValue - The value in hex wei.\n * @returns The value in dec gwei as string.\n */\nexport function weiHexToGweiDec(hexValue: string): string {\n const hexWei = new BN(remove0x(hexValue), 16);\n return fromWei(hexWei, 'gwei');\n}\n\n/**\n * Return a URL that can be used to obtain ETH for a given network.\n *\n * @param networkCode - Network code of desired network.\n * @param address - Address to deposit obtained ETH.\n * @param amount - How much ETH is desired.\n * @returns URL to buy ETH based on network.\n */\nexport function getBuyURL(\n networkCode = '1',\n address?: string,\n amount = 5,\n): string | undefined {\n switch (networkCode) {\n case '1':\n return `https://buy.coinbase.com/?code=9ec56d01-7e81-5017-930c-513daa27bb6a&amount=${amount}&address=${address}&crypto_currency=ETH`;\n case '5':\n return 'https://goerli-faucet.slock.it/';\n case '11155111':\n return 'https://sepoliafaucet.net/';\n default:\n return undefined;\n }\n}\n\n/**\n * Converts a hex string to a BN object.\n *\n * @param inputHex - Number represented as a hex string.\n * @returns A BN instance.\n */\nexport function hexToBN(inputHex: string): BN {\n return inputHex ? new BN(remove0x(inputHex), 16) : new BN(0);\n}\n\n/**\n * A helper function that converts hex data to human readable string.\n *\n * @param hexValue - The hex string to convert to string.\n * @returns A human readable string conversion.\n */\nexport function hexToText(hexValue: string): string {\n try {\n const stripped = remove0x(hexValue);\n // TODO: Use `@metamask/utils` version of this function to avoid use of\n // Buffer.\n // eslint-disable-next-line no-restricted-globals\n const buff = Buffer.from(stripped, 'hex');\n return buff.toString('utf8');\n } catch {\n /* istanbul ignore next */\n return hexValue;\n }\n}\n\n/**\n * Parses a hex string and converts it into a number that can be operated on in a bignum-safe,\n * base-10 way.\n *\n * @param value - A base-16 number encoded as a string.\n * @returns The number as a BN object in base-16 mode.\n */\nexport function fromHex(value: string | BN): BN {\n if (BN.isBN(value)) {\n return value;\n }\n return new BN(hexToBN(value).toString(10));\n}\n\n/**\n * Converts an integer to a hexadecimal representation.\n *\n * @param value - An integer, an integer encoded as a base-10 string, or a BN.\n * @returns The integer encoded as a hex string.\n */\nexport function toHex(value: number | bigint | string | BN): Hex {\n if (typeof value === 'string' && isStrictHexString(value)) {\n return value;\n }\n const hexString =\n BN.isBN(value) || typeof value === 'bigint'\n ? value.toString(16)\n : new BN(value.toString(), 10).toString(16);\n return `0x${hexString}`;\n}\n\n/**\n * Execute and return an asynchronous operation without throwing errors.\n *\n * @param operation - Function returning a Promise.\n * @param logError - Determines if the error should be logged.\n * @template Result - Type of the result of the async operation\n * @returns Promise resolving to the result of the async operation.\n */\nexport async function safelyExecute<Result>(\n operation: () => Promise<Result>,\n logError = false,\n): Promise<Result | undefined> {\n try {\n return await operation();\n } catch (error) {\n /* istanbul ignore next */\n if (logError) {\n console.error(error);\n }\n return undefined;\n }\n}\n\n/**\n * Execute and return an asynchronous operation with a timeout.\n *\n * @param operation - Function returning a Promise.\n * @param logError - Determines if the error should be logged.\n * @param timeout - Timeout to fail the operation.\n * @template Result - Type of the result of the async operation\n * @returns Promise resolving to the result of the async operation.\n */\nexport async function safelyExecuteWithTimeout<Result>(\n operation: () => Promise<Result>,\n logError = false,\n timeout = 500,\n): Promise<Result | undefined> {\n try {\n return await Promise.race([\n operation(),\n new Promise<never>((_resolve, reject) =>\n setTimeout(() => {\n reject(TIMEOUT_ERROR);\n }, timeout),\n ),\n ]);\n } catch (error) {\n /* istanbul ignore next */\n if (logError) {\n console.error(error);\n }\n return undefined;\n }\n}\n\n/**\n * Convert an address to a checksummed hexadecimal address.\n *\n * @param address - The address to convert.\n * @returns The address in 0x-prefixed hexadecimal checksummed form if it is valid.\n */\nfunction toChecksumHexAddressUnmemoized(address: string): string;\n\n/**\n * Convert an address to a checksummed hexadecimal address.\n *\n * Note that this particular overload does nothing.\n *\n * @param address - A value that is not a string (e.g. `undefined` or `null`).\n * @returns The `address` untouched.\n * @deprecated This overload is designed to gracefully handle an invalid input\n * and is only present for backward compatibility. It may be removed in a future\n * major version. Please pass a string to `toChecksumHexAddress` instead.\n */\nfunction toChecksumHexAddressUnmemoized<Type>(address: Type): Type;\n\nfunction toChecksumHexAddressUnmemoized(address: unknown): unknown {\n if (typeof address !== 'string') {\n // Mimic behavior of `addHexPrefix` from `ethereumjs-util` (which this\n // function was previously using) for backward compatibility.\n return address;\n }\n\n const hexPrefixed = add0x(address);\n\n if (!isHexString(hexPrefixed)) {\n // Version 5.1 of ethereumjs-util would have returned '0xY' for input 'y'\n // but we shouldn't waste effort trying to change case on a clearly invalid\n // string. Instead just return the hex prefixed original string which most\n // closely mimics the original behavior.\n return hexPrefixed;\n }\n\n try {\n return getChecksumAddress(hexPrefixed);\n } catch (error) {\n // This is necessary for backward compatibility with the old behavior of\n // `ethereumjs-util` which would return the original string if the address\n // was invalid.\n if (error instanceof Error && error.message === 'Invalid hex address.') {\n return hexPrefixed;\n }\n throw error;\n }\n}\n\n/**\n * Convert an address to a checksummed hexadecimal address.\n *\n * @param address - The address to convert. For backward compatibility reasons,\n * this can be anything, even a non-hex string with an 0x prefix, but that usage\n * is deprecated. Please use a valid hex string (with or without the `0x`\n * prefix).\n * @returns A 0x-prefixed checksummed version of `address` if it is a valid hex\n * string, or the address as given otherwise.\n */\nexport const toChecksumHexAddress: {\n (address: string): string;\n <Type>(address: Type): Type;\n} = memoize(toChecksumHexAddressUnmemoized);\n\nfunction isValidHexAddressUnmemoized(\n possibleAddress: string,\n { allowNonPrefixed = true } = {},\n): boolean {\n const addressToCheck = allowNonPrefixed\n ? add0x(possibleAddress)\n : possibleAddress;\n if (!isStrictHexString(addressToCheck)) {\n return false;\n }\n\n // We used to rely on `isValidAddress` from `@ethereumjs/util` which allows\n // for upper-case characters too. So we preserve this behavior and use our\n // faster and memoized validation function instead.\n return isHexChecksumAddress(addressToCheck);\n}\n\n/**\n * Validates that the input is a hex address. This utility method is a thin\n * wrapper around `isValidHexAddress` from `@metamask/utils`, with the exception\n * that it may return true for non-0x-prefixed hex strings (depending on the\n * option below).\n *\n * @param possibleAddress - Input parameter to check against.\n * @param options - The validation options.\n * @param options.allowNonPrefixed - If true will regard addresses without a\n * `0x` prefix as valid.\n * @returns Whether or not the input is a valid hex address.\n */\nexport const isValidHexAddress: (\n possibleAddress: string,\n options?: { allowNonPrefixed?: boolean },\n) => boolean = memoize(\n isValidHexAddressUnmemoized,\n (possibleAddress, { allowNonPrefixed = true } = {}) =>\n `${possibleAddress}-${allowNonPrefixed}`,\n);\n\n/**\n * Returns whether the given code corresponds to a smart contract.\n *\n * @param code - The potential smart contract code.\n * @returns Whether the code was smart contract code or not.\n */\nexport function isSmartContractCode(code: string): boolean {\n /* istanbul ignore if */\n if (!code) {\n return false;\n }\n // Geth will return '0x', and ganache-core v2.2.1 will return '0x0'\n const smartContractCode = code !== '0x' && code !== '0x0';\n return smartContractCode;\n}\n\n/**\n * An error representing a non-200 HTTP response.\n */\nexport class HttpError extends Error {\n public httpStatus: number;\n\n /**\n * Construct an HTTP error.\n *\n * @param status - The HTTP response status.\n * @param message - The error message.\n */\n constructor(status: number, message?: string) {\n super(message ?? `Fetch failed with status '${status}'`);\n this.httpStatus = status;\n }\n}\n\n/**\n * Execute fetch and verify that the response was successful.\n *\n * @param request - Request information.\n * @param options - Fetch options.\n * @returns The fetch response.\n */\nexport async function successfulFetch(\n request: URL | RequestInfo,\n options?: RequestInit,\n): Promise<Response> {\n const response = await fetch(request, options);\n if (!response.ok) {\n throw new HttpError(\n response.status,\n // TODO: Replace `String` with more specific conversion.\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n `Fetch failed with status '${response.status}' for request '${String(request)}'`,\n );\n }\n return response;\n}\n\n/**\n * Execute fetch and return object response.\n *\n * @param request - The request information.\n * @param options - The fetch options.\n * @returns The fetch response JSON data.\n */\nexport async function handleFetch(\n request: URL | RequestInfo,\n options?: RequestInit,\n // TODO: Replace `any` with more specific type.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): Promise<any> {\n const response = await successfulFetch(request, options);\n const object = await response.json();\n return object;\n}\n\n/**\n * Execute fetch and return object response, log if known error thrown, otherwise rethrow error.\n *\n * @param request - the request options object\n * @param request.url - The request url to query.\n * @param request.options - The fetch options.\n * @param request.timeout - Timeout to fail request\n * @param request.errorCodesToCatch - array of error codes for errors we want to catch in a particular context\n * @returns The fetch response JSON data or undefined (if error occurs).\n */\nexport async function fetchWithErrorHandling({\n url,\n options,\n timeout,\n errorCodesToCatch,\n}: {\n url: string;\n options?: RequestInit;\n timeout?: number;\n errorCodesToCatch?: number[];\n // TODO: Replace `any` with more specific type.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n}): Promise<any> {\n let result;\n try {\n if (timeout) {\n result = Promise.race([\n await handleFetch(url, options),\n new Promise<Response>((_resolve, reject) =>\n setTimeout(() => {\n reject(TIMEOUT_ERROR);\n }, timeout),\n ),\n ]);\n } else {\n result = await handleFetch(url, options);\n }\n } catch (error) {\n logOrRethrowError(error, errorCodesToCatch);\n }\n return result;\n}\n\n/**\n * Fetch that fails after timeout.\n *\n * @param url - Url to fetch.\n * @param options - Options to send with the request.\n * @param timeout - Timeout to fail request.\n * @returns Promise resolving the request.\n */\nexport async function timeoutFetch(\n url: string,\n options?: RequestInit,\n timeout = 500,\n): Promise<Response> {\n return Promise.race([\n successfulFetch(url, options),\n new Promise<Response>((_resolve, reject) =>\n setTimeout(() => {\n reject(TIMEOUT_ERROR);\n }, timeout),\n ),\n ]);\n}\n\n/**\n * Normalizes the given ENS name.\n *\n * @param ensName - The ENS name.\n * @returns The normalized ENS name string.\n */\nexport function normalizeEnsName(ensName: string): string | null {\n // `.` refers to the registry root contract\n if (ensName === '.') {\n return ensName;\n }\n if (ensName && typeof ensName === 'string') {\n try {\n const normalized = ensNamehash.normalize(ensName.trim());\n // this regex is only sufficient with the above call to ensNamehash.normalize\n if (normalized.match(/^(([\\w\\d-]+)\\.)*[\\w\\d-]{3,}\\.(eth|test)$/u)) {\n return normalized;\n }\n } catch {\n // do nothing\n }\n }\n return null;\n}\n\n/**\n * Wrapper method to handle EthQuery requests.\n *\n * @param ethQuery - EthQuery object initialized with a provider.\n * @param method - Method to request.\n * @param args - Arguments to send.\n * @returns Promise resolving the request.\n */\nexport function query(\n ethQuery: EthQuery,\n method: string,\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n args: any[] = [],\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): Promise<any> {\n return new Promise((resolve, reject) => {\n const callback = (error: unknown, result: unknown): void => {\n if (error) {\n // We don't control the error object returned by eth-query, so\n // we can't guarantee it's an instance of Error.\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(error);\n return;\n }\n resolve(result);\n };\n\n // Using `in` rather than `hasProperty` so that we look up the prototype\n // chain for the method.\n if (method in ethQuery && typeof ethQuery[method] === 'function') {\n ethQuery[method](...args, callback);\n } else {\n ethQuery.sendAsync({ method, params: args }, callback);\n }\n });\n}\n\n/**\n * Converts valid hex strings to decimal numbers, and handles unexpected arg types.\n *\n * @param value - a string that is either a hexadecimal with `0x` prefix or a decimal string.\n * @returns a decimal number.\n */\nexport const convertHexToDecimal = (\n value: string | undefined = '0x0',\n): number => {\n if (isStrictHexString(value)) {\n return parseInt(value, 16);\n }\n\n return Number(value) ? Number(value) : 0;\n};\n\ntype PlainObject = Record<number | string | symbol, unknown>;\n\n/**\n * Determines whether a value is a \"plain\" object.\n *\n * @param value - A value to check\n * @returns True if the passed value is a plain object\n */\nexport function isPlainObject(value: unknown): value is PlainObject {\n return Boolean(value) && typeof value === 'object' && !Array.isArray(value);\n}\n\n/**\n * Like {@link Array}, but always non-empty.\n *\n * @template T - The non-empty array member type.\n */\nexport type NonEmptyArray<Type> = [Type, ...Type[]];\n\n/**\n * Type guard for {@link NonEmptyArray}.\n *\n * @template T - The non-empty array member type.\n * @param value - The value to check.\n * @returns Whether the value is a non-empty array.\n */\nexport function isNonEmptyArray<Type>(\n value: Type[],\n): value is NonEmptyArray<Type> {\n return Array.isArray(value) && value.length > 0;\n}\n\n/**\n * Type guard for {@link Json}.\n *\n * @param value - The value to check.\n * @returns Whether the value is valid JSON.\n */\nexport function isValidJson(value: unknown): value is Json {\n try {\n return deepEqual(value, JSON.parse(JSON.stringify(value)));\n } catch {\n return false;\n }\n}\n\n/**\n * Utility method to log if error is a common fetch error and otherwise rethrow it.\n *\n * @param error - Caught error that we should either rethrow or log to console\n * @param codesToCatch - array of error codes for errors we want to catch and log in a particular context\n */\nfunction logOrRethrowError(error: unknown, codesToCatch: number[] = []): void {\n if (!error) {\n return;\n }\n\n if (error instanceof Error) {\n const includesErrorCodeToCatch = codesToCatch.some((code) =>\n error.message.includes(`Fetch failed with status '${code}'`),\n );\n\n if (\n includesErrorCodeToCatch ||\n error.message.includes('Failed to fetch') ||\n error === TIMEOUT_ERROR\n ) {\n console.error(error);\n } else {\n throw error;\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw error;\n }\n}\n\n/**\n * Checks if two strings are equal, ignoring case.\n *\n * @param value1 - The first string to compare.\n * @param value2 - The second string to compare.\n * @returns `true` if the strings are equal, ignoring case; otherwise, `false`.\n */\nexport function isEqualCaseInsensitive(\n value1: string,\n value2: string,\n): boolean {\n if (typeof value1 !== 'string' || typeof value2 !== 'string') {\n return false;\n }\n return value1.toLowerCase() === value2.toLowerCase();\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/controller-utils",
3
- "version": "12.3.0-preview-4f4c98e",
3
+ "version": "12.3.0-preview-5b293ee50",
4
4
  "description": "Data and convenience functions shared by multiple packages",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -18,12 +18,19 @@
18
18
  "files": [
19
19
  "dist/"
20
20
  ],
21
- "type": "module",
22
21
  "sideEffects": false,
22
+ "main": "./dist/index.cjs",
23
+ "types": "./dist/index.d.cts",
23
24
  "exports": {
24
25
  ".": {
25
- "types": "./dist/index.d.ts",
26
- "default": "./dist/index.js"
26
+ "import": {
27
+ "types": "./dist/index.d.mts",
28
+ "default": "./dist/index.mjs"
29
+ },
30
+ "require": {
31
+ "types": "./dist/index.d.cts",
32
+ "default": "./dist/index.cjs"
33
+ }
27
34
  },
28
35
  "./package.json": "./package.json"
29
36
  },
@@ -32,11 +39,9 @@
32
39
  "registry": "https://registry.npmjs.org/"
33
40
  },
34
41
  "scripts": {
35
- "build": "tsc --project tsconfig.build.json",
36
- "build:all": "tsc --build tsconfig.build.json --verbose",
37
- "build:clean": "yarn build:only-clean && yarn build",
42
+ "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
43
+ "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
38
44
  "build:docs": "typedoc",
39
- "build:only-clean": "rimraf './dist' './tsconfig.build.tsbuildinfo'",
40
45
  "changelog:update": "../../scripts/update-changelog.sh @metamask/controller-utils",
41
46
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/controller-utils",
42
47
  "lint:tsconfigs": "tsx ../../scripts/lint-tsconfigs/lint-tsconfigs.mts",
@@ -59,29 +64,28 @@
59
64
  "cockatiel": "^3.1.2",
60
65
  "eth-ens-namehash": "^2.0.8",
61
66
  "fast-deep-equal": "^3.1.3",
62
- "lodash-es": "^4.17.21"
67
+ "lodash": "^4.17.21"
63
68
  },
64
69
  "devDependencies": {
65
70
  "@babel/runtime": "^7.23.9",
66
71
  "@metamask/auto-changelog": "^6.1.0",
72
+ "@ts-bridge/cli": "^0.6.4",
67
73
  "@types/jest": "^30.0.0",
68
- "@types/lodash-es": "^4.17.12",
69
- "@typescript/native": "npm:typescript@^7.0.2",
74
+ "@types/lodash": "^4.14.191",
70
75
  "deepmerge": "^4.2.2",
71
76
  "jest": "^30.4.2",
72
77
  "jest-environment-jsdom": "^30.4.1",
73
78
  "nock": "^13.3.1",
74
- "rimraf": "^5.0.5",
75
79
  "ts-jest": "^29.4.11",
76
80
  "tsx": "^4.20.5",
77
81
  "typedoc": "^0.25.13",
78
82
  "typedoc-plugin-missing-exports": "^2.0.0",
79
- "typescript": "npm:@typescript/typescript6@^6.0.2"
83
+ "typescript": "~5.3.3"
80
84
  },
81
85
  "peerDependencies": {
82
86
  "@babel/runtime": "^7.0.0"
83
87
  },
84
88
  "engines": {
85
- "node": "^22.14.0 || ^24"
89
+ "node": "^18.18 || >=20"
86
90
  }
87
91
  }
package/dist/abi.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../src/abi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,SAAS,EAAa,MAAM,oBAAoB,CAAC;AAQpE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAoD3C;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,SAAS,EACd,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,OAAO,EAAE,GAChB,GAAG,CAKL"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEd,kBAAkB,EAEnB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,GAAG,QAAQ,CAAC;AACzB,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAC3C,eAAO,MAAM,wBAAwB,sCAAsC,CAAC;AAI5E,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAGlD,eAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MA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,\n BlockExplorerUrl,\n} from './types.js';\n\nexport const RPC = 'rpc';\nexport const FALL_BACK_VS_CURRENCY = 'ETH';\nexport const IPFS_DEFAULT_GATEWAY_URL = 'https://cloudflare-ipfs.com/ipfs/';\n\n// NETWORKS ID\n// `toHex` not invoked to avoid cyclic dependency\nexport const GANACHE_CHAIN_ID = '0x539'; // toHex(1337)\n/**\n * The largest possible chain ID we can handle.\n * Explanation: https://gist.github.com/rekmarks/a47bd5f2525936c4b8eee31a16345553\n */\nexport const MAX_SAFE_CHAIN_ID = 4503599627370476;\n\n// TOKEN STANDARDS\nexport const ERC721 = 'ERC721';\nexport const ERC1155 = 'ERC1155';\nexport const ERC20 = 'ERC20';\n\n// TOKEN INTERFACE IDS\nexport const ERC721_INTERFACE_ID = '0x80ac58cd';\nexport const ERC721_METADATA_INTERFACE_ID = '0x5b5e139f';\nexport const ERC721_ENUMERABLE_INTERFACE_ID = '0x780e9d63';\nexport const ERC1155_INTERFACE_ID = '0xd9b67a26';\nexport const ERC1155_METADATA_URI_INTERFACE_ID = '0x0e89341c';\nexport const ERC1155_TOKEN_RECEIVER_INTERFACE_ID = '0x4e2312e0';\n\n// UNITS\nexport const GWEI = 'gwei';\n\n// ASSET TYPES\nexport const ASSET_TYPES = {\n NATIVE: 'NATIVE',\n TOKEN: 'TOKEN',\n NFT: 'NFT',\n UNKNOWN: 'UNKNOWN',\n};\n\n// TICKER SYMBOLS\nexport const TESTNET_TICKER_SYMBOLS = {\n GOERLI: 'GoerliETH',\n SEPOLIA: 'SepoliaETH',\n LINEA_GOERLI: 'LineaETH',\n LINEA_SEPOLIA: 'LineaETH',\n MEGAETH_TESTNET: 'MegaETH',\n MEGAETH_TESTNET_V2: 'MegaETH',\n};\n\n/**\n * Map of all built-in custom networks to their RPC endpoints.\n */\nexport const BUILT_IN_CUSTOM_NETWORKS_RPC = {\n /**\n * @deprecated Please use `megaeth-testnet` instead.\n */\n MEGAETH_TESTNET: 'https://carrot.megaeth.com/rpc',\n /**\n * @deprecated Please use `megaeth-testnet-v2` instead.\n */\n 'megaeth-testnet': 'https://carrot.megaeth.com/rpc',\n 'megaeth-testnet-v2': 'https://carrot.megaeth.com/rpc',\n 'monad-testnet': 'https://testnet-rpc.monad.xyz',\n};\n\n/**\n * Map of all build-in Infura networks to their network, ticker and chain IDs.\n */\nexport const BUILT_IN_NETWORKS = {\n [NetworkType.goerli]: {\n chainId: ChainId.goerli,\n ticker: NetworksTicker.goerli,\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl.goerli,\n },\n },\n [NetworkType.sepolia]: {\n chainId: ChainId.sepolia,\n ticker: NetworksTicker.sepolia,\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl.sepolia,\n },\n },\n [NetworkType.mainnet]: {\n chainId: ChainId.mainnet,\n ticker: NetworksTicker.mainnet,\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl.mainnet,\n },\n },\n [NetworkType['linea-goerli']]: {\n chainId: ChainId['linea-goerli'],\n ticker: NetworksTicker['linea-goerli'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['linea-goerli'],\n },\n },\n [NetworkType['linea-sepolia']]: {\n chainId: ChainId['linea-sepolia'],\n ticker: NetworksTicker['linea-sepolia'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['linea-sepolia'],\n },\n },\n [NetworkType['linea-mainnet']]: {\n chainId: ChainId['linea-mainnet'],\n ticker: NetworksTicker['linea-mainnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['linea-mainnet'],\n },\n },\n [NetworkType['megaeth-testnet']]: {\n chainId: ChainId['megaeth-testnet'],\n ticker: NetworksTicker['megaeth-testnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['megaeth-testnet'],\n },\n },\n [NetworkType['megaeth-testnet-v2']]: {\n chainId: ChainId['megaeth-testnet-v2'],\n ticker: NetworksTicker['megaeth-testnet-v2'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['megaeth-testnet-v2'],\n },\n },\n [NetworkType['monad-testnet']]: {\n chainId: ChainId['monad-testnet'],\n ticker: NetworksTicker['monad-testnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['monad-testnet'],\n },\n },\n [NetworkType['base-mainnet']]: {\n chainId: ChainId['base-mainnet'],\n ticker: NetworksTicker['base-mainnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['base-mainnet'],\n },\n },\n [NetworkType['arbitrum-mainnet']]: {\n chainId: ChainId['arbitrum-mainnet'],\n ticker: NetworksTicker['arbitrum-mainnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['arbitrum-mainnet'],\n },\n },\n [NetworkType['bsc-mainnet']]: {\n chainId: ChainId['bsc-mainnet'],\n ticker: NetworksTicker['bsc-mainnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['bsc-mainnet'],\n },\n },\n [NetworkType['optimism-mainnet']]: {\n chainId: ChainId['optimism-mainnet'],\n ticker: NetworksTicker['optimism-mainnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['optimism-mainnet'],\n },\n },\n [NetworkType['polygon-mainnet']]: {\n chainId: ChainId['polygon-mainnet'],\n ticker: NetworksTicker['polygon-mainnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['polygon-mainnet'],\n },\n },\n [NetworkType['sei-mainnet']]: {\n chainId: ChainId['sei-mainnet'],\n ticker: NetworksTicker['sei-mainnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['sei-mainnet'],\n },\n },\n [NetworkType['monad-mainnet']]: {\n chainId: ChainId['monad-mainnet'],\n ticker: NetworksTicker['monad-mainnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['monad-mainnet'],\n },\n },\n [NetworkType['zksync-mainnet']]: {\n chainId: ChainId['zksync-mainnet'],\n ticker: NetworksTicker['zksync-mainnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['zksync-mainnet'],\n },\n },\n [NetworkType['megaeth-mainnet']]: {\n chainId: ChainId['megaeth-mainnet'],\n ticker: NetworksTicker['megaeth-mainnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['megaeth-mainnet'],\n },\n },\n [NetworkType['avalanche-mainnet']]: {\n chainId: ChainId['avalanche-mainnet'],\n ticker: NetworksTicker['avalanche-mainnet'],\n rpcPrefs: {\n blockExplorerUrl: BlockExplorerUrl['avalanche-mainnet'],\n },\n },\n [NetworkType.rpc]: {\n chainId: undefined,\n blockExplorerUrl: undefined,\n ticker: undefined,\n rpcPrefs: undefined,\n },\n} as const;\n\n/**\n * When a user adds a custom network to MetaMask, we perform some basic\n * validations on the network. For instance, usually a network cannot share the\n * same chain as another. In some cases, however, we want to allow networks that\n * would normally be invalid. This mapping contains networks that should bypass\n * validation.\n */\nexport const NETWORKS_BYPASSING_VALIDATION = {\n // HyperEVM uses the same chain ID as Wanchain\n '0x3e7': {\n name: 'HyperEVM',\n symbol: 'HYPE',\n rpcUrl: 'https://rpc.hyperliquid.xyz',\n },\n};\n\n// APIs\nexport const OPENSEA_PROXY_URL =\n 'https://proxy.api.cx.metamask.io/opensea/v1/api/v2';\n\nexport const NFT_API_BASE_URL = 'https://nft.api.cx.metamask.io';\n\nexport const NFT_API_VERSION = '1';\n\nexport const NFT_API_TIMEOUT = 15000;\n\n// Default origin for controllers\nexport const ORIGIN_METAMASK = 'metamask';\n\n/**\n * Approval request types for various operations.\n * These types are used by different controllers to create and manage\n * approval requests consistently.\n */\nexport enum ApprovalType {\n AddEthereumChain = 'wallet_addEthereumChain',\n ConnectAccounts = 'connect_accounts',\n EthDecrypt = 'eth_decrypt',\n EthGetEncryptionPublicKey = 'eth_getEncryptionPublicKey',\n EthSignTypedData = 'eth_signTypedData',\n PersonalSign = 'personal_sign',\n ResultError = 'result_error',\n ResultSuccess = 'result_success',\n SnapDialogAlert = 'snap_dialog:alert',\n SnapDialogConfirmation = 'snap_dialog:confirmation',\n SnapDialogPrompt = 'snap_dialog:prompt',\n SnapDialogDefault = 'snap_dialog',\n SwitchEthereumChain = 'wallet_switchEthereumChain',\n Transaction = 'transaction',\n TransactionBatch = 'transaction_batch',\n Unlock = 'unlock',\n WalletConnect = 'wallet_connect',\n WalletRequestPermissions = 'wallet_requestPermissions',\n WatchAsset = 'wallet_watchAsset',\n}\n\n/**\n * Mapping of chain IDs to their network names for ENS functionality.\n * Note: MegaETH-testnet is intentionally excluded from this mapping as it doesn't support ENS.\n */\nexport const CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP: Record<\n string,\n BuiltInNetworkName\n> = {\n [ChainId.goerli]: BuiltInNetworkName.Goerli,\n [ChainId.sepolia]: BuiltInNetworkName.Sepolia,\n [ChainId.mainnet]: BuiltInNetworkName.Mainnet,\n [ChainId['linea-goerli']]: BuiltInNetworkName.LineaGoerli,\n [ChainId['linea-sepolia']]: BuiltInNetworkName.LineaSepolia,\n [ChainId['linea-mainnet']]: BuiltInNetworkName.LineaMainnet,\n [ChainId.aurora]: BuiltInNetworkName.Aurora,\n};\n\n/**\n * The number of milliseconds in a second.\n */\nexport const SECOND = 1000;\n\n/**\n * The number of milliseconds in a second.\n */\nexport const SECONDS = SECOND;\n\n/**\n * The number of milliseconds in a minute.\n */\nexport const MINUTE = SECONDS * 60;\n\n/**\n * The number of milliseconds in a minute.\n */\nexport const MINUTES = MINUTE;\n\n/**\n * The number of milliseconds in a hour.\n */\nexport const HOUR = MINUTES * 60;\n\n/**\n * The number of milliseconds in a hour.\n */\nexport const HOURS = HOUR;\n\n/**\n * The number of milliseconds in a day.\n */\nexport const DAY = HOURS * 24;\n\n/**\n * The number of milliseconds in a day.\n */\nexport const DAYS = DAY;\n\n/**\n * Special \"EVM-ish\" chains with no native tokens.\n * Created for Tempo, but can be extended to others.\n * - For hidding the native token from the token list and Send list.\n * - For excluding the native token from the total wallet value calculation.\n */\nexport const CHAIN_IDS_WITH_NO_NATIVE_TOKEN = [\n 'eip155:42431', // Tempo Testnet\n 'eip155:4217', // Tempo Mainnet\n] as const;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-service-policy.d.ts","sourceRoot":"","sources":["../src/create-service-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,YAAY,IAAI,qBAAqB,EAErC,kBAAkB,EAClB,eAAe,EAEf,SAAS,EACT,UAAU,EAGX,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,oBAAoB,EACpB,KAAK,IAAI,cAAc,EACvB,aAAa,EACb,eAAe,EACf,OAAO,EACP,MAAM,EACN,WAAW,EACZ,MAAM,WAAW,CAAC;AAEnB,OAAO;AACL;;;GAGG;AACH,kBAAkB;AAClB;;;GAGG;AACH,qBAAqB;AACrB;;;GAGG;AACH,YAAY;AACZ;;;GAGG;AACH,eAAe;AACf;;;GAGG;AACH,kBAAkB;AAClB;;;;GAIG;AACH,SAAS;AACT;;;;GAIG;AACH,UAAU,GACX,CAAC;AAEF,YAAY;AACV;;;GAGG;AACH,cAAc;AACd;;;GAGG;AACH,aAAa,IAAI,sBAAsB,GACxC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;;OAIG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACnC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IAC/C;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG;IACpC;;;OAGG;IACH,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C;;;OAGG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,eAAe,EAAE,MAAM,YAAY,CAAC;IACpC;;;;OAIG;IACH,+BAA+B,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACrD;;;OAGG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;OAEG;IACH,WAAW,EAAE,WAAW,CAAC;IACzB;;;OAGG;IACH,OAAO,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACzC;;;;;;OAMG;IACH,UAAU,EAAE,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1E;;;;OAIG;IACH,WAAW,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC;;;;OAIG;IACH,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACjC,CAAC;AAiCF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,QAAgC,CAAC;AAE9E;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,QAAiB,CAAC;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,OAAQ,CAAC;AAqChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,0BAA+B,GACvC,aAAa,CAsIf"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-service-policy.js","sourceRoot":"","sources":["../src/create-service-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,YAAY,IAAI,qBAAqB,EACrC,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,cAAc,E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ecutiveBreaker,\n ExponentialBackoff,\n ConstantBackoff,\n circuitBreaker,\n handleAll,\n handleWhen,\n retry,\n wrap,\n} from 'cockatiel';\nimport type {\n CircuitBreakerPolicy,\n Event as CockatielEvent,\n FailureReason,\n IBackoffFactory,\n IPolicy,\n Policy,\n RetryPolicy,\n} from 'cockatiel';\n\nexport {\n /**\n * @deprecated This is deprecated and will be removed in a future major\n * version. Please use the equivalent type from `@metamask/base-data-service`.\n */\n BrokenCircuitError,\n /**\n * @deprecated This is deprecated and will be removed in a future major\n * version. Please use the equivalent type from `@metamask/base-data-service`.\n */\n CockatielEventEmitter,\n /**\n * @deprecated This is deprecated and will be removed in a future major\n * version. Please use the equivalent type from `@metamask/base-data-service`.\n */\n CircuitState,\n /**\n * @deprecated This is deprecated and will be removed in a future major\n * version. Please use the equivalent type from `@metamask/base-data-service`.\n */\n ConstantBackoff,\n /**\n * @deprecated This is deprecated and will be removed in a future major\n * version. Please use the equivalent type from `@metamask/base-data-service`.\n */\n ExponentialBackoff,\n /**\n * @deprecated This is deprecated and will be removed in a future major\n * version. Please use the equivalent function from\n * `@metamask/base-data-service`.\n */\n handleAll,\n /**\n * @deprecated This is deprecated and will be removed in a future major\n * version. Please use the equivalent function from\n * `@metamask/base-data-service`.\n */\n handleWhen,\n};\n\nexport type {\n /**\n * @deprecated This is deprecated and will be removed in a future major\n * version. Please use the equivalent type from `@metamask/base-data-service`.\n */\n CockatielEvent,\n /**\n * @deprecated This is deprecated and will be removed in a future major\n * version. Please use the equivalent type from `@metamask/base-data-service`.\n */\n FailureReason as CockatielFailureReason,\n};\n\n/**\n * The options for `createServicePolicy`.\n *\n * @deprecated This is deprecated and will be removed in a future major version.\n * Please use the equivalent type from `@metamask/base-data-service`.\n */\nexport type CreateServicePolicyOptions = {\n /**\n * The backoff strategy to use. Mainly useful for testing so that a constant\n * backoff can be used when mocking timers. Defaults to an instance of\n * ExponentialBackoff.\n */\n backoff?: IBackoffFactory<unknown>;\n /**\n * The length of time (in milliseconds) to pause retries of the action after\n * the number of failures reaches `maxConsecutiveFailures`.\n */\n circuitBreakDuration?: number;\n /**\n * The length of time (in milliseconds) that governs when the service is\n * regarded as degraded (affecting when `onDegraded` is called).\n */\n degradedThreshold?: number;\n /**\n * Predicate function for when an error should be considered a service failure.\n */\n isServiceFailure?: (error: unknown) => boolean;\n /**\n * The maximum number of times that the service is allowed to fail before\n * pausing further retries.\n */\n maxConsecutiveFailures?: number;\n /**\n * The maximum number of times that a failing service should be re-invoked\n * before giving up.\n */\n maxRetries?: number;\n /**\n * The policy used to control when the service should be retried based on\n * either the result of the service or an error that it throws. For instance,\n * you could use this to retry only certain errors. See `handleWhen` and\n * friends from Cockatiel for more.\n */\n retryFilterPolicy?: Policy;\n};\n\n/**\n * The service policy object.\n *\n * @deprecated This is deprecated and will be removed in a future major\n * version. Please use the equivalent type from `@metamask/base-data-service`.\n */\nexport type ServicePolicy = IPolicy & {\n /**\n * The Cockatiel circuit breaker policy that the service policy uses\n * internally.\n */\n circuitBreakerPolicy: CircuitBreakerPolicy;\n /**\n * The amount of time to pause requests to the service if the number of\n * maximum consecutive failures is reached.\n */\n circuitBreakDuration: number;\n /**\n * @returns The state of the underlying circuit.\n */\n getCircuitState: () => CircuitState;\n /**\n * If the circuit is open and ongoing requests are paused, returns the number\n * of milliseconds before the requests will be attempted again. If the circuit\n * is not open, returns null.\n */\n getRemainingCircuitOpenDuration: () => number | null;\n /**\n * Resets the internal circuit breaker policy (if it is open, it will now be\n * closed).\n */\n reset: () => void;\n /**\n * The Cockatiel retry policy that the service policy uses internally.\n */\n retryPolicy: RetryPolicy;\n /**\n * A function which is called when the number of times that the service fails\n * in a row meets the set maximum number of consecutive failures.\n */\n onBreak: CircuitBreakerPolicy['onBreak'];\n /**\n * A function which is called in two circumstances: 1) when the service\n * succeeds before the maximum number of consecutive failures is reached, but\n * takes more time than the `degradedThreshold` to run, or 2) if the service\n * never succeeds before the retry policy gives up and before the maximum\n * number of consecutive failures has been reached.\n */\n onDegraded: CockatielEvent<FailureReason<unknown> | { duration: number }>;\n /**\n * A function which is called when the service succeeds for the first time,\n * or when the service fails enough times to cause the circuit to break and\n * then recovers.\n */\n onAvailable: CockatielEvent<void>;\n /**\n * A function which will be called by the retry policy each time the service\n * fails and the policy kicks off a timer to re-run the service. This is\n * primarily useful in tests where we are mocking timers.\n */\n onRetry: RetryPolicy['onRetry'];\n};\n\n/**\n * Parts of the circuit breaker's internal and external state as necessary in\n * order to compute the time remaining before the circuit will reopen.\n */\ntype InternalCircuitState =\n | {\n state: CircuitState.Open;\n openedAt: number;\n }\n | { state: Exclude<CircuitState, CircuitState.Open> };\n\n/**\n * Availability statuses that the service can be in.\n *\n * Used to keep track of whether the `onAvailable` event should be fired.\n */\nconst AVAILABILITY_STATUSES = {\n Available: 'available',\n Degraded: 'degraded',\n Unavailable: 'unavailable',\n Unknown: 'unknown',\n} as const;\n\n/**\n * Availability statuses that the service can be in.\n *\n * Used to keep track of whether the `onAvailable` event should be fired.\n */\ntype AvailabilityStatus =\n (typeof AVAILABILITY_STATUSES)[keyof typeof AVAILABILITY_STATUSES];\n\n/**\n * The maximum number of times that a failing service should be re-run before\n * giving up.\n *\n * @deprecated This is deprecated and will be removed in a future major version.\n * Please use the equivalent variable from `@metamask/base-data-service`.\n */\nexport const DEFAULT_MAX_RETRIES = 3;\n\n/**\n * The maximum number of times that the service is allowed to fail before\n * pausing further retries. This is set to a value such that if given a\n * service that continually fails, the policy needs to be executed 3 times\n * before further retries are paused.\n *\n * @deprecated This is deprecated and will be removed in a future major version.\n * Please use the equivalent variable from `@metamask/base-data-service`.\n */\nexport const DEFAULT_MAX_CONSECUTIVE_FAILURES = (1 + DEFAULT_MAX_RETRIES) * 3;\n\n/**\n * The default length of time (in milliseconds) to temporarily pause retries of\n * the service after enough consecutive failures.\n *\n * @deprecated This is deprecated and will be removed in a future major version.\n * Please use the equivalent variable from `@metamask/base-data-service`.\n */\nexport const DEFAULT_CIRCUIT_BREAK_DURATION = 30 * 60 * 1000;\n\n/**\n * The default length of time (in milliseconds) that governs when the service is\n * regarded as degraded (affecting when `onDegraded` is called).\n *\n * @deprecated This is deprecated and will be removed in a future major version.\n * Please use the equivalent variable from `@metamask/base-data-service`.\n */\nexport const DEFAULT_DEGRADED_THRESHOLD = 5_000;\n\nconst defaultIsServiceFailure = (error: unknown): boolean => {\n if (\n typeof error === 'object' &&\n error !== null &&\n 'httpStatus' in error &&\n typeof error.httpStatus === 'number'\n ) {\n return error.httpStatus >= 500;\n }\n\n // If the error is not an object, or doesn't have a numeric httpStatus\n // property, consider it a service failure (e.g., network errors, timeouts,\n // etc.)\n return true;\n};\n\n/**\n * The circuit breaker policy inside of the Cockatiel library exposes some of\n * its state, but not all of it. Notably, the time that the circuit opened is\n * not publicly accessible. So we have to record this ourselves.\n *\n * This function therefore allows us to obtain the circuit breaker state that we\n * wish we could access.\n *\n * @param state - The public state of a circuit breaker policy.\n * @returns if the circuit is open, the state of the circuit breaker policy plus\n * the time that it opened, otherwise just the circuit state.\n */\nfunction getInternalCircuitState(state: CircuitState): InternalCircuitState {\n if (state === CircuitState.Open) {\n return { state, openedAt: Date.now() };\n }\n return { state };\n}\n\n/**\n * Constructs an object exposing an `execute` method which, given a function —\n * hereafter called the \"service\" — will retry that service with ever increasing\n * delays until it succeeds. If the policy detects too many consecutive\n * failures, it will block further retries until a designated time period has\n * passed; this particular behavior is primarily designed for services that wrap\n * API calls so as not to make needless HTTP requests when the API is down and\n * to be able to recover when the API comes back up. In addition, hooks allow\n * for responding to certain events, one of which can be used to detect when an\n * HTTP request is performing slowly.\n *\n * Internally, this function makes use of the retry and circuit breaker policies\n * from the [Cockatiel](https://www.npmjs.com/package/cockatiel) library; see\n * there for more.\n *\n * @param options - The options to this function. See\n * {@link CreateServicePolicyOptions}.\n * @returns The service policy.\n * @example\n * This function is designed to be used in the context of a service class like\n * this:\n * ``` ts\n * class Service {\n * constructor() {\n * this.#policy = createServicePolicy({\n * maxRetries: 3,\n * retryFilterPolicy: handleWhen((error) => {\n * return error.message.includes('oops');\n * }),\n * maxConsecutiveFailures: 3,\n * circuitBreakDuration: 5000,\n * degradedThreshold: 2000,\n * onBreak: () => {\n * console.log('Circuit broke');\n * },\n * onDegraded: () => {\n * console.log('Service is degraded');\n * },\n * });\n * }\n *\n * async fetch() {\n * return await this.#policy.execute(async () => {\n * const response = await fetch('https://some/url');\n * return await response.json();\n * });\n * }\n * }\n * ```\n *\n * @deprecated This is deprecated and will be removed in a future major version.\n * Please use the equivalent function from `@metamask/base-data-service`.\n */\nexport function createServicePolicy(\n options: CreateServicePolicyOptions = {},\n): ServicePolicy {\n const {\n maxRetries = DEFAULT_MAX_RETRIES,\n retryFilterPolicy = handleAll,\n maxConsecutiveFailures = DEFAULT_MAX_CONSECUTIVE_FAILURES,\n circuitBreakDuration = DEFAULT_CIRCUIT_BREAK_DURATION,\n degradedThreshold = DEFAULT_DEGRADED_THRESHOLD,\n backoff = new ExponentialBackoff(),\n isServiceFailure = defaultIsServiceFailure,\n } = options;\n\n let availabilityStatus: AvailabilityStatus = AVAILABILITY_STATUSES.Unknown;\n\n const retryPolicy = retry(retryFilterPolicy, {\n // Note that although the option here is called \"max attempts\", it's really\n // maximum number of *retries* (attempts past the initial attempt).\n maxAttempts: maxRetries,\n // Retries of the service will be executed following ever increasing delays,\n // determined by a backoff formula.\n backoff,\n });\n const onRetry = retryPolicy.onRetry.bind(retryPolicy);\n\n const consecutiveBreaker = new ConsecutiveBreaker(maxConsecutiveFailures);\n const circuitBreakerPolicy = circuitBreaker(handleWhen(isServiceFailure), {\n // While the circuit is open, any additional invocations of the service\n // passed to the policy (either via automatic retries or by manually\n // executing the policy again) will result in a BrokenCircuitError. This\n // will remain the case until `circuitBreakDuration` passes, after which the\n // service will be allowed to run again. If the service succeeds, the\n // circuit will close, otherwise it will remain open.\n halfOpenAfter: circuitBreakDuration,\n breaker: consecutiveBreaker,\n });\n\n let internalCircuitState: InternalCircuitState = getInternalCircuitState(\n circuitBreakerPolicy.state,\n );\n circuitBreakerPolicy.onStateChange((state) => {\n internalCircuitState = getInternalCircuitState(state);\n });\n\n circuitBreakerPolicy.onBreak(() => {\n availabilityStatus = AVAILABILITY_STATUSES.Unavailable;\n });\n const onBreak = circuitBreakerPolicy.onBreak.bind(circuitBreakerPolicy);\n\n const onDegradedEventEmitter = new CockatielEventEmitter<\n FailureReason<unknown> | { duration: number }\n >();\n const onDegraded = onDegradedEventEmitter.addListener;\n\n const onAvailableEventEmitter = new CockatielEventEmitter<void>();\n const onAvailable = onAvailableEventEmitter.addListener;\n\n retryPolicy.onGiveUp((data) => {\n if (circuitBreakerPolicy.state === CircuitState.Closed) {\n availabilityStatus = AVAILABILITY_STATUSES.Degraded;\n onDegradedEventEmitter.emit(data);\n }\n });\n retryPolicy.onSuccess(({ duration }) => {\n if (circuitBreakerPolicy.state === CircuitState.Closed) {\n if (duration > degradedThreshold) {\n availabilityStatus = AVAILABILITY_STATUSES.Degraded;\n onDegradedEventEmitter.emit({ duration });\n } else if (availabilityStatus !== AVAILABILITY_STATUSES.Available) {\n availabilityStatus = AVAILABILITY_STATUSES.Available;\n onAvailableEventEmitter.emit();\n }\n }\n });\n\n // Every time the retry policy makes an attempt, it executes the circuit\n // breaker policy, which executes the service.\n //\n // Calling:\n //\n // policy.execute(() => {\n // // do what the service does\n // })\n //\n // is equivalent to:\n //\n // retryPolicy.execute(() => {\n // circuitBreakerPolicy.execute(() => {\n // // do what the service does\n // });\n // });\n //\n // So if the retry policy succeeds or fails, it is because the circuit breaker\n // policy succeeded or failed. And if there are any event listeners registered\n // on the retry policy, by the time they are called, the state of the circuit\n // breaker will have already changed.\n const policy = wrap(retryPolicy, circuitBreakerPolicy);\n\n const getRemainingCircuitOpenDuration = (): number | null => {\n if (internalCircuitState.state === CircuitState.Open) {\n return internalCircuitState.openedAt + circuitBreakDuration - Date.now();\n }\n return null;\n };\n\n const getCircuitState = (): CircuitState => {\n return circuitBreakerPolicy.state;\n };\n\n const reset = (): void => {\n // Set the state of the policy to \"isolated\" regardless of its current state\n const { dispose } = circuitBreakerPolicy.isolate();\n // Reset the state to \"closed\"\n dispose();\n\n // Reset the counter on the breaker as well\n consecutiveBreaker.success();\n\n // Re-initialize the availability status so that if the service is executed\n // successfully, onAvailable listeners will be called again\n availabilityStatus = AVAILABILITY_STATUSES.Unknown;\n };\n\n return {\n ...policy,\n circuitBreakerPolicy,\n circuitBreakDuration,\n getCircuitState,\n getRemainingCircuitOpenDuration,\n reset,\n retryPolicy,\n onBreak,\n onDegraded,\n onAvailable,\n onRetry,\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,8BAA8B,EAC9B,0BAA0B,EAC1B,gCAAgC,EAChC,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,SAAS,EACT,UAAU,GACX,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,cAAc,EACd,0BAA0B,EAC1B,sBAAsB,EACtB,aAAa,GACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,GAAG,EACH,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,8BAA8B,EAC9B,oBAAoB,EACpB,iCAAiC,EACjC,mCAAmC,EACnC,IAAI,EACJ,WAAW,EACX,sBAAsB,EACtB,4BAA4B,EAC5B,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,EACZ,mCAAmC,EACnC,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,IAAI,EACJ,KAAK,EACL,GAAG,EACH,IAAI,EACJ,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,sBAAsB,EACtB,UAAU,EACV,OAAO,EACP,SAAS,EACT,cAAc,EACd,WAAW,EACX,OAAO,EACP,SAAS,EACT,SAAS,EACT,eAAe,EACf,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,EACL,aAAa,EACb,wBAAwB,EACxB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,eAAe,EACf,sBAAsB,GACvB,MAAM,WAAW,CAAC;AACnB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,8BAA8B,EAC9B,0BAA0B,EAC1B,gCAAgC,EAChC,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,SAAS,EACT,UAAU,GACX,MAAM,4BAA4B,CAAC;AAOpC,OAAO,EACL,GAAG,EACH,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,4BAA4B,EAC5B,8BAA8B,EAC9B,oBAAoB,EACpB,iCAAiC,EACjC,mCAAmC,EACnC,IAAI,EACJ,WAAW,EACX,sBAAsB,EACtB,4BAA4B,EAC5B,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,EACZ,mCAAmC,EACnC,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,IAAI,EACJ,KAAK,EACL,GAAG,EACH,IAAI,EACJ,6BAA6B,EAC7B,8BAA8B,GAC/B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,sBAAsB,EACtB,UAAU,EACV,OAAO,EACP,SAAS,EACT,cAAc,EACd,WAAW,EACX,OAAO,EACP,SAAS,EACT,SAAS,EACT,eAAe,EACf,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,EACL,aAAa,EACb,wBAAwB,EACxB,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,KAAK,EACL,eAAe,EACf,sBAAsB,GACvB,MAAM,WAAW,CAAC;AACnB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC","sourcesContent":["export { encodeFunctionData } from './abi.js';\nexport {\n BrokenCircuitError,\n CircuitState,\n CockatielEventEmitter,\n ConstantBackoff,\n DEFAULT_CIRCUIT_BREAK_DURATION,\n DEFAULT_DEGRADED_THRESHOLD,\n DEFAULT_MAX_CONSECUTIVE_FAILURES,\n DEFAULT_MAX_RETRIES,\n ExponentialBackoff,\n createServicePolicy,\n handleAll,\n handleWhen,\n} from './create-service-policy.js';\nexport type {\n CockatielEvent,\n CreateServicePolicyOptions,\n CockatielFailureReason,\n ServicePolicy,\n} from './create-service-policy.js';\nexport {\n RPC,\n FALL_BACK_VS_CURRENCY,\n IPFS_DEFAULT_GATEWAY_URL,\n GANACHE_CHAIN_ID,\n MAX_SAFE_CHAIN_ID,\n ERC721,\n ERC1155,\n ERC20,\n ERC721_INTERFACE_ID,\n ERC721_METADATA_INTERFACE_ID,\n ERC721_ENUMERABLE_INTERFACE_ID,\n ERC1155_INTERFACE_ID,\n ERC1155_METADATA_URI_INTERFACE_ID,\n ERC1155_TOKEN_RECEIVER_INTERFACE_ID,\n GWEI,\n ASSET_TYPES,\n TESTNET_TICKER_SYMBOLS,\n BUILT_IN_CUSTOM_NETWORKS_RPC,\n BUILT_IN_NETWORKS,\n OPENSEA_PROXY_URL,\n NFT_API_BASE_URL,\n NFT_API_VERSION,\n NFT_API_TIMEOUT,\n ORIGIN_METAMASK,\n ApprovalType,\n CHAIN_ID_TO_ETHERS_NETWORK_NAME_MAP,\n SECOND,\n SECONDS,\n MINUTE,\n MINUTES,\n HOUR,\n HOURS,\n DAY,\n DAYS,\n NETWORKS_BYPASSING_VALIDATION,\n CHAIN_IDS_WITH_NO_NATIVE_TOKEN,\n} from './constants.js';\nexport type { NonEmptyArray } from './util.js';\nexport {\n BNToHex,\n convertHexToDecimal,\n fetchWithErrorHandling,\n fractionBN,\n fromHex,\n getBuyURL,\n gweiDecToWEIBN,\n handleFetch,\n hexToBN,\n hexToText,\n HttpError,\n isNonEmptyArray,\n isPlainObject,\n isSafeChainId,\n isSafeDynamicKey,\n isSmartContractCode,\n isValidJson,\n isValidHexAddress,\n normalizeEnsName,\n query,\n safelyExecute,\n safelyExecuteWithTimeout,\n successfulFetch,\n timeoutFetch,\n toChecksumHexAddress,\n toHex,\n weiHexToGweiDec,\n isEqualCaseInsensitive,\n} from './util.js';\nexport * from './types.js';\nexport * from './siwe.js';\n"]}
package/dist/logger.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { createModuleLogger } from '@metamask/utils';
2
- export declare const projectLogger: import("debug").Debugger;
3
- export { createModuleLogger };
4
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1E,eAAO,MAAM,aAAa,0BAA0C,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
package/dist/logger.js DELETED
@@ -1,4 +0,0 @@
1
- import { createProjectLogger, createModuleLogger } from '@metamask/utils';
2
- export const projectLogger = createProjectLogger('controller-utils');
3
- export { createModuleLogger };
4
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1E,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC,kBAAkB,CAAC,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import { createProjectLogger, createModuleLogger } from '@metamask/utils';\n\nexport const projectLogger = createProjectLogger('controller-utils');\n\nexport { createModuleLogger };\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"siwe.d.ts","sourceRoot":"","sources":["../src/siwe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAwCtD;;;;;;;;GAQG;AAIH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;CACnB;AAKD,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAOD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,WACnB,MAAM,kBACE,MAAM,KACrB,WAKF,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,QAAS,kBAAkB,KAAG,OA4C3D,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,aAAa,EAAE,IAAI,CAAC;IAAC,aAAa,EAAE,aAAa,CAAA;CAAE,GACrD;IAAE,aAAa,EAAE,KAAK,CAAC;IAAC,aAAa,EAAE,IAAI,CAAA;CAAE,CAAC;AAElD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,cAAe;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,KAAG,WAiBxD,CAAC"}