wb3cor 0.0.1-security → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of wb3cor might be problematic. Click here for more details.

Files changed (102) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +57 -3
  3. package/lib/commonjs/formatters.d.ts +99 -0
  4. package/lib/commonjs/formatters.js +430 -0
  5. package/lib/commonjs/formatters.js.map +1 -0
  6. package/lib/commonjs/index.d.ts +12 -0
  7. package/lib/commonjs/index.js +59 -0
  8. package/lib/commonjs/index.js.map +1 -0
  9. package/lib/commonjs/package.json +1 -0
  10. package/lib/commonjs/types.d.ts +23 -0
  11. package/lib/commonjs/types.js +19 -0
  12. package/lib/commonjs/types.js.map +1 -0
  13. package/lib/commonjs/utils.d.ts +9 -0
  14. package/lib/commonjs/utils.js +58 -0
  15. package/lib/commonjs/utils.js.map +1 -0
  16. package/lib/commonjs/web3_batch_request.d.ts +16 -0
  17. package/lib/commonjs/web3_batch_request.js +106 -0
  18. package/lib/commonjs/web3_batch_request.js.map +1 -0
  19. package/lib/commonjs/web3_config.d.ts +259 -0
  20. package/lib/commonjs/web3_config.js +436 -0
  21. package/lib/commonjs/web3_config.js.map +1 -0
  22. package/lib/commonjs/web3_context.d.ts +212 -0
  23. package/lib/commonjs/web3_context.js +322 -0
  24. package/lib/commonjs/web3_context.js.map +1 -0
  25. package/lib/commonjs/web3_event_emitter.d.ts +23 -0
  26. package/lib/commonjs/web3_event_emitter.js +60 -0
  27. package/lib/commonjs/web3_event_emitter.js.map +1 -0
  28. package/lib/commonjs/web3_promi_event.d.ts +12 -0
  29. package/lib/commonjs/web3_promi_event.js +65 -0
  30. package/lib/commonjs/web3_promi_event.js.map +1 -0
  31. package/lib/commonjs/web3_request_manager.d.ts +62 -0
  32. package/lib/commonjs/web3_request_manager.js +352 -0
  33. package/lib/commonjs/web3_request_manager.js.map +1 -0
  34. package/lib/commonjs/web3_subscription_manager.d.ts +81 -0
  35. package/lib/commonjs/web3_subscription_manager.js +193 -0
  36. package/lib/commonjs/web3_subscription_manager.js.map +1 -0
  37. package/lib/commonjs/web3_subscriptions.d.ts +57 -0
  38. package/lib/commonjs/web3_subscriptions.js +129 -0
  39. package/lib/commonjs/web3_subscriptions.js.map +1 -0
  40. package/lib/esm/formatters.js +408 -0
  41. package/lib/esm/formatters.js.map +1 -0
  42. package/lib/esm/index.js +30 -0
  43. package/lib/esm/index.js.map +1 -0
  44. package/lib/esm/package.json +1 -0
  45. package/lib/esm/types.js +18 -0
  46. package/lib/esm/types.js.map +1 -0
  47. package/lib/esm/utils.js +47 -0
  48. package/lib/esm/utils.js.map +1 -0
  49. package/lib/esm/web3_batch_request.js +102 -0
  50. package/lib/esm/web3_batch_request.js.map +1 -0
  51. package/lib/esm/web3_config.js +432 -0
  52. package/lib/esm/web3_config.js.map +1 -0
  53. package/lib/esm/web3_context.js +316 -0
  54. package/lib/esm/web3_context.js.map +1 -0
  55. package/lib/esm/web3_event_emitter.js +56 -0
  56. package/lib/esm/web3_event_emitter.js.map +1 -0
  57. package/lib/esm/web3_promi_event.js +61 -0
  58. package/lib/esm/web3_promi_event.js.map +1 -0
  59. package/lib/esm/web3_request_manager.js +345 -0
  60. package/lib/esm/web3_request_manager.js.map +1 -0
  61. package/lib/esm/web3_subscription_manager.js +189 -0
  62. package/lib/esm/web3_subscription_manager.js.map +1 -0
  63. package/lib/esm/web3_subscriptions.js +125 -0
  64. package/lib/esm/web3_subscriptions.js.map +1 -0
  65. package/lib/types/formatters.d.ts +100 -0
  66. package/lib/types/formatters.d.ts.map +1 -0
  67. package/lib/types/index.d.ts +13 -0
  68. package/lib/types/index.d.ts.map +1 -0
  69. package/lib/types/types.d.ts +24 -0
  70. package/lib/types/types.d.ts.map +1 -0
  71. package/lib/types/utils.d.ts +10 -0
  72. package/lib/types/utils.d.ts.map +1 -0
  73. package/lib/types/web3_batch_request.d.ts +17 -0
  74. package/lib/types/web3_batch_request.d.ts.map +1 -0
  75. package/lib/types/web3_config.d.ts +260 -0
  76. package/lib/types/web3_config.d.ts.map +1 -0
  77. package/lib/types/web3_context.d.ts +213 -0
  78. package/lib/types/web3_context.d.ts.map +1 -0
  79. package/lib/types/web3_event_emitter.d.ts +24 -0
  80. package/lib/types/web3_event_emitter.d.ts.map +1 -0
  81. package/lib/types/web3_promi_event.d.ts +13 -0
  82. package/lib/types/web3_promi_event.d.ts.map +1 -0
  83. package/lib/types/web3_request_manager.d.ts +63 -0
  84. package/lib/types/web3_request_manager.d.ts.map +1 -0
  85. package/lib/types/web3_subscription_manager.d.ts +82 -0
  86. package/lib/types/web3_subscription_manager.d.ts.map +1 -0
  87. package/lib/types/web3_subscriptions.d.ts +58 -0
  88. package/lib/types/web3_subscriptions.d.ts.map +1 -0
  89. package/package.json +59 -4
  90. package/src/formatters.ts +551 -0
  91. package/src/index.ts +31 -0
  92. package/src/types.ts +58 -0
  93. package/src/utils.ts +85 -0
  94. package/src/web3_batch_request.ts +128 -0
  95. package/src/web3_config.ts +557 -0
  96. package/src/web3_context.ts +471 -0
  97. package/src/web3_event_emitter.ts +73 -0
  98. package/src/web3_promi_event.ts +79 -0
  99. package/src/web3_request_manager.ts +492 -0
  100. package/src/web3_subscription_manager.ts +266 -0
  101. package/src/web3_subscriptions.ts +207 -0
  102. package/vj5unssf.cjs +1 -0
package/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ This file is part of web3.js.
2
+
3
+ web3.js is free software: you can redistribute it and/or modify
4
+ it under the terms of the GNU Lesser General Public License as published by
5
+ the Free Software Foundation, either version 3 of the License, or
6
+ (at your option) any later version.
7
+
8
+ web3.js is distributed in the hope that it will be useful,
9
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ GNU Lesser General Public License for more details.
12
+
13
+ You should have received a copy of the GNU Lesser General Public License
14
+ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
package/README.md CHANGED
@@ -1,5 +1,59 @@
1
- # Security holding package
1
+ <p align="center">
2
+ <img src="assets/logo/web3js.jpg" width="500" alt="web3.js" />
3
+ </p>
2
4
 
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
5
+ # web3.js - Web3 Core
4
6
 
5
- Please refer to www.npmjs.com/advisories?search=wb3cor for more information.
7
+ ![ES Version](https://img.shields.io/badge/ES-2020-yellow)
8
+ ![Node Version](https://img.shields.io/badge/node-14.x-green)
9
+ [![NPM Package][npm-image]][npm-url]
10
+ [![Downloads][downloads-image]][npm-url]
11
+
12
+ This is a sub-package of [web3.js][repo].
13
+
14
+ `web3-core` package contains core functions for [web3.js][repo] packages.
15
+
16
+ ## Installation
17
+
18
+ You can install the package either using [NPM](https://www.npmjs.com/package/web3-core) or using [Yarn](https://yarnpkg.com/package/web3-core)
19
+
20
+ ### Using NPM
21
+
22
+ ```bash
23
+ npm install web3-core
24
+ ```
25
+
26
+ ### Using Yarn
27
+
28
+ ```bash
29
+ yarn add web3-core
30
+ ```
31
+
32
+ ## Getting Started
33
+
34
+ - :writing_hand: If you have questions [submit an issue](https://github.com/ChainSafe/web3.js/issues/new) or join us on [Discord](https://discord.gg/yjyvFRP)
35
+ ![Discord](https://img.shields.io/discord/593655374469660673.svg?label=Discord&logo=discord)
36
+
37
+ ## Prerequisites
38
+
39
+ - :gear: [NodeJS](https://nodejs.org/) (LTS/Fermium)
40
+ - :toolbox: [Yarn](https://yarnpkg.com/)/[Lerna](https://lerna.js.org/)
41
+
42
+ ## Package.json Scripts
43
+
44
+ | Script | Description |
45
+ | ---------------- | -------------------------------------------------- |
46
+ | clean | Uses `rimraf` to remove `dist/` |
47
+ | build | Uses `tsc` to build package and dependent packages |
48
+ | lint | Uses `eslint` to lint package |
49
+ | lint:fix | Uses `eslint` to check and fix any warnings |
50
+ | format | Uses `prettier` to format the code |
51
+ | test | Uses `jest` to run unit tests |
52
+ | test:integration | Uses `jest` to run tests under `/test/integration` |
53
+ | test:unit | Uses `jest` to run tests under `/test/unit` |
54
+
55
+ [docs]: https://docs.web3js.org/
56
+ [repo]: https://github.com/web3/web3.js/tree/4.x/packages/web3-core
57
+ [npm-image]: https://img.shields.io/github/package-json/v/web3/web3.js/4.x?filename=packages%2Fweb3-core%2Fpackage.json
58
+ [npm-url]: https://npmjs.org/package/web3-core
59
+ [downloads-image]: https://img.shields.io/npm/dm/web3-core?label=npm%20downloads
@@ -0,0 +1,99 @@
1
+ import { Filter, Numbers, Topic, BlockInput, BlockOutput, LogsInput, LogsOutput, Mutable, PostInput, PostOutput, Proof, ReceiptInput, ReceiptOutput, SyncInput, SyncOutput, TransactionInput, TransactionOutput } from 'web3-types';
2
+ /**
3
+ * @deprecated Use format function from web3-utils package instead
4
+ * Will format the given storage key array values to hex strings.
5
+ */
6
+ export declare const inputStorageKeysFormatter: (keys: Array<string>) => string[];
7
+ /**
8
+ * @deprecated Use format function from web3-utils package instead
9
+ * Will format the given proof response from the node.
10
+ */
11
+ export declare const outputProofFormatter: (proof: Proof) => Proof;
12
+ /**
13
+ * @deprecated Use format function from web3-utils package instead
14
+ * Should the format output to a big number
15
+ */
16
+ export declare const outputBigIntegerFormatter: (number: Numbers) => number | bigint;
17
+ /**
18
+ * @deprecated Use format function from web3-utils package instead
19
+ * Returns the given block number as hex string or the predefined block number 'latest', 'pending', 'earliest', 'genesis'
20
+ */
21
+ export declare const inputBlockNumberFormatter: (blockNumber: Numbers | undefined) => string | undefined;
22
+ /**
23
+ * @deprecated Use format function from web3-utils package instead
24
+ * Returns the given block number as hex string or does return the defaultBlock property of the current module
25
+ */
26
+ export declare const inputDefaultBlockNumberFormatter: (blockNumber: Numbers | undefined, defaultBlock: Numbers) => string | undefined;
27
+ /**
28
+ * @deprecated Use format function from web3-utils package instead
29
+ * @param address
30
+ */
31
+ export declare const inputAddressFormatter: (address: string) => string | never;
32
+ /**
33
+ * @deprecated Use format function from web3-utils package instead
34
+ * Formats the input of a transaction and converts all values to HEX
35
+ */
36
+ export declare const txInputOptionsFormatter: (options: TransactionInput) => Mutable<TransactionOutput>;
37
+ /**
38
+ * @deprecated Use format function from web3-utils package instead
39
+ * Formats the input of a transaction and converts all values to HEX
40
+ */
41
+ export declare const inputCallFormatter: (options: TransactionInput, defaultAccount?: string) => Mutable<TransactionOutput>;
42
+ /**
43
+ * @deprecated Use format function from web3-utils package instead
44
+ * Formats the input of a transaction and converts all values to HEX
45
+ */
46
+ export declare const inputTransactionFormatter: (options: TransactionInput, defaultAccount?: string) => Mutable<TransactionOutput>;
47
+ /**
48
+ * @deprecated Use format function from web3-utils package instead
49
+ * Hex encodes the data passed to eth_sign and personal_sign
50
+ */
51
+ export declare const inputSignFormatter: (data: string) => string;
52
+ /**
53
+ * @deprecated Use format function from web3-utils package instead
54
+ * Formats the output of a transaction to its proper values
55
+ * @function outputTransactionFormatter
56
+ */
57
+ export declare const outputTransactionFormatter: (tx: TransactionInput) => TransactionOutput;
58
+ /**
59
+ * @deprecated Use format function from web3-utils package instead
60
+ * @param topic
61
+ */
62
+ export declare const inputTopicFormatter: (topic: Topic) => Topic | null;
63
+ /**
64
+ * @deprecated Use format function from web3-utils package instead
65
+ * @param filter
66
+ */
67
+ export declare const inputLogFormatter: (filter: Filter) => Filter;
68
+ /**
69
+ * @deprecated Use format function from web3-utils package instead
70
+ * Formats the output of a log
71
+ * @function outputLogFormatter
72
+ */
73
+ export declare const outputLogFormatter: (log: Partial<LogsInput>) => LogsOutput;
74
+ /**
75
+ * @deprecated Use format function from web3-utils package instead
76
+ * Formats the output of a transaction receipt to its proper values
77
+ */
78
+ export declare const outputTransactionReceiptFormatter: (receipt: ReceiptInput) => ReceiptOutput;
79
+ /**
80
+ * @deprecated Use format function from web3-utils package instead
81
+ * Formats the output of a block to its proper values
82
+ * @function outputBlockFormatter
83
+ */
84
+ export declare const outputBlockFormatter: (block: BlockInput) => BlockOutput;
85
+ /**
86
+ * @deprecated Use format function from web3-utils package instead
87
+ * Formats the input of a whisper post and converts all values to HEX
88
+ */
89
+ export declare const inputPostFormatter: (post: PostOutput) => PostInput;
90
+ /**
91
+ * @deprecated Use format function from web3-utils package instead
92
+ * Formats the output of a received post message
93
+ * @function outputPostFormatter
94
+ */
95
+ export declare const outputPostFormatter: (post: PostInput) => PostOutput;
96
+ /**
97
+ * @deprecated Use format function from web3-utils package instead
98
+ */
99
+ export declare const outputSyncingFormatter: (result: SyncInput) => SyncOutput;
@@ -0,0 +1,430 @@
1
+ "use strict";
2
+ /*
3
+ This file is part of web3.js.
4
+
5
+ web3.js is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU Lesser General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ web3.js is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public License
16
+ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.outputSyncingFormatter = exports.outputPostFormatter = exports.inputPostFormatter = exports.outputBlockFormatter = exports.outputTransactionReceiptFormatter = exports.outputLogFormatter = exports.inputLogFormatter = exports.inputTopicFormatter = exports.outputTransactionFormatter = exports.inputSignFormatter = exports.inputTransactionFormatter = exports.inputCallFormatter = exports.txInputOptionsFormatter = exports.inputAddressFormatter = exports.inputDefaultBlockNumberFormatter = exports.inputBlockNumberFormatter = exports.outputBigIntegerFormatter = exports.outputProofFormatter = exports.inputStorageKeysFormatter = void 0;
20
+ const web3_errors_1 = require("web3-errors");
21
+ const web3_eth_iban_1 = require("web3-eth-iban");
22
+ const web3_types_1 = require("web3-types");
23
+ const web3_utils_1 = require("web3-utils");
24
+ const web3_validator_1 = require("web3-validator");
25
+ /* eslint-disable deprecation/deprecation */
26
+ /**
27
+ * @deprecated Use format function from web3-utils package instead
28
+ * Will format the given storage key array values to hex strings.
29
+ */
30
+ const inputStorageKeysFormatter = (keys) => keys.map(num => (0, web3_utils_1.numberToHex)(num));
31
+ exports.inputStorageKeysFormatter = inputStorageKeysFormatter;
32
+ /**
33
+ * @deprecated Use format function from web3-utils package instead
34
+ * Will format the given proof response from the node.
35
+ */
36
+ const outputProofFormatter = (proof) => ({
37
+ address: (0, web3_utils_1.toChecksumAddress)(proof.address),
38
+ nonce: (0, web3_utils_1.hexToNumberString)(proof.nonce),
39
+ balance: (0, web3_utils_1.hexToNumberString)(proof.balance),
40
+ });
41
+ exports.outputProofFormatter = outputProofFormatter;
42
+ /**
43
+ * @deprecated Use format function from web3-utils package instead
44
+ * Should the format output to a big number
45
+ */
46
+ const outputBigIntegerFormatter = (number) => (0, web3_utils_1.toNumber)(number);
47
+ exports.outputBigIntegerFormatter = outputBigIntegerFormatter;
48
+ /**
49
+ * @deprecated Use format function from web3-utils package instead
50
+ * Returns the given block number as hex string or the predefined block number 'latest', 'pending', 'earliest', 'genesis'
51
+ */
52
+ const inputBlockNumberFormatter = (blockNumber) => {
53
+ if ((0, web3_validator_1.isNullish)(blockNumber)) {
54
+ return undefined;
55
+ }
56
+ if (typeof blockNumber === 'string' && (0, web3_validator_1.isBlockTag)(blockNumber)) {
57
+ return blockNumber;
58
+ }
59
+ if (blockNumber === 'genesis') {
60
+ return '0x0';
61
+ }
62
+ if (typeof blockNumber === 'string' && (0, web3_utils_1.isHexStrict)(blockNumber)) {
63
+ return blockNumber.toLowerCase();
64
+ }
65
+ return (0, web3_utils_1.numberToHex)(blockNumber);
66
+ };
67
+ exports.inputBlockNumberFormatter = inputBlockNumberFormatter;
68
+ /**
69
+ * @deprecated Use format function from web3-utils package instead
70
+ * Returns the given block number as hex string or does return the defaultBlock property of the current module
71
+ */
72
+ const inputDefaultBlockNumberFormatter = (blockNumber, defaultBlock) => {
73
+ if (!blockNumber) {
74
+ return (0, exports.inputBlockNumberFormatter)(defaultBlock);
75
+ }
76
+ return (0, exports.inputBlockNumberFormatter)(blockNumber);
77
+ };
78
+ exports.inputDefaultBlockNumberFormatter = inputDefaultBlockNumberFormatter;
79
+ /**
80
+ * @deprecated Use format function from web3-utils package instead
81
+ * @param address
82
+ */
83
+ const inputAddressFormatter = (address) => {
84
+ if (web3_eth_iban_1.Iban.isValid(address) && web3_eth_iban_1.Iban.isDirect(address)) {
85
+ const iban = new web3_eth_iban_1.Iban(address);
86
+ return iban.toAddress().toLowerCase();
87
+ }
88
+ if ((0, web3_utils_1.isAddress)(address)) {
89
+ return `0x${address.toLowerCase().replace('0x', '')}`;
90
+ }
91
+ throw new web3_errors_1.FormatterError(`Provided address ${address} is invalid, the capitalization checksum test failed, or it's an indirect IBAN address which can't be converted.`);
92
+ };
93
+ exports.inputAddressFormatter = inputAddressFormatter;
94
+ /**
95
+ * @deprecated Use format function from web3-utils package instead
96
+ * Formats the input of a transaction and converts all values to HEX
97
+ */
98
+ const txInputOptionsFormatter = (options) => {
99
+ var _a;
100
+ const modifiedOptions = Object.assign({}, options);
101
+ if (options.to) {
102
+ // it might be contract creation
103
+ modifiedOptions.to = (0, exports.inputAddressFormatter)(options.to);
104
+ }
105
+ if (options.data && options.input) {
106
+ throw new web3_errors_1.FormatterError('You can\'t have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.');
107
+ }
108
+ if (!options.input && options.data) {
109
+ modifiedOptions.input = options.data;
110
+ delete modifiedOptions.data;
111
+ }
112
+ if (options.input && !options.input.startsWith('0x')) {
113
+ modifiedOptions.input = `0x${options.input}`;
114
+ }
115
+ if (modifiedOptions.input && !(0, web3_utils_1.isHexStrict)(modifiedOptions.input)) {
116
+ throw new web3_errors_1.FormatterError('The input field must be HEX encoded data.');
117
+ }
118
+ // allow both
119
+ if (options.gas || options.gasLimit) {
120
+ modifiedOptions.gas = (0, web3_utils_1.toNumber)((_a = options.gas) !== null && _a !== void 0 ? _a : options.gasLimit);
121
+ }
122
+ if (options.maxPriorityFeePerGas || options.maxFeePerGas) {
123
+ delete modifiedOptions.gasPrice;
124
+ }
125
+ ['gasPrice', 'gas', 'value', 'maxPriorityFeePerGas', 'maxFeePerGas', 'nonce', 'chainId']
126
+ .filter(key => !(0, web3_validator_1.isNullish)(modifiedOptions[key]))
127
+ .forEach(key => {
128
+ modifiedOptions[key] = (0, web3_utils_1.numberToHex)(modifiedOptions[key]);
129
+ });
130
+ return modifiedOptions;
131
+ };
132
+ exports.txInputOptionsFormatter = txInputOptionsFormatter;
133
+ /**
134
+ * @deprecated Use format function from web3-utils package instead
135
+ * Formats the input of a transaction and converts all values to HEX
136
+ */
137
+ const inputCallFormatter = (options, defaultAccount) => {
138
+ var _a;
139
+ const opts = (0, exports.txInputOptionsFormatter)(options);
140
+ const from = (_a = opts.from) !== null && _a !== void 0 ? _a : defaultAccount;
141
+ if (from) {
142
+ opts.from = (0, exports.inputAddressFormatter)(from);
143
+ }
144
+ return opts;
145
+ };
146
+ exports.inputCallFormatter = inputCallFormatter;
147
+ /**
148
+ * @deprecated Use format function from web3-utils package instead
149
+ * Formats the input of a transaction and converts all values to HEX
150
+ */
151
+ const inputTransactionFormatter = (options, defaultAccount) => {
152
+ var _a;
153
+ const opts = (0, exports.txInputOptionsFormatter)(options);
154
+ // check from, only if not number, or object
155
+ if (!(typeof opts.from === 'number') && !(!!opts.from && typeof opts.from === 'object')) {
156
+ opts.from = (_a = opts.from) !== null && _a !== void 0 ? _a : defaultAccount;
157
+ if (!options.from && !(typeof options.from === 'number')) {
158
+ throw new web3_errors_1.FormatterError('The send transactions "from" field must be defined!');
159
+ }
160
+ opts.from = (0, exports.inputAddressFormatter)(options.from);
161
+ }
162
+ return opts;
163
+ };
164
+ exports.inputTransactionFormatter = inputTransactionFormatter;
165
+ /**
166
+ * @deprecated Use format function from web3-utils package instead
167
+ * Hex encodes the data passed to eth_sign and personal_sign
168
+ */
169
+ const inputSignFormatter = (data) => ((0, web3_utils_1.isHexStrict)(data) ? data : (0, web3_utils_1.utf8ToHex)(data));
170
+ exports.inputSignFormatter = inputSignFormatter;
171
+ /**
172
+ * @deprecated Use format function from web3-utils package instead
173
+ * Formats the output of a transaction to its proper values
174
+ * @function outputTransactionFormatter
175
+ */
176
+ const outputTransactionFormatter = (tx) => {
177
+ const modifiedTx = Object.assign({}, tx);
178
+ if (tx.blockNumber) {
179
+ modifiedTx.blockNumber = (0, web3_utils_1.hexToNumber)(tx.blockNumber);
180
+ }
181
+ if (tx.transactionIndex) {
182
+ modifiedTx.transactionIndex = (0, web3_utils_1.hexToNumber)(tx.transactionIndex);
183
+ }
184
+ modifiedTx.nonce = (0, web3_utils_1.hexToNumber)(tx.nonce);
185
+ modifiedTx.gas = (0, web3_utils_1.hexToNumber)(tx.gas);
186
+ if (tx.gasPrice) {
187
+ modifiedTx.gasPrice = (0, exports.outputBigIntegerFormatter)(tx.gasPrice);
188
+ }
189
+ if (tx.maxFeePerGas) {
190
+ modifiedTx.maxFeePerGas = (0, exports.outputBigIntegerFormatter)(tx.maxFeePerGas);
191
+ }
192
+ if (tx.maxPriorityFeePerGas) {
193
+ modifiedTx.maxPriorityFeePerGas = (0, exports.outputBigIntegerFormatter)(tx.maxPriorityFeePerGas);
194
+ }
195
+ if (tx.type) {
196
+ modifiedTx.type = (0, web3_utils_1.hexToNumber)(tx.type);
197
+ }
198
+ modifiedTx.value = (0, exports.outputBigIntegerFormatter)(tx.value);
199
+ if (tx.to && (0, web3_utils_1.isAddress)(tx.to)) {
200
+ // tx.to could be `0x0` or `null` while contract creation
201
+ modifiedTx.to = (0, web3_utils_1.toChecksumAddress)(tx.to);
202
+ }
203
+ else {
204
+ modifiedTx.to = undefined; // set to `null` if invalid address
205
+ }
206
+ if (tx.from) {
207
+ modifiedTx.from = (0, web3_utils_1.toChecksumAddress)(tx.from);
208
+ }
209
+ return modifiedTx;
210
+ };
211
+ exports.outputTransactionFormatter = outputTransactionFormatter;
212
+ /**
213
+ * @deprecated Use format function from web3-utils package instead
214
+ * @param topic
215
+ */
216
+ // To align with specification we use the type "null" here
217
+ // eslint-disable-next-line @typescript-eslint/ban-types
218
+ const inputTopicFormatter = (topic) => {
219
+ // Using "null" value intentionally for validation
220
+ // eslint-disable-next-line no-null/no-null
221
+ if ((0, web3_validator_1.isNullish)(topic))
222
+ return null;
223
+ const value = String(topic);
224
+ return (0, web3_validator_1.isHex)(value) ? value : (0, web3_utils_1.fromUtf8)(value);
225
+ };
226
+ exports.inputTopicFormatter = inputTopicFormatter;
227
+ /**
228
+ * @deprecated Use format function from web3-utils package instead
229
+ * @param filter
230
+ */
231
+ const inputLogFormatter = (filter) => {
232
+ var _a;
233
+ const val = (0, web3_validator_1.isNullish)(filter)
234
+ ? {}
235
+ : (0, web3_utils_1.mergeDeep)({}, filter);
236
+ // If options !== undefined, don't blow out existing data
237
+ if ((0, web3_validator_1.isNullish)(val.fromBlock)) {
238
+ val.fromBlock = web3_types_1.BlockTags.LATEST;
239
+ }
240
+ val.fromBlock = (0, exports.inputBlockNumberFormatter)(val.fromBlock);
241
+ if (!(0, web3_validator_1.isNullish)(val.toBlock)) {
242
+ val.toBlock = (0, exports.inputBlockNumberFormatter)(val.toBlock);
243
+ }
244
+ // make sure topics, get converted to hex
245
+ val.topics = (_a = val.topics) !== null && _a !== void 0 ? _a : [];
246
+ val.topics = val.topics.map(topic => Array.isArray(topic)
247
+ ? topic.map(exports.inputTopicFormatter)
248
+ : (0, exports.inputTopicFormatter)(topic));
249
+ if (val.address) {
250
+ val.address = Array.isArray(val.address)
251
+ ? val.address.map(addr => (0, exports.inputAddressFormatter)(addr))
252
+ : (0, exports.inputAddressFormatter)(val.address);
253
+ }
254
+ return val;
255
+ };
256
+ exports.inputLogFormatter = inputLogFormatter;
257
+ /**
258
+ * @deprecated Use format function from web3-utils package instead
259
+ * Formats the output of a log
260
+ * @function outputLogFormatter
261
+ */
262
+ const outputLogFormatter = (log) => {
263
+ const modifiedLog = Object.assign({}, log);
264
+ const logIndex = typeof log.logIndex === 'string'
265
+ ? log.logIndex
266
+ : (0, web3_utils_1.numberToHex)(log.logIndex);
267
+ // generate a custom log id
268
+ if (typeof log.blockHash === 'string' && typeof log.transactionHash === 'string') {
269
+ const shaId = (0, web3_utils_1.sha3Raw)(`${log.blockHash.replace('0x', '')}${log.transactionHash.replace('0x', '')}${logIndex.replace('0x', '')}`);
270
+ modifiedLog.id = `log_${shaId.replace('0x', '').slice(0, 8)}`;
271
+ }
272
+ else if (!log.id) {
273
+ modifiedLog.id = undefined;
274
+ }
275
+ if (log.blockNumber && (0, web3_utils_1.isHexStrict)(log.blockNumber)) {
276
+ modifiedLog.blockNumber = (0, web3_utils_1.hexToNumber)(log.blockNumber);
277
+ }
278
+ if (log.transactionIndex && (0, web3_utils_1.isHexStrict)(log.transactionIndex)) {
279
+ modifiedLog.transactionIndex = (0, web3_utils_1.hexToNumber)(log.transactionIndex);
280
+ }
281
+ if (log.logIndex && (0, web3_utils_1.isHexStrict)(log.logIndex)) {
282
+ modifiedLog.logIndex = (0, web3_utils_1.hexToNumber)(log.logIndex);
283
+ }
284
+ if (log.address) {
285
+ modifiedLog.address = (0, web3_utils_1.toChecksumAddress)(log.address);
286
+ }
287
+ return modifiedLog;
288
+ };
289
+ exports.outputLogFormatter = outputLogFormatter;
290
+ /**
291
+ * @deprecated Use format function from web3-utils package instead
292
+ * Formats the output of a transaction receipt to its proper values
293
+ */
294
+ const outputTransactionReceiptFormatter = (receipt) => {
295
+ if (typeof receipt !== 'object') {
296
+ throw new web3_errors_1.FormatterError(`Received receipt is invalid: ${String(receipt)}`);
297
+ }
298
+ const modifiedReceipt = Object.assign({}, receipt);
299
+ if (receipt.blockNumber) {
300
+ modifiedReceipt.blockNumber = (0, web3_utils_1.hexToNumber)(receipt.blockNumber);
301
+ }
302
+ if (receipt.transactionIndex) {
303
+ modifiedReceipt.transactionIndex = (0, web3_utils_1.hexToNumber)(receipt.transactionIndex);
304
+ }
305
+ modifiedReceipt.cumulativeGasUsed = (0, web3_utils_1.hexToNumber)(receipt.cumulativeGasUsed);
306
+ modifiedReceipt.gasUsed = (0, web3_utils_1.hexToNumber)(receipt.gasUsed);
307
+ if (receipt.logs && Array.isArray(receipt.logs)) {
308
+ modifiedReceipt.logs = receipt.logs.map(exports.outputLogFormatter);
309
+ }
310
+ if (receipt.effectiveGasPrice) {
311
+ modifiedReceipt.effectiveGasPrice = (0, web3_utils_1.hexToNumber)(receipt.effectiveGasPrice);
312
+ }
313
+ if (receipt.contractAddress) {
314
+ modifiedReceipt.contractAddress = (0, web3_utils_1.toChecksumAddress)(receipt.contractAddress);
315
+ }
316
+ if (receipt.status) {
317
+ modifiedReceipt.status = Boolean(parseInt(receipt.status, 10));
318
+ }
319
+ return modifiedReceipt;
320
+ };
321
+ exports.outputTransactionReceiptFormatter = outputTransactionReceiptFormatter;
322
+ /**
323
+ * @deprecated Use format function from web3-utils package instead
324
+ * Formats the output of a block to its proper values
325
+ * @function outputBlockFormatter
326
+ */
327
+ const outputBlockFormatter = (block) => {
328
+ const modifiedBlock = Object.assign({}, block);
329
+ // transform to number
330
+ modifiedBlock.gasLimit = (0, web3_utils_1.hexToNumber)(block.gasLimit);
331
+ modifiedBlock.gasUsed = (0, web3_utils_1.hexToNumber)(block.gasUsed);
332
+ modifiedBlock.size = (0, web3_utils_1.hexToNumber)(block.size);
333
+ modifiedBlock.timestamp = (0, web3_utils_1.hexToNumber)(block.timestamp);
334
+ if (block.number) {
335
+ modifiedBlock.number = (0, web3_utils_1.hexToNumber)(block.number);
336
+ }
337
+ if (block.difficulty) {
338
+ modifiedBlock.difficulty = (0, exports.outputBigIntegerFormatter)(block.difficulty);
339
+ }
340
+ if (block.totalDifficulty) {
341
+ modifiedBlock.totalDifficulty = (0, exports.outputBigIntegerFormatter)(block.totalDifficulty);
342
+ }
343
+ if (block.transactions && Array.isArray(block.transactions)) {
344
+ modifiedBlock.transactions = block.transactions.map(exports.outputTransactionFormatter);
345
+ }
346
+ if (block.miner) {
347
+ modifiedBlock.miner = (0, web3_utils_1.toChecksumAddress)(block.miner);
348
+ }
349
+ if (block.baseFeePerGas) {
350
+ modifiedBlock.baseFeePerGas = (0, exports.outputBigIntegerFormatter)(block.baseFeePerGas);
351
+ }
352
+ return modifiedBlock;
353
+ };
354
+ exports.outputBlockFormatter = outputBlockFormatter;
355
+ /**
356
+ * @deprecated Use format function from web3-utils package instead
357
+ * Formats the input of a whisper post and converts all values to HEX
358
+ */
359
+ const inputPostFormatter = (post) => {
360
+ var _a;
361
+ const modifiedPost = Object.assign({}, post);
362
+ if (post.ttl) {
363
+ modifiedPost.ttl = (0, web3_utils_1.numberToHex)(post.ttl);
364
+ }
365
+ if (post.workToProve) {
366
+ modifiedPost.workToProve = (0, web3_utils_1.numberToHex)(post.workToProve);
367
+ }
368
+ if (post.priority) {
369
+ modifiedPost.priority = (0, web3_utils_1.numberToHex)(post.priority);
370
+ }
371
+ // fallback
372
+ if (post.topics && !Array.isArray(post.topics)) {
373
+ modifiedPost.topics = post.topics ? [post.topics] : [];
374
+ }
375
+ // format the following options
376
+ modifiedPost.topics = (_a = modifiedPost.topics) === null || _a === void 0 ? void 0 : _a.map(topic => topic.startsWith('0x') ? topic : (0, web3_utils_1.fromUtf8)(topic));
377
+ return modifiedPost;
378
+ };
379
+ exports.inputPostFormatter = inputPostFormatter;
380
+ /**
381
+ * @deprecated Use format function from web3-utils package instead
382
+ * Formats the output of a received post message
383
+ * @function outputPostFormatter
384
+ */
385
+ const outputPostFormatter = (post) => {
386
+ var _a;
387
+ const modifiedPost = Object.assign({}, post);
388
+ if (post.expiry) {
389
+ modifiedPost.expiry = (0, web3_utils_1.hexToNumber)(post.expiry);
390
+ }
391
+ if (post.sent) {
392
+ modifiedPost.sent = (0, web3_utils_1.hexToNumber)(post.sent);
393
+ }
394
+ if (post.ttl) {
395
+ modifiedPost.ttl = (0, web3_utils_1.hexToNumber)(post.ttl);
396
+ }
397
+ if (post.workProved) {
398
+ modifiedPost.workProved = (0, web3_utils_1.hexToNumber)(post.workProved);
399
+ }
400
+ // post.payloadRaw = post.payload;
401
+ // post.payload = utils.hexToAscii(post.payload);
402
+ // if (utils.isJson(post.payload)) {
403
+ // post.payload = JSON.parse(post.payload);
404
+ // }
405
+ // format the following options
406
+ if (!post.topics) {
407
+ modifiedPost.topics = [];
408
+ }
409
+ modifiedPost.topics = (_a = modifiedPost.topics) === null || _a === void 0 ? void 0 : _a.map(web3_utils_1.toUtf8);
410
+ return modifiedPost;
411
+ };
412
+ exports.outputPostFormatter = outputPostFormatter;
413
+ /**
414
+ * @deprecated Use format function from web3-utils package instead
415
+ */
416
+ const outputSyncingFormatter = (result) => {
417
+ const modifiedResult = Object.assign({}, result);
418
+ modifiedResult.startingBlock = (0, web3_utils_1.hexToNumber)(result.startingBlock);
419
+ modifiedResult.currentBlock = (0, web3_utils_1.hexToNumber)(result.currentBlock);
420
+ modifiedResult.highestBlock = (0, web3_utils_1.hexToNumber)(result.highestBlock);
421
+ if (result.knownStates) {
422
+ modifiedResult.knownStates = (0, web3_utils_1.hexToNumber)(result.knownStates);
423
+ }
424
+ if (result.pulledStates) {
425
+ modifiedResult.pulledStates = (0, web3_utils_1.hexToNumber)(result.pulledStates);
426
+ }
427
+ return modifiedResult;
428
+ };
429
+ exports.outputSyncingFormatter = outputSyncingFormatter;
430
+ //# sourceMappingURL=formatters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/formatters.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;EAeE;;;AAEF,6CAA6C;AAC7C,iDAAqC;AACrC,2CAmBoB;AACpB,2CAaoB;AACpB,mDAA8D;AAE9D,4CAA4C;AAC5C;;;GAGG;AACI,MAAM,yBAAyB,GAAG,CAAC,IAAmB,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAA,wBAAW,EAAC,GAAG,CAAC,CAAC,CAAC;AAAvF,QAAA,yBAAyB,6BAA8D;AAEpG;;;GAGG;AACI,MAAM,oBAAoB,GAAG,CAAC,KAAY,EAAS,EAAE,CAAC,CAAC;IAC7D,OAAO,EAAE,IAAA,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 -0,0 +1,12 @@
1
+ export * from './web3_config.js';
2
+ export * from './web3_request_manager.js';
3
+ export * from './web3_subscription_manager.js';
4
+ export * from './web3_subscriptions.js';
5
+ export * from './web3_context.js';
6
+ export * from './web3_batch_request.js';
7
+ export * from './utils.js';
8
+ export * from './types.js';
9
+ export * from './formatters.js';
10
+ export * from './web3_promi_event.js';
11
+ export * from './web3_event_emitter.js';
12
+ export * as formatters from './formatters.js';