@subql/node-ethereum 0.4.1-8 → 0.4.1-storeCache-0.0.3

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 (106) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +3 -0
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/ethereum/api.ethereum.d.ts +8 -4
  5. package/dist/ethereum/api.ethereum.js +70 -49
  6. package/dist/ethereum/api.ethereum.js.map +1 -1
  7. package/dist/ethereum/api.service.ethereum.js +1 -1
  8. package/dist/ethereum/api.service.ethereum.js.map +1 -1
  9. package/dist/ethereum/block.ethereum.d.ts +1 -1
  10. package/dist/ethereum/block.ethereum.js +9 -12
  11. package/dist/ethereum/block.ethereum.js.map +1 -1
  12. package/dist/ethereum/ethers/json-rpc-batch-provider.d.ts +21 -0
  13. package/dist/ethereum/ethers/json-rpc-batch-provider.js +102 -0
  14. package/dist/ethereum/ethers/json-rpc-batch-provider.js.map +1 -0
  15. package/dist/ethereum/ethers/json-rpc-provider.d.ts +7 -0
  16. package/dist/ethereum/ethers/json-rpc-provider.js +68 -0
  17. package/dist/ethereum/ethers/json-rpc-provider.js.map +1 -0
  18. package/dist/ethereum/ethers/web/_version.d.ts +1 -0
  19. package/dist/ethereum/ethers/web/_version.js +6 -0
  20. package/dist/ethereum/ethers/web/_version.js.map +1 -0
  21. package/dist/ethereum/ethers/web/geturl.d.ts +3 -0
  22. package/dist/ethereum/ethers/web/geturl.js +116 -0
  23. package/dist/ethereum/ethers/web/geturl.js.map +1 -0
  24. package/dist/ethereum/ethers/web/index.d.ts +49 -0
  25. package/dist/ethereum/ethers/web/index.js +433 -0
  26. package/dist/ethereum/ethers/web/index.js.map +1 -0
  27. package/dist/ethereum/ethers/web/types.d.ts +26 -0
  28. package/dist/ethereum/ethers/web/types.js +4 -0
  29. package/dist/ethereum/ethers/web/types.js.map +1 -0
  30. package/dist/ethereum/utils.ethereum.d.ts +1 -1
  31. package/dist/ethereum/utils.ethereum.js +16 -3
  32. package/dist/ethereum/utils.ethereum.js.map +1 -1
  33. package/dist/indexer/blockDispatcher/block-dispatcher.service.d.ts +8 -15
  34. package/dist/indexer/blockDispatcher/block-dispatcher.service.js +20 -108
  35. package/dist/indexer/blockDispatcher/block-dispatcher.service.js.map +1 -1
  36. package/dist/indexer/blockDispatcher/ethereum-block-dispatcher.d.ts +4 -0
  37. package/dist/indexer/blockDispatcher/ethereum-block-dispatcher.js +5 -0
  38. package/dist/indexer/blockDispatcher/ethereum-block-dispatcher.js.map +1 -0
  39. package/dist/indexer/blockDispatcher/index.d.ts +2 -2
  40. package/dist/indexer/blockDispatcher/index.js.map +1 -1
  41. package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.d.ts +12 -17
  42. package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js +48 -134
  43. package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js.map +1 -1
  44. package/dist/indexer/dynamic-ds.service.d.ts +3 -22
  45. package/dist/indexer/dynamic-ds.service.js +4 -91
  46. package/dist/indexer/dynamic-ds.service.js.map +1 -1
  47. package/dist/indexer/fetch.module.js +24 -6
  48. package/dist/indexer/fetch.module.js.map +1 -1
  49. package/dist/indexer/fetch.service.d.ts +3 -3
  50. package/dist/indexer/fetch.service.js +40 -39
  51. package/dist/indexer/fetch.service.js.map +1 -1
  52. package/dist/indexer/indexer.manager.d.ts +5 -17
  53. package/dist/indexer/indexer.manager.js +25 -70
  54. package/dist/indexer/indexer.manager.js.map +1 -1
  55. package/dist/indexer/indexer.module.js +25 -2
  56. package/dist/indexer/indexer.module.js.map +1 -1
  57. package/dist/indexer/project.service.d.ts +5 -10
  58. package/dist/indexer/project.service.js +49 -100
  59. package/dist/indexer/project.service.js.map +1 -1
  60. package/dist/indexer/sandbox.service.js +6 -1
  61. package/dist/indexer/sandbox.service.js.map +1 -1
  62. package/dist/indexer/unfinalizedBlocks.service.d.ts +12 -12
  63. package/dist/indexer/unfinalizedBlocks.service.js +33 -38
  64. package/dist/indexer/unfinalizedBlocks.service.js.map +1 -1
  65. package/dist/indexer/unfinalizedBlocks.spec.js +41 -34
  66. package/dist/indexer/unfinalizedBlocks.spec.js.map +1 -1
  67. package/dist/indexer/worker/worker.d.ts +22 -8
  68. package/dist/indexer/worker/worker.js +14 -7
  69. package/dist/indexer/worker/worker.js.map +1 -1
  70. package/dist/indexer/worker/worker.service.d.ts +2 -2
  71. package/dist/indexer/worker/worker.service.js +11 -4
  72. package/dist/indexer/worker/worker.service.js.map +1 -1
  73. package/dist/indexer/worker/worker.unfinalizedBlocks.service.d.ts +11 -0
  74. package/dist/indexer/worker/worker.unfinalizedBlocks.service.js +32 -0
  75. package/dist/indexer/worker/worker.unfinalizedBlocks.service.js.map +1 -0
  76. package/dist/init.js +2 -2
  77. package/dist/init.js.map +1 -1
  78. package/dist/meta/meta.module.js +8 -0
  79. package/dist/meta/meta.module.js.map +1 -1
  80. package/dist/meta/meta.service.d.ts +18 -3
  81. package/dist/meta/meta.service.js +89 -5
  82. package/dist/meta/meta.service.js.map +1 -1
  83. package/dist/subcommands/forceClean.service.js +8 -4
  84. package/dist/subcommands/forceClean.service.js.map +1 -1
  85. package/dist/subcommands/reindex.init.js +5 -1
  86. package/dist/subcommands/reindex.init.js.map +1 -1
  87. package/dist/subcommands/reindex.module.js +8 -0
  88. package/dist/subcommands/reindex.module.js.map +1 -1
  89. package/dist/subcommands/reindex.service.d.ts +4 -1
  90. package/dist/subcommands/reindex.service.js +21 -10
  91. package/dist/subcommands/reindex.service.js.map +1 -1
  92. package/dist/utils/project.d.ts +1 -0
  93. package/dist/utils/project.js +13 -1
  94. package/dist/utils/project.js.map +1 -1
  95. package/dist/utils/reindex.d.ts +2 -1
  96. package/dist/utils/reindex.js +6 -2
  97. package/dist/utils/reindex.js.map +1 -1
  98. package/dist/utils/string.js +10 -2
  99. package/dist/utils/string.js.map +1 -1
  100. package/dist/yargs.d.ts +85 -53
  101. package/dist/yargs.js +103 -71
  102. package/dist/yargs.js.map +1 -1
  103. package/package.json +9 -9
  104. package/dist/indexer/blockDispatcher/base-block-dispatcher.d.ts +0 -40
  105. package/dist/indexer/blockDispatcher/base-block-dispatcher.js +0 -99
  106. package/dist/indexer/blockDispatcher/base-block-dispatcher.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-rpc-provider.js","sourceRoot":"","sources":["../../../src/ethereum/ethers/json-rpc-provider.ts"],"names":[],"mappings":";;;AAAA,oBAAoB;AACpB,0DAAqD;AACrD,4CAA+C;AAE/C,wDAAkF;AAIlF,SAAS,SAAS,CAAC,OAGlB;IACC,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,iBAAiB;QACjB,MAAM,KAAK,GAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACpD,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;QAChC,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;QAChC,MAAM,KAAK,CAAC;KACb;IAED,OAAO,OAAO,CAAC,MAAM,CAAC;AACxB,CAAC;AAED,MAAa,eAAgB,SAAQ,2BAAmB;IACtD,YAAY,GAA4B,EAAE,OAAoB;QAC5D,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,CAAC,MAAc,EAAE,MAAkB;QACrC,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,MAAM;YACd,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE;YAClB,OAAO,EAAE,KAAK;SACf,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,IAAA,qBAAQ,EAAC,OAAO,CAAC;YAC1B,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,kEAAkE;QAClE,sEAAsE;QACtE,MAAM,KAAK,GAAG,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtE,IAAI,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;YAChC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAC5B;QAED,MAAM,MAAM,GAAG,IAAA,eAAS,EACtB,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EACvB,SAAS,CACV,CAAC,IAAI,CACJ,CAAC,MAAM,EAAE,EAAE;YACT,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACjB,MAAM,EAAE,UAAU;gBAClB,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,MAAM;gBAChB,QAAQ,EAAE,IAAI;aACf,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAChB,CAAC,EACD,CAAC,KAAK,EAAE,EAAE;YACR,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACjB,MAAM,EAAE,UAAU;gBAClB,KAAK,EAAE,KAAK;gBACZ,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,IAAI;aACf,CAAC,CAAC;YAEH,MAAM,KAAK,CAAC;QACd,CAAC,CACF,CAAC;QAEF,uDAAuD;QACvD,IAAI,KAAK,EAAE;YACT,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;YAC7B,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;YAC7B,CAAC,EAAE,CAAC,CAAC,CAAC;SACP;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA/DD,0CA+DC","sourcesContent":["/* eslint-disable */\nimport { deepCopy } from '@ethersproject/properties';\nimport { fetchJson } from '@ethersproject/web';\n\nimport { JsonRpcProvider as BaseJsonRpcProvider } from '@ethersproject/providers';\nimport { Networkish } from '@ethersproject/networks';\nimport { ConnectionInfo } from './web';\n\nfunction getResult(payload: {\n error?: { code?: number; data?: any; message?: string };\n result?: any;\n}): any {\n if (payload.error) {\n // @TODO: not any\n const error: any = new Error(payload.error.message);\n error.code = payload.error.code;\n error.data = payload.error.data;\n throw error;\n }\n\n return payload.result;\n}\n\nexport class JsonRpcProvider extends BaseJsonRpcProvider {\n constructor(url: string | ConnectionInfo, network?: Networkish) {\n super(url, network);\n }\n\n send(method: string, params: Array<any>): Promise<any> {\n const request = {\n method: method,\n params: params,\n id: this._nextId++,\n jsonrpc: '2.0',\n };\n\n this.emit('debug', {\n action: 'request',\n request: deepCopy(request),\n provider: this,\n });\n\n // We can expand this in the future to any call, but for now these\n // are the biggest wins and do not require any serializing parameters.\n const cache = ['eth_chainId', 'eth_blockNumber'].indexOf(method) >= 0;\n if (cache && this._cache[method]) {\n return this._cache[method];\n }\n\n const result = fetchJson(\n this.connection,\n JSON.stringify(request),\n getResult,\n ).then(\n (result) => {\n this.emit('debug', {\n action: 'response',\n request: request,\n response: result,\n provider: this,\n });\n\n return result;\n },\n (error) => {\n this.emit('debug', {\n action: 'response',\n error: error,\n request: request,\n provider: this,\n });\n\n throw error;\n },\n );\n\n // Cache the fetch, but clear it on the next event loop\n if (cache) {\n this._cache[method] = result;\n setTimeout(() => {\n this._cache[method] = null;\n }, 0);\n }\n\n return result;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare const version = "web/5.7.1";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.version = void 0;
4
+ /* eslint-disable */
5
+ exports.version = 'web/5.7.1';
6
+ //# sourceMappingURL=_version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_version.js","sourceRoot":"","sources":["../../../../src/ethereum/ethers/web/_version.ts"],"names":[],"mappings":";;;AAAA,oBAAoB;AACP,QAAA,OAAO,GAAG,WAAW,CAAC","sourcesContent":["/* eslint-disable */\nexport const version = 'web/5.7.1';\n"]}
@@ -0,0 +1,3 @@
1
+ import type { GetUrlResponse, Options } from './types';
2
+ export { GetUrlResponse, Options };
3
+ export declare function getUrl(href: string, options?: Options): Promise<GetUrlResponse>;
@@ -0,0 +1,116 @@
1
+ /* eslint-disable */
2
+ 'use strict';
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.getUrl = void 0;
8
+ const http_1 = __importDefault(require("http"));
9
+ const https_1 = __importDefault(require("https"));
10
+ const zlib_1 = require("zlib");
11
+ const url_1 = require("url");
12
+ const bytes_1 = require("@ethersproject/bytes");
13
+ const properties_1 = require("@ethersproject/properties");
14
+ const logger_1 = require("@ethersproject/logger");
15
+ const _version_1 = require("./_version");
16
+ const logger = new logger_1.Logger(_version_1.version);
17
+ function getResponse(request) {
18
+ return new Promise((resolve, reject) => {
19
+ request.once('response', (resp) => {
20
+ const response = {
21
+ statusCode: resp.statusCode,
22
+ statusMessage: resp.statusMessage,
23
+ headers: Object.keys(resp.headers).reduce((accum, name) => {
24
+ let value = resp.headers[name];
25
+ if (Array.isArray(value)) {
26
+ value = value.join(', ');
27
+ }
28
+ accum[name] = value;
29
+ return accum;
30
+ }, {}),
31
+ body: null,
32
+ };
33
+ //resp.setEncoding("utf8");
34
+ resp.on('data', (chunk) => {
35
+ if (response.body == null) {
36
+ response.body = new Uint8Array(0);
37
+ }
38
+ response.body = (0, bytes_1.concat)([response.body, chunk]);
39
+ });
40
+ resp.on('end', () => {
41
+ if (response.headers['content-encoding'] === 'gzip') {
42
+ //const size = response.body.length;
43
+ response.body = (0, bytes_1.arrayify)((0, zlib_1.gunzipSync)(response.body));
44
+ //console.log("Delta:", response.body.length - size, Buffer.from(response.body).toString());
45
+ }
46
+ resolve(response);
47
+ });
48
+ resp.on('error', (error) => {
49
+ /* istanbul ignore next */
50
+ error.response = response;
51
+ reject(error);
52
+ });
53
+ });
54
+ request.on('error', (error) => {
55
+ reject(error);
56
+ });
57
+ });
58
+ }
59
+ // The URL.parse uses null instead of the empty string
60
+ function nonnull(value) {
61
+ if (value == null) {
62
+ return '';
63
+ }
64
+ return value;
65
+ }
66
+ async function getUrl(href, options) {
67
+ var _a, _b;
68
+ if (options == null) {
69
+ options = {};
70
+ }
71
+ // @TODO: Once we drop support for node 8, we can pass the href
72
+ // directly into request and skip adding the components
73
+ // to this request object
74
+ const url = (0, url_1.parse)(href);
75
+ const request = {
76
+ protocol: nonnull(url.protocol),
77
+ hostname: nonnull(url.hostname),
78
+ port: nonnull(url.port),
79
+ path: nonnull(url.pathname) + nonnull(url.search),
80
+ method: options.method || 'GET',
81
+ headers: (0, properties_1.shallowCopy)(options.headers || {}),
82
+ agent: null,
83
+ };
84
+ if (options.allowGzip) {
85
+ request.headers['accept-encoding'] = 'gzip';
86
+ }
87
+ let req = null;
88
+ switch (nonnull(url.protocol)) {
89
+ case 'http:':
90
+ if ((_a = options === null || options === void 0 ? void 0 : options.agents) === null || _a === void 0 ? void 0 : _a.http) {
91
+ request.agent = options.agents.http;
92
+ }
93
+ req = http_1.default.request(request);
94
+ break;
95
+ case 'https:':
96
+ if ((_b = options === null || options === void 0 ? void 0 : options.agents) === null || _b === void 0 ? void 0 : _b.https) {
97
+ request.agent = options.agents.https;
98
+ }
99
+ req = https_1.default.request(request);
100
+ break;
101
+ default:
102
+ /* istanbul ignore next */
103
+ logger.throwError(`unsupported protocol ${url.protocol}`, logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
104
+ protocol: url.protocol,
105
+ operation: 'request',
106
+ });
107
+ }
108
+ if (options.body) {
109
+ req.write(Buffer.from(options.body));
110
+ }
111
+ req.end();
112
+ const response = await getResponse(req);
113
+ return response;
114
+ }
115
+ exports.getUrl = getUrl;
116
+ //# sourceMappingURL=geturl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geturl.js","sourceRoot":"","sources":["../../../../src/eth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Q;gBACtB,SAAS,EAAE,SAAS;aACrB,CACF,CAAC;KACL;IAED,IAAI,OAAO,CAAC,IAAI,EAAE;QAChB,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;KACtC;IACD,GAAG,CAAC,GAAG,EAAE,CAAC;IAEV,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;IACxC,OAAO,QAAQ,CAAC;AAClB,CAAC;AA7DD,wBA6DC","sourcesContent":["/* eslint-disable */\n'use strict';\n\nimport http from 'http';\nimport https from 'https';\nimport { gunzipSync } from 'zlib';\nimport { parse } from 'url';\n\nimport { arrayify, concat } from '@ethersproject/bytes';\nimport { shallowCopy } from '@ethersproject/properties';\n\nimport type { GetUrlResponse, Options } from './types';\n\nimport { Logger } from '@ethersproject/logger';\nimport { version } from './_version';\nconst logger = new Logger(version);\n\nexport { GetUrlResponse, Options };\n\nfunction getResponse(request: http.ClientRequest): Promise<GetUrlResponse> {\n return new Promise((resolve, reject) => {\n request.once('response', (resp: http.IncomingMessage) => {\n const response: GetUrlResponse = {\n statusCode: resp.statusCode,\n statusMessage: resp.statusMessage,\n headers: Object.keys(resp.headers).reduce((accum, name) => {\n let value = resp.headers[name];\n if (Array.isArray(value)) {\n value = value.join(', ');\n }\n accum[name] = value;\n return accum;\n }, <{ [name: string]: string }>{}),\n body: null,\n };\n //resp.setEncoding(\"utf8\");\n\n resp.on('data', (chunk: Uint8Array) => {\n if (response.body == null) {\n response.body = new Uint8Array(0);\n }\n response.body = concat([response.body, chunk]);\n });\n\n resp.on('end', () => {\n if (response.headers['content-encoding'] === 'gzip') {\n //const size = response.body.length;\n response.body = arrayify(gunzipSync(response.body));\n //console.log(\"Delta:\", response.body.length - size, Buffer.from(response.body).toString());\n }\n resolve(response);\n });\n\n resp.on('error', (error) => {\n /* istanbul ignore next */\n (<any>error).response = response;\n reject(error);\n });\n });\n\n request.on('error', (error) => {\n reject(error);\n });\n });\n}\n\n// The URL.parse uses null instead of the empty string\nfunction nonnull(value: string): string {\n if (value == null) {\n return '';\n }\n return value;\n}\n\nexport async function getUrl(\n href: string,\n options?: Options,\n): Promise<GetUrlResponse> {\n if (options == null) {\n options = {};\n }\n\n // @TODO: Once we drop support for node 8, we can pass the href\n // directly into request and skip adding the components\n // to this request object\n const url = parse(href);\n\n const request = {\n protocol: nonnull(url.protocol),\n hostname: nonnull(url.hostname),\n port: nonnull(url.port),\n path: nonnull(url.pathname) + nonnull(url.search),\n\n method: options.method || 'GET',\n headers: shallowCopy(options.headers || {}),\n agent: null,\n };\n\n if (options.allowGzip) {\n request.headers['accept-encoding'] = 'gzip';\n }\n\n let req: http.ClientRequest = null;\n switch (nonnull(url.protocol)) {\n case 'http:':\n if (options?.agents?.http) {\n request.agent = options.agents.http;\n }\n req = http.request(request);\n break;\n case 'https:':\n if (options?.agents?.https) {\n request.agent = options.agents.https;\n }\n req = https.request(request);\n break;\n default:\n /* istanbul ignore next */\n logger.throwError(\n `unsupported protocol ${url.protocol}`,\n Logger.errors.UNSUPPORTED_OPERATION,\n {\n protocol: url.protocol,\n operation: 'request',\n },\n );\n }\n\n if (options.body) {\n req.write(Buffer.from(options.body));\n }\n req.end();\n\n const response = await getResponse(req);\n return response;\n}\n"]}
@@ -0,0 +1,49 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import http from 'http';
4
+ import https from 'https';
5
+ export declare type ConnectionInfo = {
6
+ url: string;
7
+ headers?: {
8
+ [key: string]: string | number;
9
+ };
10
+ user?: string;
11
+ password?: string;
12
+ allowInsecureAuthentication?: boolean;
13
+ allowGzip?: boolean;
14
+ throttleLimit?: number;
15
+ throttleSlotInterval?: number;
16
+ throttleCallback?: (attempt: number, url: string) => Promise<boolean>;
17
+ skipFetchSetup?: boolean;
18
+ fetchOptions?: Record<string, string>;
19
+ errorPassThrough?: boolean;
20
+ timeout?: number;
21
+ agents?: {
22
+ http?: http.Agent;
23
+ https?: https.Agent;
24
+ };
25
+ };
26
+ export interface OnceBlockable {
27
+ once(eventName: 'block', handler: () => void): void;
28
+ }
29
+ export interface OncePollable {
30
+ once(eventName: 'poll', handler: () => void): void;
31
+ }
32
+ export declare type PollOptions = {
33
+ timeout?: number;
34
+ floor?: number;
35
+ ceiling?: number;
36
+ interval?: number;
37
+ retryLimit?: number;
38
+ onceBlock?: OnceBlockable;
39
+ oncePoll?: OncePollable;
40
+ };
41
+ export declare type FetchJsonResponse = {
42
+ statusCode: number;
43
+ headers: {
44
+ [header: string]: string;
45
+ };
46
+ };
47
+ export declare function _fetchData<T = Uint8Array>(connection: string | ConnectionInfo, body?: Uint8Array, processFunc?: (value: Uint8Array, response: FetchJsonResponse) => T): Promise<T>;
48
+ export declare function fetchJson(connection: string | ConnectionInfo, json?: string, processFunc?: (value: any, response: FetchJsonResponse) => any): Promise<any>;
49
+ export declare function poll<T>(func: () => Promise<T>, options?: PollOptions): Promise<T>;
@@ -0,0 +1,433 @@
1
+ /* eslint-disable */
2
+ 'use strict';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.poll = exports.fetchJson = exports._fetchData = void 0;
5
+ const base64_1 = require("@ethersproject/base64");
6
+ const bytes_1 = require("@ethersproject/bytes");
7
+ const properties_1 = require("@ethersproject/properties");
8
+ const strings_1 = require("@ethersproject/strings");
9
+ const logger_1 = require("@ethersproject/logger");
10
+ const _version_1 = require("./_version");
11
+ const logger = new logger_1.Logger(_version_1.version);
12
+ const geturl_1 = require("./geturl");
13
+ function staller(duration) {
14
+ return new Promise((resolve) => {
15
+ setTimeout(resolve, duration);
16
+ });
17
+ }
18
+ function bodyify(value, type) {
19
+ if (value == null) {
20
+ return null;
21
+ }
22
+ if (typeof value === 'string') {
23
+ return value;
24
+ }
25
+ if ((0, bytes_1.isBytesLike)(value)) {
26
+ if (type &&
27
+ (type.split('/')[0] === 'text' ||
28
+ type.split(';')[0].trim() === 'application/json')) {
29
+ try {
30
+ return (0, strings_1.toUtf8String)(value);
31
+ }
32
+ catch (error) { }
33
+ }
34
+ return (0, bytes_1.hexlify)(value);
35
+ }
36
+ return value;
37
+ }
38
+ function unpercent(value) {
39
+ return (0, strings_1.toUtf8Bytes)(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => {
40
+ return String.fromCharCode(parseInt(code, 16));
41
+ }));
42
+ }
43
+ // This API is still a work in progress; the future changes will likely be:
44
+ // - ConnectionInfo => FetchDataRequest<T = any>
45
+ // - FetchDataRequest.body? = string | Uint8Array | { contentType: string, data: string | Uint8Array }
46
+ // - If string => text/plain, Uint8Array => application/octet-stream (if content-type unspecified)
47
+ // - FetchDataRequest.processFunc = (body: Uint8Array, response: FetchDataResponse) => T
48
+ // For this reason, it should be considered internal until the API is finalized
49
+ function _fetchData(connection, body, processFunc) {
50
+ // How many times to retry in the event of a throttle
51
+ const attemptLimit = typeof connection === 'object' && connection.throttleLimit != null
52
+ ? connection.throttleLimit
53
+ : 12;
54
+ logger.assertArgument(attemptLimit > 0 && attemptLimit % 1 === 0, 'invalid connection throttle limit', 'connection.throttleLimit', attemptLimit);
55
+ const throttleCallback = typeof connection === 'object' ? connection.throttleCallback : null;
56
+ const throttleSlotInterval = typeof connection === 'object' &&
57
+ typeof connection.throttleSlotInterval === 'number'
58
+ ? connection.throttleSlotInterval
59
+ : 100;
60
+ logger.assertArgument(throttleSlotInterval > 0 && throttleSlotInterval % 1 === 0, 'invalid connection throttle slot interval', 'connection.throttleSlotInterval', throttleSlotInterval);
61
+ const errorPassThrough = typeof connection === 'object' ? !!connection.errorPassThrough : false;
62
+ const headers = {};
63
+ let url = null;
64
+ // @TODO: Allow ConnectionInfo to override some of these values
65
+ const options = {
66
+ method: 'GET',
67
+ };
68
+ let allow304 = false;
69
+ let timeout = 2 * 60 * 1000;
70
+ if (typeof connection === 'string') {
71
+ url = connection;
72
+ }
73
+ else if (typeof connection === 'object') {
74
+ if (connection == null || connection.url == null) {
75
+ logger.throwArgumentError('missing URL', 'connection.url', connection);
76
+ }
77
+ url = connection.url;
78
+ if (typeof connection.timeout === 'number' && connection.timeout > 0) {
79
+ timeout = connection.timeout;
80
+ }
81
+ if (connection.headers) {
82
+ for (const key in connection.headers) {
83
+ headers[key.toLowerCase()] = {
84
+ key: key,
85
+ value: String(connection.headers[key]),
86
+ };
87
+ if (['if-none-match', 'if-modified-since'].indexOf(key.toLowerCase()) >= 0) {
88
+ allow304 = true;
89
+ }
90
+ }
91
+ }
92
+ options.allowGzip = !!connection.allowGzip;
93
+ if (connection.user != null && connection.password != null) {
94
+ if (url.substring(0, 6) !== 'https:' &&
95
+ connection.allowInsecureAuthentication !== true) {
96
+ logger.throwError('basic authentication requires a secure https url', logger_1.Logger.errors.INVALID_ARGUMENT, {
97
+ argument: 'url',
98
+ url: url,
99
+ user: connection.user,
100
+ password: '[REDACTED]',
101
+ });
102
+ }
103
+ const authorization = connection.user + ':' + connection.password;
104
+ headers['authorization'] = {
105
+ key: 'Authorization',
106
+ value: 'Basic ' + (0, base64_1.encode)((0, strings_1.toUtf8Bytes)(authorization)),
107
+ };
108
+ }
109
+ if (connection.skipFetchSetup != null) {
110
+ options.skipFetchSetup = !!connection.skipFetchSetup;
111
+ }
112
+ if (connection.fetchOptions != null) {
113
+ options.fetchOptions = (0, properties_1.shallowCopy)(connection.fetchOptions);
114
+ }
115
+ if (connection.agents != null) {
116
+ options.agents = connection.agents;
117
+ }
118
+ }
119
+ const reData = new RegExp('^data:([^;:]*)?(;base64)?,(.*)$', 'i');
120
+ const dataMatch = url ? url.match(reData) : null;
121
+ if (dataMatch) {
122
+ try {
123
+ const response = {
124
+ statusCode: 200,
125
+ statusMessage: 'OK',
126
+ headers: { 'content-type': dataMatch[1] || 'text/plain' },
127
+ body: dataMatch[2]
128
+ ? (0, base64_1.decode)(dataMatch[3])
129
+ : unpercent(dataMatch[3]),
130
+ };
131
+ let result = response.body;
132
+ if (processFunc) {
133
+ result = processFunc(response.body, response);
134
+ }
135
+ return Promise.resolve(result);
136
+ }
137
+ catch (error) {
138
+ logger.throwError('processing response error', logger_1.Logger.errors.SERVER_ERROR, {
139
+ body: bodyify(dataMatch[1], dataMatch[2]),
140
+ error: error,
141
+ requestBody: null,
142
+ requestMethod: 'GET',
143
+ url: url,
144
+ });
145
+ }
146
+ }
147
+ if (body) {
148
+ options.method = 'POST';
149
+ options.body = body;
150
+ if (headers['content-type'] == null) {
151
+ headers['content-type'] = {
152
+ key: 'Content-Type',
153
+ value: 'application/octet-stream',
154
+ };
155
+ }
156
+ if (headers['content-length'] == null) {
157
+ headers['content-length'] = {
158
+ key: 'Content-Length',
159
+ value: String(body.length),
160
+ };
161
+ }
162
+ }
163
+ const flatHeaders = {};
164
+ Object.keys(headers).forEach((key) => {
165
+ const header = headers[key];
166
+ flatHeaders[header.key] = header.value;
167
+ });
168
+ options.headers = flatHeaders;
169
+ const runningTimeout = (function () {
170
+ let timer = null;
171
+ const promise = new Promise(function (resolve, reject) {
172
+ if (timeout) {
173
+ timer = setTimeout(() => {
174
+ if (timer == null) {
175
+ return;
176
+ }
177
+ timer = null;
178
+ reject(logger.makeError('timeout', logger_1.Logger.errors.TIMEOUT, {
179
+ requestBody: bodyify(options.body, flatHeaders['content-type']),
180
+ requestMethod: options.method,
181
+ timeout: timeout,
182
+ url: url,
183
+ }));
184
+ }, timeout);
185
+ }
186
+ });
187
+ const cancel = function () {
188
+ if (timer == null) {
189
+ return;
190
+ }
191
+ clearTimeout(timer);
192
+ timer = null;
193
+ };
194
+ return { promise, cancel };
195
+ })();
196
+ const runningFetch = (async function () {
197
+ for (let attempt = 0; attempt < attemptLimit; attempt++) {
198
+ let response = null;
199
+ try {
200
+ response = await (0, geturl_1.getUrl)(url, options);
201
+ if (attempt < attemptLimit) {
202
+ if (response.statusCode === 301 || response.statusCode === 302) {
203
+ // Redirection; for now we only support absolute locataions
204
+ const location = response.headers.location || '';
205
+ if (options.method === 'GET' && location.match(/^https:/)) {
206
+ url = response.headers.location;
207
+ continue;
208
+ }
209
+ }
210
+ else if (response.statusCode === 429) {
211
+ // Exponential back-off throttling
212
+ let tryAgain = true;
213
+ if (throttleCallback) {
214
+ tryAgain = await throttleCallback(attempt, url);
215
+ }
216
+ if (tryAgain) {
217
+ let stall = 0;
218
+ const retryAfter = response.headers['retry-after'];
219
+ if (typeof retryAfter === 'string' &&
220
+ retryAfter.match(/^[1-9][0-9]*$/)) {
221
+ stall = parseInt(retryAfter) * 1000;
222
+ }
223
+ else {
224
+ stall =
225
+ throttleSlotInterval *
226
+ parseInt(String(Math.random() * Math.pow(2, attempt)));
227
+ }
228
+ //console.log("Stalling 429");
229
+ await staller(stall);
230
+ continue;
231
+ }
232
+ }
233
+ }
234
+ }
235
+ catch (error) {
236
+ response = error.response;
237
+ if (response == null) {
238
+ runningTimeout.cancel();
239
+ logger.throwError('missing response', logger_1.Logger.errors.SERVER_ERROR, {
240
+ requestBody: bodyify(options.body, flatHeaders['content-type']),
241
+ requestMethod: options.method,
242
+ serverError: error,
243
+ url: url,
244
+ });
245
+ }
246
+ }
247
+ let body = response.body;
248
+ if (allow304 && response.statusCode === 304) {
249
+ body = null;
250
+ }
251
+ else if (!errorPassThrough &&
252
+ (response.statusCode < 200 || response.statusCode >= 300)) {
253
+ runningTimeout.cancel();
254
+ logger.throwError('bad response', logger_1.Logger.errors.SERVER_ERROR, {
255
+ status: response.statusCode,
256
+ headers: response.headers,
257
+ body: bodyify(body, response.headers ? response.headers['content-type'] : null),
258
+ requestBody: bodyify(options.body, flatHeaders['content-type']),
259
+ requestMethod: options.method,
260
+ url: url,
261
+ });
262
+ }
263
+ if (processFunc) {
264
+ try {
265
+ const result = await processFunc(body, response);
266
+ runningTimeout.cancel();
267
+ return result;
268
+ }
269
+ catch (error) {
270
+ // Allow the processFunc to trigger a throttle
271
+ if (error.throttleRetry && attempt < attemptLimit) {
272
+ let tryAgain = true;
273
+ if (throttleCallback) {
274
+ tryAgain = await throttleCallback(attempt, url);
275
+ }
276
+ if (tryAgain) {
277
+ const timeout = throttleSlotInterval *
278
+ parseInt(String(Math.random() * Math.pow(2, attempt)));
279
+ //console.log("Stalling callback");
280
+ await staller(timeout);
281
+ continue;
282
+ }
283
+ }
284
+ runningTimeout.cancel();
285
+ logger.throwError('processing response error', logger_1.Logger.errors.SERVER_ERROR, {
286
+ body: bodyify(body, response.headers ? response.headers['content-type'] : null),
287
+ error: error,
288
+ requestBody: bodyify(options.body, flatHeaders['content-type']),
289
+ requestMethod: options.method,
290
+ url: url,
291
+ });
292
+ }
293
+ }
294
+ runningTimeout.cancel();
295
+ // If we had a processFunc, it either returned a T or threw above.
296
+ // The "body" is now a Uint8Array.
297
+ return body;
298
+ }
299
+ return logger.throwError('failed response', logger_1.Logger.errors.SERVER_ERROR, {
300
+ requestBody: bodyify(options.body, flatHeaders['content-type']),
301
+ requestMethod: options.method,
302
+ url: url,
303
+ });
304
+ })();
305
+ return Promise.race([runningTimeout.promise, runningFetch]);
306
+ }
307
+ exports._fetchData = _fetchData;
308
+ function fetchJson(connection, json, processFunc) {
309
+ let processJsonFunc = (value, response) => {
310
+ let result = null;
311
+ if (value != null) {
312
+ try {
313
+ result = JSON.parse((0, strings_1.toUtf8String)(value));
314
+ }
315
+ catch (error) {
316
+ logger.throwError('invalid JSON', logger_1.Logger.errors.SERVER_ERROR, {
317
+ body: value,
318
+ error: error,
319
+ });
320
+ }
321
+ }
322
+ if (processFunc) {
323
+ result = processFunc(result, response);
324
+ }
325
+ return result;
326
+ };
327
+ // If we have json to send, we must
328
+ // - add content-type of application/json (unless already overridden)
329
+ // - convert the json to bytes
330
+ let body = null;
331
+ if (json != null) {
332
+ body = (0, strings_1.toUtf8Bytes)(json);
333
+ // Create a connection with the content-type set for JSON
334
+ const updated = typeof connection === 'string'
335
+ ? { url: connection }
336
+ : (0, properties_1.shallowCopy)(connection);
337
+ if (updated.headers) {
338
+ const hasContentType = Object.keys(updated.headers).filter((k) => k.toLowerCase() === 'content-type').length !== 0;
339
+ if (!hasContentType) {
340
+ updated.headers = (0, properties_1.shallowCopy)(updated.headers);
341
+ updated.headers['content-type'] = 'application/json';
342
+ }
343
+ }
344
+ else {
345
+ updated.headers = { 'content-type': 'application/json' };
346
+ }
347
+ connection = updated;
348
+ }
349
+ return _fetchData(connection, body, processJsonFunc);
350
+ }
351
+ exports.fetchJson = fetchJson;
352
+ function poll(func, options) {
353
+ if (!options) {
354
+ options = {};
355
+ }
356
+ options = (0, properties_1.shallowCopy)(options);
357
+ if (options.floor == null) {
358
+ options.floor = 0;
359
+ }
360
+ if (options.ceiling == null) {
361
+ options.ceiling = 10000;
362
+ }
363
+ if (options.interval == null) {
364
+ options.interval = 250;
365
+ }
366
+ return new Promise(function (resolve, reject) {
367
+ let timer = null;
368
+ let done = false;
369
+ // Returns true if cancel was successful. Unsuccessful cancel means we're already done.
370
+ const cancel = () => {
371
+ if (done) {
372
+ return false;
373
+ }
374
+ done = true;
375
+ if (timer) {
376
+ clearTimeout(timer);
377
+ }
378
+ return true;
379
+ };
380
+ if (options.timeout) {
381
+ timer = setTimeout(() => {
382
+ if (cancel()) {
383
+ reject(new Error('timeout'));
384
+ }
385
+ }, options.timeout);
386
+ }
387
+ const retryLimit = options.retryLimit;
388
+ let attempt = 0;
389
+ function check() {
390
+ return func().then(function (result) {
391
+ // If we have a result, or are allowed null then we're done
392
+ if (result !== undefined) {
393
+ if (cancel()) {
394
+ resolve(result);
395
+ }
396
+ }
397
+ else if (options.oncePoll) {
398
+ options.oncePoll.once('poll', check);
399
+ }
400
+ else if (options.onceBlock) {
401
+ options.onceBlock.once('block', check);
402
+ // Otherwise, exponential back-off (up to 10s) our next request
403
+ }
404
+ else if (!done) {
405
+ attempt++;
406
+ if (attempt > retryLimit) {
407
+ if (cancel()) {
408
+ reject(new Error('retry limit reached'));
409
+ }
410
+ return;
411
+ }
412
+ let timeout = options.interval *
413
+ parseInt(String(Math.random() * Math.pow(2, attempt)));
414
+ if (timeout < options.floor) {
415
+ timeout = options.floor;
416
+ }
417
+ if (timeout > options.ceiling) {
418
+ timeout = options.ceiling;
419
+ }
420
+ setTimeout(check, timeout);
421
+ }
422
+ return null;
423
+ }, function (error) {
424
+ if (cancel()) {
425
+ reject(error);
426
+ }
427
+ });
428
+ }
429
+ check();
430
+ });
431
+ }
432
+ exports.poll = poll;
433
+ //# sourceMappingURL=index.js.map