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
@@ -0,0 +1,322 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Web3EthPluginBase = exports.Web3PluginBase = exports.Web3Context = void 0;
13
+ /*
14
+ This file is part of web3.js.
15
+
16
+ web3.js is free software: you can redistribute it and/or modify
17
+ it under the terms of the GNU Lesser General Public License as published by
18
+ the Free Software Foundation, either version 3 of the License, or
19
+ (at your option) any later version.
20
+
21
+ web3.js is distributed in the hope that it will be useful,
22
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ GNU Lesser General Public License for more details.
25
+
26
+ You should have received a copy of the GNU Lesser General Public License
27
+ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
28
+ */
29
+ // eslint-disable-next-line max-classes-per-file
30
+ const web3_errors_1 = require("web3-errors");
31
+ const web3_utils_1 = require("web3-utils");
32
+ const web3_eth_accounts_1 = require("web3-eth-accounts");
33
+ const utils_js_1 = require("./utils.js");
34
+ const web3_batch_request_js_1 = require("./web3_batch_request.js");
35
+ // eslint-disable-next-line import/no-cycle
36
+ const web3_config_js_1 = require("./web3_config.js");
37
+ const web3_request_manager_js_1 = require("./web3_request_manager.js");
38
+ const web3_subscription_manager_js_1 = require("./web3_subscription_manager.js");
39
+ class Web3Context extends web3_config_js_1.Web3Config {
40
+ constructor(providerOrContext) {
41
+ var _a;
42
+ super();
43
+ this.providers = web3_request_manager_js_1.Web3RequestManager.providers;
44
+ // If "providerOrContext" is provided as "string" or an objects matching "SupportedProviders" interface
45
+ if ((0, web3_utils_1.isNullish)(providerOrContext) ||
46
+ (typeof providerOrContext === 'string' && providerOrContext.trim() !== '') ||
47
+ (0, utils_js_1.isSupportedProvider)(providerOrContext)) {
48
+ this._requestManager = new web3_request_manager_js_1.Web3RequestManager(providerOrContext);
49
+ this._subscriptionManager = new web3_subscription_manager_js_1.Web3SubscriptionManager(this._requestManager, {});
50
+ return;
51
+ }
52
+ const { config, provider, requestManager, subscriptionManager, registeredSubscriptions, accountProvider, wallet, requestManagerMiddleware, } = providerOrContext;
53
+ this.setConfig(config !== null && config !== void 0 ? config : {});
54
+ this._requestManager =
55
+ requestManager !== null && requestManager !== void 0 ? requestManager : new web3_request_manager_js_1.Web3RequestManager(provider, (_a = config === null || config === void 0 ? void 0 : config.enableExperimentalFeatures) === null || _a === void 0 ? void 0 : _a.useSubscriptionWhenCheckingBlockTimeout, requestManagerMiddleware);
56
+ if (subscriptionManager) {
57
+ this._subscriptionManager = subscriptionManager;
58
+ }
59
+ else {
60
+ this._subscriptionManager = new web3_subscription_manager_js_1.Web3SubscriptionManager(this.requestManager, registeredSubscriptions !== null && registeredSubscriptions !== void 0 ? registeredSubscriptions : {});
61
+ }
62
+ if (accountProvider) {
63
+ this._accountProvider = accountProvider;
64
+ }
65
+ if (wallet) {
66
+ this._wallet = wallet;
67
+ }
68
+ }
69
+ get requestManager() {
70
+ return this._requestManager;
71
+ }
72
+ /**
73
+ * Will return the current subscriptionManager ({@link Web3SubscriptionManager})
74
+ */
75
+ get subscriptionManager() {
76
+ return this._subscriptionManager;
77
+ }
78
+ get wallet() {
79
+ return this._wallet;
80
+ }
81
+ get accountProvider() {
82
+ return this._accountProvider;
83
+ }
84
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
+ static fromContextObject(...args) {
86
+ return new this(...args.reverse());
87
+ }
88
+ getContextObject() {
89
+ var _a;
90
+ return {
91
+ config: this.config,
92
+ provider: this.provider,
93
+ requestManager: this.requestManager,
94
+ subscriptionManager: this.subscriptionManager,
95
+ registeredSubscriptions: (_a = this.subscriptionManager) === null || _a === void 0 ? void 0 : _a.registeredSubscriptions,
96
+ providers: this.providers,
97
+ wallet: this.wallet,
98
+ accountProvider: this.accountProvider,
99
+ };
100
+ }
101
+ /**
102
+ * Use to create new object of any type extended by `Web3Context`
103
+ * and link it to current context. This can be used to initiate a global context object
104
+ * and then use it to create new objects of any type extended by `Web3Context`.
105
+ */
106
+ use(ContextRef, ...args) {
107
+ const newContextChild = new ContextRef(...[...args, this.getContextObject()]);
108
+ this.on(web3_config_js_1.Web3ConfigEvent.CONFIG_CHANGE, event => {
109
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
110
+ newContextChild.setConfig({ [event.name]: event.newValue });
111
+ });
112
+ // @ts-expect-error No index signature with a parameter of type 'string' was found on type 'Web3Context<API, RegisteredSubs>'
113
+ this[ContextRef.name] = newContextChild;
114
+ return newContextChild;
115
+ }
116
+ /**
117
+ * Link current context to another context.
118
+ */
119
+ link(parentContext) {
120
+ this.setConfig(parentContext.config);
121
+ this._requestManager = parentContext.requestManager;
122
+ this.provider = parentContext.provider;
123
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
124
+ this._subscriptionManager = parentContext.subscriptionManager;
125
+ this._wallet = parentContext.wallet;
126
+ this._accountProvider = parentContext._accountProvider;
127
+ parentContext.on(web3_config_js_1.Web3ConfigEvent.CONFIG_CHANGE, event => {
128
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
129
+ this.setConfig({ [event.name]: event.newValue });
130
+ });
131
+ }
132
+ // eslint-disable-next-line no-use-before-define
133
+ registerPlugin(plugin) {
134
+ // @ts-expect-error No index signature with a parameter of type 'string' was found on type 'Web3Context<API, RegisteredSubs>'
135
+ if (this[plugin.pluginNamespace] !== undefined)
136
+ throw new web3_errors_1.ExistingPluginNamespaceError(plugin.pluginNamespace);
137
+ const _pluginObject = {
138
+ [plugin.pluginNamespace]: plugin,
139
+ };
140
+ _pluginObject[plugin.pluginNamespace].link(this);
141
+ Object.assign(this, _pluginObject);
142
+ }
143
+ /**
144
+ * Will return the current provider.
145
+ *
146
+ * @returns Returns the current provider
147
+ * @example
148
+ * ```ts
149
+ * const web3 = new Web3Context("http://localhost:8545");
150
+ * console.log(web3.provider);
151
+ * > HttpProvider {
152
+ * clientUrl: 'http://localhost:8545',
153
+ * httpProviderOptions: undefined
154
+ * }
155
+ * ```
156
+ */
157
+ get provider() {
158
+ return this.currentProvider;
159
+ }
160
+ /**
161
+ * Will set the current provider.
162
+ *
163
+ * @param provider - The provider to set
164
+ *
165
+ * Accepted providers are of type {@link SupportedProviders}
166
+ * @example
167
+ * ```ts
168
+ * const web3Context = new web3ContextContext("http://localhost:8545");
169
+ * web3Context.provider = "ws://localhost:8545";
170
+ * console.log(web3Context.provider);
171
+ * > WebSocketProvider {
172
+ * _eventEmitter: EventEmitter {
173
+ * _events: [Object: null prototype] {},
174
+ * _eventsCount: 0,
175
+ * ...
176
+ * }
177
+ * ```
178
+ */
179
+ set provider(provider) {
180
+ this.requestManager.setProvider(provider);
181
+ }
182
+ /**
183
+ * Will return the current provider. (The same as `provider`)
184
+ *
185
+ * @returns Returns the current provider
186
+ * @example
187
+ * ```ts
188
+ * const web3Context = new Web3Context("http://localhost:8545");
189
+ * console.log(web3Context.provider);
190
+ * > HttpProvider {
191
+ * clientUrl: 'http://localhost:8545',
192
+ * httpProviderOptions: undefined
193
+ * }
194
+ * ```
195
+ */
196
+ get currentProvider() {
197
+ return this.requestManager.provider;
198
+ }
199
+ /**
200
+ * Will set the current provider. (The same as `provider`)
201
+ *
202
+ * @param provider - {@link SupportedProviders} The provider to set
203
+ *
204
+ * @example
205
+ * ```ts
206
+ * const web3Context = new Web3Context("http://localhost:8545");
207
+ * web3Context.currentProvider = "ws://localhost:8545";
208
+ * console.log(web3Context.provider);
209
+ * > WebSocketProvider {
210
+ * _eventEmitter: EventEmitter {
211
+ * _events: [Object: null prototype] {},
212
+ * _eventsCount: 0,
213
+ * ...
214
+ * }
215
+ * ```
216
+ */
217
+ set currentProvider(provider) {
218
+ this.requestManager.setProvider(provider);
219
+ }
220
+ /**
221
+ * Will return the givenProvider if available.
222
+ *
223
+ * When using web3.js in an Ethereum compatible browser, it will set with the current native provider by that browser. Will return the given provider by the (browser) environment, otherwise `undefined`.
224
+ */
225
+ // eslint-disable-next-line class-methods-use-this
226
+ get givenProvider() {
227
+ return Web3Context.givenProvider;
228
+ }
229
+ /**
230
+ * Will set the provider.
231
+ *
232
+ * @param provider - {@link SupportedProviders} The provider to set
233
+ * @returns Returns true if the provider was set
234
+ */
235
+ setProvider(provider) {
236
+ this.provider = provider;
237
+ return true;
238
+ }
239
+ setRequestManagerMiddleware(requestManagerMiddleware) {
240
+ this.requestManager.setMiddleware(requestManagerMiddleware);
241
+ }
242
+ /**
243
+ * Will return the {@link Web3BatchRequest} constructor.
244
+ */
245
+ get BatchRequest() {
246
+ return web3_batch_request_js_1.Web3BatchRequest.bind(undefined, this._requestManager);
247
+ }
248
+ /**
249
+ * This method allows extending the web3 modules.
250
+ * Note: This method is only for backward compatibility, and It is recommended to use Web3 v4 Plugin feature for extending web3.js functionality if you are developing something new.
251
+ */
252
+ extend(extendObj) {
253
+ var _a;
254
+ // @ts-expect-error No index signature with a parameter of type 'string' was found on type 'Web3Context<API, RegisteredSubs>'
255
+ if (extendObj.property && !this[extendObj.property])
256
+ // @ts-expect-error No index signature with a parameter of type 'string' was found on type 'Web3Context<API, RegisteredSubs>'
257
+ this[extendObj.property] = {};
258
+ (_a = extendObj.methods) === null || _a === void 0 ? void 0 : _a.forEach(element => {
259
+ const method = (...givenParams) => __awaiter(this, void 0, void 0, function* () {
260
+ return this.requestManager.send({
261
+ method: element.call,
262
+ params: givenParams,
263
+ });
264
+ });
265
+ if (extendObj.property)
266
+ // @ts-expect-error No index signature with a parameter of type 'string' was found on type 'Web3Context<API, RegisteredSubs>'
267
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
268
+ this[extendObj.property][element.name] = method;
269
+ // @ts-expect-error No index signature with a parameter of type 'string' was found on type 'Web3Context<API, RegisteredSubs>'
270
+ else
271
+ this[element.name] = method;
272
+ });
273
+ return this;
274
+ }
275
+ }
276
+ exports.Web3Context = Web3Context;
277
+ Web3Context.providers = web3_request_manager_js_1.Web3RequestManager.providers;
278
+ /**
279
+ * Extend this class when creating a plugin that either doesn't require {@link EthExecutionAPI},
280
+ * or interacts with a RPC node that doesn't fully implement {@link EthExecutionAPI}.
281
+ *
282
+ * To add type support for RPC methods to the {@link Web3RequestManager},
283
+ * define a {@link Web3APISpec} and pass it as a generic to Web3PluginBase like so:
284
+ *
285
+ * @example
286
+ * ```ts
287
+ * type CustomRpcApi = {
288
+ * custom_rpc_method: () => string;
289
+ * custom_rpc_method_with_parameters: (parameter1: string, parameter2: number) => string;
290
+ * };
291
+ *
292
+ * class CustomPlugin extends Web3PluginBase<CustomRpcApi> {...}
293
+ * ```
294
+ */
295
+ class Web3PluginBase extends Web3Context {
296
+ // eslint-disable-next-line class-methods-use-this
297
+ registerNewTransactionType(type, txClass) {
298
+ web3_eth_accounts_1.TransactionFactory.registerTransactionType(type, txClass);
299
+ }
300
+ }
301
+ exports.Web3PluginBase = Web3PluginBase;
302
+ /**
303
+ * Extend this class when creating a plugin that makes use of {@link EthExecutionAPI},
304
+ * or depends on other Web3 packages (such as `web3-eth-contract`) that depend on {@link EthExecutionAPI}.
305
+ *
306
+ * To add type support for RPC methods to the {@link Web3RequestManager} (in addition to {@link EthExecutionAPI}),
307
+ * define a {@link Web3APISpec} and pass it as a generic to Web3PluginBase like so:
308
+ *
309
+ * @example
310
+ * ```ts
311
+ * type CustomRpcApi = {
312
+ * custom_rpc_method: () => string;
313
+ * custom_rpc_method_with_parameters: (parameter1: string, parameter2: number) => string;
314
+ * };
315
+ *
316
+ * class CustomPlugin extends Web3PluginBase<CustomRpcApi> {...}
317
+ * ```
318
+ */
319
+ class Web3EthPluginBase extends Web3PluginBase {
320
+ }
321
+ exports.Web3EthPluginBase = Web3EthPluginBase;
322
+ //# sourceMappingURL=web3_context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web3_context.js","sourceRoot":"","sources":["../../src/web3_context.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;EAeE;AACF,gDAAgD;AAChD,6CAA2D;AAa3D,2CAAuC;AACvC,yDAAwE;AACxE,yCAAiD;AAGjD,mEAA2D;AAC3D,2CAA2C;AAC3C,qDAAkF;AAClF,uEAA+D;AAE/D,iFAAyE;AAmDzE,MAAa,WAMX,SAAQ,2BAAU;IASnB,YACC,iBAG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AE,OAAO,CAAC,IAAI;oBACpB,MAAM,EAAE,WAAW;iBACnB,CAAC,CAAA;cAAA,CAAC;YAEJ,IAAI,SAAS,CAAC,QAAQ;gBACrB,6HAA6H;gBAC7H,sEAAsE;gBACtE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;YACjD,6HAA6H;;gBACxH,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;QAClC,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACb,CAAC;;AA5TF,kCA6TC;AAtTuB,qBAAS,GAAG,4CAAkB,CAAC,SAAS,CAAC;AAwTjE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAsB,cAEpB,SAAQ,WAAgB;IAGzB,kDAAkD;IACxC,0BAA0B,CACnC,IAAa,EACb,OAAuB;QAEvB,sCAAkB,CAAC,uBAAuB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;CACD;AAZD,wCAYC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAsB,iBAAqD,SAAQ,cAElF;CAAG;AAFJ,8CAEI"}
@@ -0,0 +1,23 @@
1
+ import { EventEmitter } from 'web3-utils';
2
+ export declare type Web3EventMap = Record<string, unknown>;
3
+ export declare type Web3EventKey<T extends Web3EventMap> = string & keyof T;
4
+ export declare type Web3EventCallback<T> = (params: T) => void | Promise<void>;
5
+ export interface Web3Emitter<T extends Web3EventMap> {
6
+ on<K extends Web3EventKey<T>>(eventName: K, fn: Web3EventCallback<T[K]>): void;
7
+ once<K extends Web3EventKey<T>>(eventName: K, fn: Web3EventCallback<T[K]>): void;
8
+ off<K extends Web3EventKey<T>>(eventName: K, fn: Web3EventCallback<T[K]>): void;
9
+ emit<K extends Web3EventKey<T>>(eventName: K, params: T[K]): void;
10
+ }
11
+ export declare class Web3EventEmitter<T extends Web3EventMap> implements Web3Emitter<T> {
12
+ private readonly _emitter;
13
+ on<K extends Web3EventKey<T>>(eventName: K, fn: Web3EventCallback<T[K]>): void;
14
+ once<K extends Web3EventKey<T>>(eventName: K, fn: Web3EventCallback<T[K]>): void;
15
+ off<K extends Web3EventKey<T>>(eventName: K, fn: Web3EventCallback<T[K]>): void;
16
+ emit<K extends Web3EventKey<T>>(eventName: K, params: T[K]): void;
17
+ listenerCount<K extends Web3EventKey<T>>(eventName: K): number;
18
+ listeners<K extends Web3EventKey<T>>(eventName: K): ((...args: any[]) => void)[];
19
+ eventNames(): (string | symbol)[];
20
+ removeAllListeners(): EventEmitter;
21
+ setMaxListenerWarningThreshold(maxListenersWarningThreshold: number): void;
22
+ getMaxListeners(): number;
23
+ }
@@ -0,0 +1,60 @@
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.Web3EventEmitter = void 0;
20
+ const web3_utils_1 = require("web3-utils");
21
+ class Web3EventEmitter {
22
+ constructor() {
23
+ this._emitter = new web3_utils_1.EventEmitter();
24
+ }
25
+ on(eventName, fn) {
26
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
27
+ this._emitter.on(eventName, fn);
28
+ }
29
+ once(eventName, fn) {
30
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
31
+ this._emitter.once(eventName, fn);
32
+ }
33
+ off(eventName, fn) {
34
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
35
+ this._emitter.off(eventName, fn);
36
+ }
37
+ emit(eventName, params) {
38
+ this._emitter.emit(eventName, params);
39
+ }
40
+ listenerCount(eventName) {
41
+ return this._emitter.listenerCount(eventName);
42
+ }
43
+ listeners(eventName) {
44
+ return this._emitter.listeners(eventName);
45
+ }
46
+ eventNames() {
47
+ return this._emitter.eventNames();
48
+ }
49
+ removeAllListeners() {
50
+ return this._emitter.removeAllListeners();
51
+ }
52
+ setMaxListenerWarningThreshold(maxListenersWarningThreshold) {
53
+ this._emitter.setMaxListeners(maxListenersWarningThreshold);
54
+ }
55
+ getMaxListeners() {
56
+ return this._emitter.getMaxListeners();
57
+ }
58
+ }
59
+ exports.Web3EventEmitter = Web3EventEmitter;
60
+ //# sourceMappingURL=web3_event_emitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web3_event_emitter.js","sourceRoot":"","sources":["../../src/web3_event_emitter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;EAeE;;;AAEF,2CAA0C;AAY1C,MAAa,gBAAgB;IAA7B;QACkB,aAAQ,GAAG,IAAI,yBAAY,EAAE,CAAC;IA0ChD,CAAC;IAxCO,EAAE,CAA4B,SAAY,EAAE,EAA2B;QAC7E,kEAAkE;QAClE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACjC,CAAC;IAEM,IAAI,CAA4B,SAAY,EAAE,EAA2B;QAC/E,kEAAkE;QAClE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACnC,CAAC;IAEM,GAAG,CAA4B,SAAY,EAAE,EAA2B;QAC9E,kEAAkE;QAClE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAClC,CAAC;IAEM,IAAI,CAA4B,SAAY,EAAE,MAAY;QAChE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAEM,aAAa,CAA4B,SAAY;QAC3D,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;IAEM,SAAS,CAA4B,SAAY;QACvD,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IAEM,UAAU;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;IAEM,kBAAkB;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC;IAC3C,CAAC;IACM,8BAA8B,CAAC,4BAAoC;QACzE,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,4BAA4B,CAAC,CAAC;IAC7D,CAAC;IACM,eAAe;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC;IACxC,CAAC;CACD;AA3CD,4CA2CC"}
@@ -0,0 +1,12 @@
1
+ import { Web3EventCallback, Web3EventEmitter, Web3EventKey, Web3EventMap } from './web3_event_emitter.js';
2
+ export declare type PromiseExecutor<T> = (resolve: (data: T) => void, reject: (reason: unknown) => void) => void;
3
+ export declare class Web3PromiEvent<ResolveType, EventMap extends Web3EventMap> extends Web3EventEmitter<EventMap> implements Promise<ResolveType> {
4
+ private readonly _promise;
5
+ constructor(executor: PromiseExecutor<ResolveType>);
6
+ [Symbol.toStringTag]: 'Promise';
7
+ then<TResult1 = ResolveType, TResult2 = never>(onfulfilled?: ((value: ResolveType) => TResult1 | PromiseLike<TResult1>) | undefined, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | undefined): Promise<TResult1 | TResult2>;
8
+ catch<TResult = never>(onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | undefined): Promise<ResolveType | TResult>;
9
+ finally(onfinally?: (() => void) | undefined): Promise<ResolveType>;
10
+ on<K extends Web3EventKey<EventMap>>(eventName: K, fn: Web3EventCallback<EventMap[K]>): this;
11
+ once<K extends Web3EventKey<EventMap>>(eventName: K, fn: Web3EventCallback<EventMap[K]>): this;
12
+ }
@@ -0,0 +1,65 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
19
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
20
+ return new (P || (P = Promise))(function (resolve, reject) {
21
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
22
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
23
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
24
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
25
+ });
26
+ };
27
+ var _a;
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.Web3PromiEvent = void 0;
30
+ const web3_event_emitter_js_1 = require("./web3_event_emitter.js");
31
+ class Web3PromiEvent extends web3_event_emitter_js_1.Web3EventEmitter {
32
+ constructor(executor) {
33
+ super();
34
+ // public tag to treat object as promise by different libs
35
+ // eslint-disable-next-line @typescript-eslint/prefer-as-const
36
+ this[_a] = 'Promise';
37
+ this._promise = new Promise(executor);
38
+ }
39
+ then(onfulfilled, onrejected) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ return this._promise.then(onfulfilled, onrejected);
42
+ });
43
+ }
44
+ catch(onrejected) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ return this._promise.catch(onrejected);
47
+ });
48
+ }
49
+ finally(onfinally) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ return this._promise.finally(onfinally);
52
+ });
53
+ }
54
+ on(eventName, fn) {
55
+ super.on(eventName, fn);
56
+ return this;
57
+ }
58
+ once(eventName, fn) {
59
+ super.once(eventName, fn);
60
+ return this;
61
+ }
62
+ }
63
+ exports.Web3PromiEvent = Web3PromiEvent;
64
+ _a = Symbol.toStringTag;
65
+ //# sourceMappingURL=web3_promi_event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web3_promi_event.js","sourceRoot":"","sources":["../../src/web3_promi_event.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;EAeE;;;;;;;;;;;;;AAEF,mEAKiC;AAOjC,MAAa,cACZ,SAAQ,wCAA0B;IAKlC,YAAmB,QAAsC;QACxD,KAAK,EAAE,CAAC;QAIT,0DAA0D;QAC1D,8DAA8D;QACvD,QAAoB,GAAc,SAAS,CAAC;QALlD,IAAI,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAc,QAAQ,CAAC,CAAC;IACpD,CAAC;IAMY,IAAI,CAChB,WAAoF,EACpF,UAAgF;;YAEhF,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACpD,CAAC;KAAA;IAEY,KAAK,CACjB,UAA8E;;YAE9E,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACxC,CAAC;KAAA;IAEY,OAAO,CAAC,SAAoC;;YACxD,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACzC,CAAC;KAAA;IAEM,EAAE,CACR,SAAY,EACZ,EAAkC;QAElC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAExB,OAAO,IAAI,CAAC;IACb,CAAC;IAEM,IAAI,CACV,SAAY,EACZ,EAAkC;QAElC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAE1B,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAjDD,wCAiDC;KApCQ,MAAM,CAAC,WAAW"}
@@ -0,0 +1,62 @@
1
+ import { EthExecutionAPI, JsonRpcBatchRequest, JsonRpcBatchResponse, SupportedProviders, Web3APIMethod, Web3APIRequest, Web3APIReturnType, Web3APISpec, Web3BaseProviderConstructor } from 'web3-types';
2
+ import { Web3EventEmitter } from './web3_event_emitter.js';
3
+ import { RequestManagerMiddleware } from './types.js';
4
+ export declare enum Web3RequestManagerEvent {
5
+ PROVIDER_CHANGED = "PROVIDER_CHANGED",
6
+ BEFORE_PROVIDER_CHANGE = "BEFORE_PROVIDER_CHANGE"
7
+ }
8
+ export declare class Web3RequestManager<API extends Web3APISpec = EthExecutionAPI> extends Web3EventEmitter<{
9
+ [key in Web3RequestManagerEvent]: SupportedProviders<API> | undefined;
10
+ }> {
11
+ private _provider?;
12
+ private readonly useRpcCallSpecification?;
13
+ middleware?: RequestManagerMiddleware<API>;
14
+ constructor(provider?: SupportedProviders<API> | string, useRpcCallSpecification?: boolean, requestManagerMiddleware?: RequestManagerMiddleware<API>);
15
+ /**
16
+ * Will return all available providers
17
+ */
18
+ static get providers(): {
19
+ HttpProvider: Web3BaseProviderConstructor;
20
+ WebsocketProvider: Web3BaseProviderConstructor;
21
+ };
22
+ /**
23
+ * Will return the current provider.
24
+ *
25
+ * @returns Returns the current provider
26
+ */
27
+ get provider(): SupportedProviders<API> | undefined;
28
+ /**
29
+ * Will return all available providers
30
+ */
31
+ get providers(): {
32
+ HttpProvider: Web3BaseProviderConstructor;
33
+ WebsocketProvider: Web3BaseProviderConstructor;
34
+ };
35
+ /**
36
+ * Use to set provider. Provider can be a provider instance or a string.
37
+ *
38
+ * @param provider - The provider to set
39
+ */
40
+ setProvider(provider?: SupportedProviders<API> | string): boolean;
41
+ setMiddleware(requestManagerMiddleware: RequestManagerMiddleware<API>): void;
42
+ /**
43
+ *
44
+ * Will execute a request
45
+ *
46
+ * @param request - {@link Web3APIRequest} The request to send
47
+ *
48
+ * @returns The response of the request {@link ResponseType}. If there is error
49
+ * in the response, will throw an error
50
+ */
51
+ send<Method extends Web3APIMethod<API>, ResponseType = Web3APIReturnType<API, Method>>(request: Web3APIRequest<API, Method>): Promise<ResponseType>;
52
+ /**
53
+ * Same as send, but, will execute a batch of requests
54
+ *
55
+ * @param request {@link JsonRpcBatchRequest} The batch request to send
56
+ */
57
+ sendBatch(request: JsonRpcBatchRequest): Promise<JsonRpcBatchResponse<unknown>>;
58
+ private _sendRequest;
59
+ private _processJsonRpcResponse;
60
+ private static _isReverted;
61
+ private _buildResponse;
62
+ }