@subql/node-ethereum 5.6.2 → 6.0.1-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/blockchain.service.d.ts +1 -1
- package/dist/blockchain.service.js.map +1 -1
- package/dist/ethereum/ethers/web/index.js +2 -1
- package/dist/ethereum/ethers/web/index.js.map +1 -1
- package/dist/indexer/fetch.module.js +3 -3
- package/dist/indexer/fetch.module.js.map +1 -1
- package/dist/subcommands/reindex.module.js +1 -0
- package/dist/subcommands/reindex.module.js.map +1 -1
- package/package.json +10 -9
|
@@ -24,7 +24,7 @@ export declare class BlockchainService implements IBlockchainService<SubqlDataso
|
|
|
24
24
|
getHeaderForHash(hash: string): Promise<Header>;
|
|
25
25
|
getHeaderForHeight(height: number): Promise<Header>;
|
|
26
26
|
getSafeApi(block: BlockContent): Promise<SafeEthProvider>;
|
|
27
|
-
getBlockTimestamp(height: number): Promise<Date
|
|
27
|
+
getBlockTimestamp(height: number): Promise<Date>;
|
|
28
28
|
updateDynamicDs(params: DatasourceParams, dsObj: SubqlEthereumDataSource | SubqlCustomDatasource): Promise<void>;
|
|
29
29
|
onProjectChange(project: SubqueryProject): Promise<void> | void;
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockchain.service.js","sourceRoot":"","sources":["../src/blockchain.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;AAEnC,2CAAwC;AACxC,4DAMgC;AAgBhC,yDAAiD;AACjD,qDAA+C;AAE/C,yCAAgD;AAEhD,8DAAgF;AAChF,2CAA6D;AAG7D,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,iBA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,MAAM,GAAG,IAAA,8BAAY,EAAC,QAAQ,EAAE;gBACpC,SAAS,EAAE,IAAI;gBACf,oBAAoB,EAAE,KAAK;aAC5B,CAAC,CAAC;YACH,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClB,MAAM,IAAI,KAAK,CACb,0BAA0B,MAAM;qBAC7B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;qBACxB,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,gBAAgB;IAClB,CAAC;IAED,eAAe,CAAC,OAAwB;QACtC,IAAI,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC;IACxC,CAAC;CACF,CAAA;AAhHY,8CAAiB;4BAAjB,iBAAiB;IAiBf,WAAA,IAAA,eAAM,EAAC,YAAY,CAAC,CAAA;qCAAqB,6BAAkB;GAjB7D,iBAAiB,CAgH7B","sourcesContent":["// Copyright 2020-2025 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Inject } from '@nestjs/common';\nimport {\n EthereumHandlerKind,\n EthereumRuntimeDataSourceImpl,\n isCustomDs,\n isRuntimeDs,\n SubqlEthereumDataSource,\n} from '@subql/common-ethereum';\nimport {\n DatasourceParams,\n Header,\n IBlock,\n IBlockchainService,\n} from '@subql/node-core';\nimport {\n EthereumBlock,\n LightEthereumBlock,\n SubqlCustomDatasource,\n SubqlCustomHandler,\n SubqlDatasource,\n SubqlMapping,\n SubqlRuntimeDatasource,\n} from '@subql/types-ethereum';\nimport { plainToClass } from 'class-transformer';\nimport { validateSync } from 'class-validator';\nimport { SubqueryProject } from './configure/SubqueryProject';\nimport { EthereumApiService } from './ethereum';\nimport SafeEthProvider from './ethereum/safe-api';\nimport { calcInterval, ethereumBlockToHeader } from './ethereum/utils.ethereum';\nimport { BlockContent, getBlockSize } from './indexer/types';\nimport { IIndexerWorker } from './indexer/worker/worker';\n\nconst BLOCK_TIME_VARIANCE = 5000;\n\nconst INTERVAL_PERCENT = 0.9;\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { version: packageVersion } = require('../package.json');\n\nexport class BlockchainService\n implements\n IBlockchainService<\n SubqlDatasource,\n SubqlCustomDatasource<string, SubqlMapping<SubqlCustomHandler>>,\n SubqueryProject,\n SafeEthProvider,\n LightEthereumBlock,\n EthereumBlock,\n IIndexerWorker\n >\n{\n blockHandlerKind = EthereumHandlerKind.Block;\n isCustomDs = isCustomDs;\n isRuntimeDs = isRuntimeDs;\n packageVersion = packageVersion;\n\n constructor(@Inject('APIService') private apiService: EthereumApiService) {}\n\n async fetchBlocks(\n blockNums: number[],\n ): Promise<IBlock<EthereumBlock>[] | IBlock<LightEthereumBlock>[]> {\n return this.apiService.fetchBlocks(blockNums);\n }\n\n async fetchBlockWorker(\n worker: IIndexerWorker,\n blockNum: number,\n context: { workers: IIndexerWorker[] },\n ): Promise<Header> {\n return worker.fetchBlock(blockNum, 0);\n }\n\n getBlockSize(block: IBlock<BlockContent>): number {\n return getBlockSize(block.block);\n }\n\n async getFinalizedHeader(): Promise<Header> {\n const block = await this.apiService.api.getFinalizedBlock();\n return ethereumBlockToHeader(block);\n }\n\n async getBestHeight(): Promise<number> {\n return this.apiService.api.getBestBlockHeight();\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async getChainInterval(): Promise<number> {\n const CHAIN_INTERVAL = calcInterval(this.apiService.api) * INTERVAL_PERCENT;\n\n return Math.min(BLOCK_TIME_VARIANCE, CHAIN_INTERVAL);\n }\n\n async getHeaderForHash(hash: string): Promise<Header> {\n const block = await this.apiService.api.getBlockByHeightOrHash(hash);\n return ethereumBlockToHeader(block);\n }\n\n async getHeaderForHeight(height: number): Promise<Header> {\n const block = await this.apiService.api.getBlockByHeightOrHash(height);\n return ethereumBlockToHeader(block);\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async getSafeApi(block: BlockContent): Promise<SafeEthProvider> {\n return this.apiService.safeApi(block.number);\n }\n\n async getBlockTimestamp(height: number): Promise<Date
|
|
1
|
+
{"version":3,"file":"blockchain.service.js","sourceRoot":"","sources":["../src/blockchain.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;AAEnC,2CAAwC;AACxC,4DAMgC;AAgBhC,yDAAiD;AACjD,qDAA+C;AAE/C,yCAAgD;AAEhD,8DAAgF;AAChF,2CAA6D;AAG7D,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE/D,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;IAiBc;IAL1C,gBAAgB,GAAG,qCAAmB,CAAC,KAAK,CAAC;IAC7C,UAAU,GAAG,4BAAU,CAAC;IACxB,WAAW,GAAG,6BAAW,CAAC;IAC1B,cAAc,GAAG,cAAc,CAAC;IAEhC,YAA0C,UAA8B;QAA9B,eAAU,GAAV,UAAU,CAAoB;IAAG,CAAC;IAE5E,KAAK,CAAC,WAAW,CACf,SAAmB;QAEnB,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,gBAAgB,CACpB,MAAsB,EACtB,QAAgB,EAChB,OAAsC;QAEtC,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC;IAED,YAAY,CAAC,KAA2B;QACtC,OAAO,IAAA,oBAAY,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;QAC5D,OAAO,IAAA,sCAAqB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A,4BAAU,EAAC,KAAK,CAAC,EAAE,CAAC;YACtB,KAAK,CAAC,SAAS,CAAC,OAAO,GAAG;gBACxB,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO;gBAC1B,GAAG,MAAM,CAAC,IAAI;aACf,CAAC;YACF,wCAAwC;YACxC,2DAA2D;QAC7D,CAAC;aAAM,IAAI,IAAA,6BAAW,EAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,KAAK,CAAC,OAAO,GAAG;gBACd,GAAG,KAAK,CAAC,OAAO;gBAChB,GAAG,MAAM,CAAC,IAAI;aACf,CAAC;YAEF,MAAM,QAAQ,GAAG,IAAA,gCAAY,EAAC,+CAA6B,EAAE,KAAK,CAAC,CAAC;YAEpE,MAAM,MAAM,GAAG,IAAA,8BAAY,EAAC,QAAQ,EAAE;gBACpC,SAAS,EAAE,IAAI;gBACf,oBAAoB,EAAE,KAAK;aAC5B,CAAC,CAAC;YACH,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClB,MAAM,IAAI,KAAK,CACb,0BAA0B,MAAM;qBAC7B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;qBACxB,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;YACJ,CAAC;QACH,CAAC;QACD,gBAAgB;IAClB,CAAC;IAED,eAAe,CAAC,OAAwB;QACtC,IAAI,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC;IACxC,CAAC;CACF,CAAA;AAhHY,8CAAiB;4BAAjB,iBAAiB;IAiBf,WAAA,IAAA,eAAM,EAAC,YAAY,CAAC,CAAA;qCAAqB,6BAAkB;GAjB7D,iBAAiB,CAgH7B","sourcesContent":["// Copyright 2020-2025 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Inject } from '@nestjs/common';\nimport {\n EthereumHandlerKind,\n EthereumRuntimeDataSourceImpl,\n isCustomDs,\n isRuntimeDs,\n SubqlEthereumDataSource,\n} from '@subql/common-ethereum';\nimport {\n DatasourceParams,\n Header,\n IBlock,\n IBlockchainService,\n} from '@subql/node-core';\nimport {\n EthereumBlock,\n LightEthereumBlock,\n SubqlCustomDatasource,\n SubqlCustomHandler,\n SubqlDatasource,\n SubqlMapping,\n SubqlRuntimeDatasource,\n} from '@subql/types-ethereum';\nimport { plainToClass } from 'class-transformer';\nimport { validateSync } from 'class-validator';\nimport { SubqueryProject } from './configure/SubqueryProject';\nimport { EthereumApiService } from './ethereum';\nimport SafeEthProvider from './ethereum/safe-api';\nimport { calcInterval, ethereumBlockToHeader } from './ethereum/utils.ethereum';\nimport { BlockContent, getBlockSize } from './indexer/types';\nimport { IIndexerWorker } from './indexer/worker/worker';\n\nconst BLOCK_TIME_VARIANCE = 5000;\n\nconst INTERVAL_PERCENT = 0.9;\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { version: packageVersion } = require('../package.json');\n\nexport class BlockchainService\n implements\n IBlockchainService<\n SubqlDatasource,\n SubqlCustomDatasource<string, SubqlMapping<SubqlCustomHandler>>,\n SubqueryProject,\n SafeEthProvider,\n LightEthereumBlock,\n EthereumBlock,\n IIndexerWorker\n >\n{\n blockHandlerKind = EthereumHandlerKind.Block;\n isCustomDs = isCustomDs;\n isRuntimeDs = isRuntimeDs;\n packageVersion = packageVersion;\n\n constructor(@Inject('APIService') private apiService: EthereumApiService) {}\n\n async fetchBlocks(\n blockNums: number[],\n ): Promise<IBlock<EthereumBlock>[] | IBlock<LightEthereumBlock>[]> {\n return this.apiService.fetchBlocks(blockNums);\n }\n\n async fetchBlockWorker(\n worker: IIndexerWorker,\n blockNum: number,\n context: { workers: IIndexerWorker[] },\n ): Promise<Header> {\n return worker.fetchBlock(blockNum, 0);\n }\n\n getBlockSize(block: IBlock<BlockContent>): number {\n return getBlockSize(block.block);\n }\n\n async getFinalizedHeader(): Promise<Header> {\n const block = await this.apiService.api.getFinalizedBlock();\n return ethereumBlockToHeader(block);\n }\n\n async getBestHeight(): Promise<number> {\n return this.apiService.api.getBestBlockHeight();\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async getChainInterval(): Promise<number> {\n const CHAIN_INTERVAL = calcInterval(this.apiService.api) * INTERVAL_PERCENT;\n\n return Math.min(BLOCK_TIME_VARIANCE, CHAIN_INTERVAL);\n }\n\n async getHeaderForHash(hash: string): Promise<Header> {\n const block = await this.apiService.api.getBlockByHeightOrHash(hash);\n return ethereumBlockToHeader(block);\n }\n\n async getHeaderForHeight(height: number): Promise<Header> {\n const block = await this.apiService.api.getBlockByHeightOrHash(height);\n return ethereumBlockToHeader(block);\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async getSafeApi(block: BlockContent): Promise<SafeEthProvider> {\n return this.apiService.safeApi(block.number);\n }\n\n async getBlockTimestamp(height: number): Promise<Date> {\n const block = await this.apiService.unsafeApi.api.getBlock(height);\n\n return new Date(block.timestamp * 1000); // TODO test and make sure its in MS not S\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async updateDynamicDs(\n params: DatasourceParams,\n dsObj: SubqlEthereumDataSource | SubqlCustomDatasource,\n ): Promise<void> {\n if (isCustomDs(dsObj)) {\n dsObj.processor.options = {\n ...dsObj.processor.options,\n ...params.args,\n };\n // TODO how to retain this functionality\n // await this.dsProcessorService.validateCustomDs([dsObj]);\n } else if (isRuntimeDs(dsObj)) {\n dsObj.options = {\n ...dsObj.options,\n ...params.args,\n };\n\n const parsedDs = plainToClass(EthereumRuntimeDataSourceImpl, dsObj);\n\n const errors = validateSync(parsedDs, {\n whitelist: true,\n forbidNonWhitelisted: false,\n });\n if (errors.length) {\n throw new Error(\n `Dynamic ds is invalid\\n${errors\n .map((e) => e.toString())\n .join('\\n')}`,\n );\n }\n }\n // return dsObj;\n }\n\n onProjectChange(project: SubqueryProject): Promise<void> | void {\n this.apiService.updateBlockFetching();\n }\n}\n"]}
|
|
@@ -317,7 +317,8 @@ function fetchJson(connection, json, processFunc) {
|
|
|
317
317
|
let result = null;
|
|
318
318
|
if (value != null) {
|
|
319
319
|
try {
|
|
320
|
-
|
|
320
|
+
// This is modified from the ethers source, the previous code caused a massive memory leak with logs for this block https://sonicscan.org/block/20222346
|
|
321
|
+
result = JSON.parse(new TextDecoder('utf8').decode(value));
|
|
321
322
|
}
|
|
322
323
|
catch (error) {
|
|
323
324
|
logger.throwError('invalid JSON', logger_1.Logger.errors.SERVER_ERROR, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethereum/ethers/web/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,YAAY,CAAC;;AAmHb,gCA0VC;AAED,8BAwDC;AAED,oBA4FC;AAjmBD,kDAG+B;AAC/B,gDAA4D;AAC5D,0DAAwD;AACxD,oDAAmE;AAEnE,kDAA+C;AAC/C,yCAAqC;AACrC,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,kBAAO,CAAC,CAAC;AAEnC,qCAA2D;AAE3D,SAAS,OAAO,CAAC,QAAgB;IAC/B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,OAAO,CAAC,KAAU,EAAE,IAAmB;IAC9C,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,IAAA,mBAAW,EAAC,KAAK,CAAC,EAAE,CAAC;QACvB,IACE,IAAI;YACJ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM;gBAC5B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK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qBAAM,IAAI,OAAO,EAAE,SAAS,EAAE,CAAC;oBAC9B,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;oBAEvC,+DAA+D;gBACjE,CAAC;qBAAM,IAAI,CAAC,IAAI,EAAE,CAAC;oBACjB,OAAO,EAAE,CAAC;oBACV,IAAI,OAAO,GAAG,UAAU,EAAE,CAAC;wBACzB,IAAI,MAAM,EAAE,EAAE,CAAC;4BACb,MAAM,CAAC,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;wBAC3C,CAAC;wBACD,OAAO;oBACT,CAAC;oBAED,IAAI,OAAO,GACT,OAAQ,CAAC,QAAS;wBAClB,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;oBACzD,IAAI,OAAO,GAAG,OAAQ,CAAC,KAAM,EAAE,CAAC;wBAC9B,OAAO,GAAG,OAAQ,CAAC,KAAM,CAAC;oBAC5B,CAAC;oBACD,IAAI,OAAO,GAAG,OAAQ,CAAC,OAAQ,EAAE,CAAC;wBAChC,OAAO,GAAG,OAAQ,CAAC,OAAQ,CAAC;oBAC9B,CAAC;oBAED,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBAC7B,CAAC;gBAED,OAAO,IAAI,CAAC;YACd,CAAC,EACD,UAAU,KAAK;gBACb,IAAI,MAAM,EAAE,EAAE,CAAC;oBACb,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC;YACH,CAAC,CACF,CAAC;QACJ,CAAC;QACD,KAAK,EAAE,CAAC;IACV,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable */\n'use strict';\n\nimport http from 'http';\nimport https from 'https';\nimport {\n decode as base64Decode,\n encode as base64Encode,\n} from '@ethersproject/base64';\nimport { hexlify, isBytesLike } from '@ethersproject/bytes';\nimport { shallowCopy } from '@ethersproject/properties';\nimport { toUtf8Bytes, toUtf8String } from '@ethersproject/strings';\n\nimport { Logger } from '@ethersproject/logger';\nimport { version } from './_version';\nconst logger = new Logger(version);\n\nimport { getUrl, GetUrlResponse, Options } from './geturl';\n\nfunction staller(duration: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, duration);\n });\n}\n\nfunction bodyify(value: any, type: string | null): string | null {\n if (value == null) {\n return null;\n }\n\n if (typeof value === 'string') {\n return value;\n }\n\n if (isBytesLike(value)) {\n if (\n type &&\n (type.split('/')[0] === 'text' ||\n type.split(';')[0].trim() === 'application/json')\n ) {\n try {\n return toUtf8String(value);\n } catch (error) {}\n }\n return hexlify(value);\n }\n\n return value;\n}\n\n// Exported Types\nexport type ConnectionInfo = {\n url: string;\n headers?: { [key: string]: string | number };\n\n user?: string;\n password?: string;\n\n allowInsecureAuthentication?: boolean;\n allowGzip?: boolean;\n\n throttleLimit?: number;\n throttleSlotInterval?: number;\n throttleCallback?: (attempt: number, url: string) => Promise<boolean>;\n\n skipFetchSetup?: boolean;\n fetchOptions?: Record<string, string>;\n errorPassThrough?: boolean;\n\n timeout?: number;\n\n agents?: {\n http?: http.Agent;\n https?: https.Agent;\n };\n};\n\nexport interface OnceBlockable {\n once(eventName: 'block', handler: () => void): void;\n}\n\nexport interface OncePollable {\n once(eventName: 'poll', handler: () => void): void;\n}\n\nexport type PollOptions = {\n timeout?: number;\n floor?: number;\n ceiling?: number;\n interval?: number;\n retryLimit?: number;\n onceBlock?: OnceBlockable;\n oncePoll?: OncePollable;\n};\n\nexport type FetchJsonResponse = {\n statusCode: number;\n headers: { [header: string]: string };\n};\n\ntype Header = { key: string; value: string };\n\nfunction unpercent(value: string): Uint8Array {\n return toUtf8Bytes(\n value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => {\n return String.fromCharCode(parseInt(code, 16));\n }),\n );\n}\n\n// This API is still a work in progress; the future changes will likely be:\n// - ConnectionInfo => FetchDataRequest<T = any>\n// - FetchDataRequest.body? = string | Uint8Array | { contentType: string, data: string | Uint8Array }\n// - If string => text/plain, Uint8Array => application/octet-stream (if content-type unspecified)\n// - FetchDataRequest.processFunc = (body: Uint8Array, response: FetchDataResponse) => T\n// For this reason, it should be considered internal until the API is finalized\nexport function _fetchData<T = Uint8Array>(\n connection: string | ConnectionInfo,\n body?: Uint8Array,\n processFunc?: (value: Uint8Array | null, response: FetchJsonResponse) => T,\n): Promise<T> {\n // How many times to retry in the event of a throttle\n const attemptLimit =\n typeof connection === 'object' && connection.throttleLimit != null\n ? connection.throttleLimit\n : 12;\n logger.assertArgument(\n attemptLimit > 0 && attemptLimit % 1 === 0,\n 'invalid connection throttle limit',\n 'connection.throttleLimit',\n attemptLimit,\n );\n\n const throttleCallback =\n typeof connection === 'object' ? connection.throttleCallback : null;\n const throttleSlotInterval =\n typeof connection === 'object' &&\n typeof connection.throttleSlotInterval === 'number'\n ? connection.throttleSlotInterval\n : 100;\n logger.assertArgument(\n throttleSlotInterval > 0 && throttleSlotInterval % 1 === 0,\n 'invalid connection throttle slot interval',\n 'connection.throttleSlotInterval',\n throttleSlotInterval,\n );\n\n const errorPassThrough =\n typeof connection === 'object' ? !!connection.errorPassThrough : false;\n\n const headers: { [key: string]: Header } = {};\n\n let url: string;\n\n // @TODO: Allow ConnectionInfo to override some of these values\n const options: Options = {\n method: 'GET',\n };\n\n let allow304 = false;\n\n let timeout = 2 * 60 * 1000;\n\n if (typeof connection === 'string') {\n url = connection;\n } else if (typeof connection === 'object') {\n if (connection == null || connection.url == null) {\n logger.throwArgumentError('missing URL', 'connection.url', connection);\n }\n\n url = connection.url;\n\n if (typeof connection.timeout === 'number' && connection.timeout > 0) {\n timeout = connection.timeout;\n }\n\n if (connection.headers) {\n for (const key in connection.headers) {\n headers[key.toLowerCase()] = {\n key: key,\n value: String(connection.headers[key]),\n };\n if (\n ['if-none-match', 'if-modified-since'].indexOf(key.toLowerCase()) >= 0\n ) {\n allow304 = true;\n }\n }\n }\n\n options.allowGzip = !!connection.allowGzip;\n\n if (connection.user != null && connection.password != null) {\n if (\n url.substring(0, 6) !== 'https:' &&\n connection.allowInsecureAuthentication !== true\n ) {\n logger.throwError(\n 'basic authentication requires a secure https url',\n Logger.errors.INVALID_ARGUMENT,\n {\n argument: 'url',\n url: url,\n user: connection.user,\n password: '[REDACTED]',\n },\n );\n }\n\n const authorization = connection.user + ':' + connection.password;\n headers['authorization'] = {\n key: 'Authorization',\n value: 'Basic ' + base64Encode(toUtf8Bytes(authorization)),\n };\n }\n\n if (connection.skipFetchSetup != null) {\n options.skipFetchSetup = !!connection.skipFetchSetup;\n }\n\n if (connection.fetchOptions != null) {\n options.fetchOptions = shallowCopy(connection.fetchOptions);\n }\n\n if (connection.agents != null) {\n options.agents = connection.agents;\n }\n } else {\n throw new Error('invalid connection');\n }\n\n const reData = new RegExp('^data:([^;:]*)?(;base64)?,(.*)$', 'i');\n const dataMatch = url ? url.match(reData) : null;\n if (dataMatch) {\n try {\n const response = {\n statusCode: 200,\n statusMessage: 'OK',\n headers: { 'content-type': dataMatch[1] || 'text/plain' },\n body: dataMatch[2]\n ? base64Decode(dataMatch[3])\n : unpercent(dataMatch[3]),\n };\n\n let result: T = <T>(<unknown>response.body);\n if (processFunc) {\n result = processFunc(response.body, response);\n }\n return Promise.resolve(<T>(<unknown>result));\n } catch (error) {\n logger.throwError(\n 'processing response error',\n Logger.errors.SERVER_ERROR,\n {\n body: bodyify(dataMatch[1], dataMatch[2]),\n error: error,\n requestBody: null,\n requestMethod: 'GET',\n url: url,\n },\n );\n }\n }\n\n if (body) {\n options.method = 'POST';\n options.body = body;\n if (headers['content-type'] == null) {\n headers['content-type'] = {\n key: 'Content-Type',\n value: 'application/octet-stream',\n };\n }\n if (headers['content-length'] == null) {\n headers['content-length'] = {\n key: 'Content-Length',\n value: String(body.length),\n };\n }\n }\n\n const flatHeaders: { [key: string]: string } = {};\n Object.keys(headers).forEach((key) => {\n const header = headers[key];\n flatHeaders[header.key] = header.value;\n });\n options.headers = flatHeaders;\n\n const runningTimeout = (function () {\n let timer: NodeJS.Timeout | null = null;\n const promise: Promise<never> = new Promise(function (resolve, reject) {\n if (timeout) {\n timer = setTimeout(() => {\n if (timer == null) {\n return;\n }\n timer = null;\n\n reject(\n logger.makeError('timeout', Logger.errors.TIMEOUT, {\n requestBody: bodyify(options.body, flatHeaders['content-type']),\n requestMethod: options.method,\n timeout: timeout,\n url: url,\n }),\n );\n }, timeout);\n }\n });\n\n const cancel = function () {\n if (timer == null) {\n return;\n }\n clearTimeout(timer);\n timer = null;\n };\n\n return { promise, cancel };\n })();\n\n const runningFetch = (async function () {\n for (let attempt = 0; attempt < attemptLimit; attempt++) {\n let response: GetUrlResponse | null = null;\n\n try {\n response = await getUrl(url, options);\n\n if (response.statusCode === 301 || response.statusCode === 302) {\n // Redirection; for now we only support absolute locataions\n const location = response.headers.location || '';\n if (options.method === 'GET' && location.match(/^https:/)) {\n url = response.headers.location;\n continue;\n }\n } else if (response.statusCode === 429) {\n // If it's the last attempt we throw an error with the response\n if (attempt == attemptLimit - 1) {\n const err = new Error('rate limited');\n (err as any).response = response;\n throw err;\n }\n\n // Exponential back-off throttling\n let tryAgain = true;\n if (throttleCallback) {\n tryAgain = await throttleCallback(attempt, url);\n }\n\n if (tryAgain) {\n let stall = 0;\n\n const retryAfter = response.headers['retry-after'];\n if (\n typeof retryAfter === 'string' &&\n retryAfter.match(/^[1-9][0-9]*$/)\n ) {\n stall = parseInt(retryAfter) * 1000;\n } else {\n stall =\n throttleSlotInterval *\n parseInt(String(Math.random() * Math.pow(2, attempt)));\n }\n\n //console.log(\"Stalling 429\");\n await staller(stall);\n continue;\n }\n }\n } catch (error) {\n response = (<any>error).response;\n if (response == null) runningTimeout.cancel();\n throw logger.throwError(\n 'missing response',\n Logger.errors.SERVER_ERROR,\n {\n requestBody: bodyify(options.body, flatHeaders['content-type']),\n requestMethod: options.method,\n serverError: error,\n url: url,\n },\n );\n }\n\n let body: Uint8Array | null = response.body;\n\n if (allow304 && response.statusCode === 304) {\n body = null;\n } else if (\n !errorPassThrough &&\n (response.statusCode < 200 || response.statusCode >= 300)\n ) {\n runningTimeout.cancel();\n throw logger.throwError('bad response', Logger.errors.SERVER_ERROR, {\n status: response.statusCode,\n headers: response.headers,\n body: bodyify(\n body,\n response.headers ? response.headers['content-type'] : null,\n ),\n requestBody: bodyify(options.body, flatHeaders['content-type']),\n requestMethod: options.method,\n url: url,\n });\n }\n\n if (processFunc) {\n try {\n const result = await processFunc(body, response);\n runningTimeout.cancel();\n return result;\n } catch (error: any) {\n // Allow the processFunc to trigger a throttle\n if (error.throttleRetry && attempt < attemptLimit) {\n let tryAgain = true;\n if (throttleCallback) {\n tryAgain = await throttleCallback(attempt, url);\n }\n\n if (tryAgain) {\n const timeout =\n throttleSlotInterval *\n parseInt(String(Math.random() * Math.pow(2, attempt)));\n //console.log(\"Stalling callback\");\n await staller(timeout);\n continue;\n }\n }\n\n runningTimeout.cancel();\n throw logger.throwError(\n 'processing response error',\n Logger.errors.SERVER_ERROR,\n {\n body: bodyify(\n body,\n response.headers ? response.headers['content-type'] : null,\n ),\n error: error,\n requestBody: bodyify(options.body, flatHeaders['content-type']),\n requestMethod: options.method,\n url: url,\n },\n );\n }\n }\n\n runningTimeout.cancel();\n\n // If we had a processFunc, it either returned a T or threw above.\n // The \"body\" is now a Uint8Array.\n return <T>(<unknown>body);\n }\n\n return logger.throwError('failed response', Logger.errors.SERVER_ERROR, {\n requestBody: bodyify(options.body, flatHeaders['content-type']),\n requestMethod: options.method,\n url: url,\n });\n })();\n\n return Promise.race([runningTimeout.promise, runningFetch]);\n}\n\nexport function fetchJson(\n connection: string | ConnectionInfo,\n json?: string,\n processFunc?: (value: any, response: FetchJsonResponse) => any,\n): Promise<any> {\n let processJsonFunc = (\n value: Uint8Array | null,\n response: FetchJsonResponse,\n ) => {\n let result: any = null;\n if (value != null) {\n try {\n result = JSON.parse(toUtf8String(value));\n } catch (error) {\n logger.throwError('invalid JSON', Logger.errors.SERVER_ERROR, {\n body: value,\n error: error,\n });\n }\n }\n\n if (processFunc) {\n result = processFunc(result, response);\n }\n\n return result;\n };\n\n // If we have json to send, we must\n // - add content-type of application/json (unless already overridden)\n // - convert the json to bytes\n let body: Uint8Array | undefined;\n if (json != null) {\n body = toUtf8Bytes(json);\n\n // Create a connection with the content-type set for JSON\n const updated: ConnectionInfo =\n typeof connection === 'string'\n ? { url: connection }\n : shallowCopy(connection);\n if (updated.headers) {\n const hasContentType =\n Object.keys(updated.headers).filter(\n (k) => k.toLowerCase() === 'content-type',\n ).length !== 0;\n if (!hasContentType) {\n updated.headers = shallowCopy(updated.headers);\n updated.headers['content-type'] = 'application/json';\n }\n } else {\n updated.headers = { 'content-type': 'application/json' };\n }\n connection = updated;\n }\n\n return _fetchData<any>(connection, body, processJsonFunc);\n}\n\nexport function poll<T>(\n func: () => Promise<T>,\n options?: PollOptions,\n): Promise<T> {\n if (!options) {\n options = {};\n }\n options = shallowCopy(options);\n if (options.floor == null) {\n options.floor = 0;\n }\n if (options.ceiling == null) {\n options.ceiling = 10000;\n }\n if (options.interval == null) {\n options.interval = 250;\n }\n\n return new Promise(function (resolve, reject) {\n let timer: NodeJS.Timeout | null = null;\n let done: boolean = false;\n\n // Returns true if cancel was successful. Unsuccessful cancel means we're already done.\n const cancel = (): boolean => {\n if (done) {\n return false;\n }\n done = true;\n if (timer) {\n clearTimeout(timer);\n }\n return true;\n };\n\n if (options?.timeout) {\n timer = setTimeout(() => {\n if (cancel()) {\n reject(new Error('timeout'));\n }\n }, options.timeout);\n }\n\n const retryLimit = options?.retryLimit ?? 0;\n\n let attempt = 0;\n function check() {\n return func().then(\n function (result) {\n // If we have a result, or are allowed null then we're done\n if (result !== undefined) {\n if (cancel()) {\n resolve(result);\n }\n } else if (options?.oncePoll) {\n options.oncePoll.once('poll', check);\n } else if (options?.onceBlock) {\n options.onceBlock.once('block', check);\n\n // Otherwise, exponential back-off (up to 10s) our next request\n } else if (!done) {\n attempt++;\n if (attempt > retryLimit) {\n if (cancel()) {\n reject(new Error('retry limit reached'));\n }\n return;\n }\n\n let timeout =\n options!.interval! *\n parseInt(String(Math.random() * Math.pow(2, attempt)));\n if (timeout < options!.floor!) {\n timeout = options!.floor!;\n }\n if (timeout > options!.ceiling!) {\n timeout = options!.ceiling!;\n }\n\n setTimeout(check, timeout);\n }\n\n return null;\n },\n function (error) {\n if (cancel()) {\n reject(error);\n }\n },\n );\n }\n check();\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethereum/ethers/web/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,YAAY,CAAC;;AAmHb,gCA0VC;AAED,8BAyDC;AAED,oBA4FC;AAlmBD,kDAG+B;AAC/B,gDAA4D;AAC5D,0DAAwD;AACxD,oDAAmE;AAEnE,kDAA+C;AAC/C,yCAAqC;AACrC,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,kBAAO,CAAC,CAAC;AAEnC,qCAA2D;AAE3D,SAAS,OAAO,CAAC,QAAgB;IAC/B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,OAAO,CAAC,KAAU,EAAE,IAAmB;IAC9C,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,IAAA,mBAAW,EAAC,KAAK,CAAC,EAAE,CAAC;QACvB,IACE,IAAI;YACJ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM;gBAC5B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,E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,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;gBACvC,CAAC;qBAAM,IAAI,OAAO,EAAE,SAAS,EAAE,CAAC;oBAC9B,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;oBAEvC,+DAA+D;gBACjE,CAAC;qBAAM,IAAI,CAAC,IAAI,EAAE,CAAC;oBACjB,OAAO,EAAE,CAAC;oBACV,IAAI,OAAO,GAAG,UAAU,EAAE,CAAC;wBACzB,IAAI,MAAM,EAAE,EAAE,CAAC;4BACb,MAAM,CAAC,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;wBAC3C,CAAC;wBACD,OAAO;oBACT,CAAC;oBAED,IAAI,OAAO,GACT,OAAQ,CAAC,QAAS;wBAClB,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;oBACzD,IAAI,OAAO,GAAG,OAAQ,CAAC,KAAM,EAAE,CAAC;wBAC9B,OAAO,GAAG,OAAQ,CAAC,KAAM,CAAC;oBAC5B,CAAC;oBACD,IAAI,OAAO,GAAG,OAAQ,CAAC,OAAQ,EAAE,CAAC;wBAChC,OAAO,GAAG,OAAQ,CAAC,OAAQ,CAAC;oBAC9B,CAAC;oBAED,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;gBAC7B,CAAC;gBAED,OAAO,IAAI,CAAC;YACd,CAAC,EACD,UAAU,KAAK;gBACb,IAAI,MAAM,EAAE,EAAE,CAAC;oBACb,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC;YACH,CAAC,CACF,CAAC;QACJ,CAAC;QACD,KAAK,EAAE,CAAC;IACV,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/* eslint-disable */\n'use strict';\n\nimport http from 'http';\nimport https from 'https';\nimport {\n decode as base64Decode,\n encode as base64Encode,\n} from '@ethersproject/base64';\nimport { hexlify, isBytesLike } from '@ethersproject/bytes';\nimport { shallowCopy } from '@ethersproject/properties';\nimport { toUtf8Bytes, toUtf8String } from '@ethersproject/strings';\n\nimport { Logger } from '@ethersproject/logger';\nimport { version } from './_version';\nconst logger = new Logger(version);\n\nimport { getUrl, GetUrlResponse, Options } from './geturl';\n\nfunction staller(duration: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, duration);\n });\n}\n\nfunction bodyify(value: any, type: string | null): string | null {\n if (value == null) {\n return null;\n }\n\n if (typeof value === 'string') {\n return value;\n }\n\n if (isBytesLike(value)) {\n if (\n type &&\n (type.split('/')[0] === 'text' ||\n type.split(';')[0].trim() === 'application/json')\n ) {\n try {\n return toUtf8String(value);\n } catch (error) {}\n }\n return hexlify(value);\n }\n\n return value;\n}\n\n// Exported Types\nexport type ConnectionInfo = {\n url: string;\n headers?: { [key: string]: string | number };\n\n user?: string;\n password?: string;\n\n allowInsecureAuthentication?: boolean;\n allowGzip?: boolean;\n\n throttleLimit?: number;\n throttleSlotInterval?: number;\n throttleCallback?: (attempt: number, url: string) => Promise<boolean>;\n\n skipFetchSetup?: boolean;\n fetchOptions?: Record<string, string>;\n errorPassThrough?: boolean;\n\n timeout?: number;\n\n agents?: {\n http?: http.Agent;\n https?: https.Agent;\n };\n};\n\nexport interface OnceBlockable {\n once(eventName: 'block', handler: () => void): void;\n}\n\nexport interface OncePollable {\n once(eventName: 'poll', handler: () => void): void;\n}\n\nexport type PollOptions = {\n timeout?: number;\n floor?: number;\n ceiling?: number;\n interval?: number;\n retryLimit?: number;\n onceBlock?: OnceBlockable;\n oncePoll?: OncePollable;\n};\n\nexport type FetchJsonResponse = {\n statusCode: number;\n headers: { [header: string]: string };\n};\n\ntype Header = { key: string; value: string };\n\nfunction unpercent(value: string): Uint8Array {\n return toUtf8Bytes(\n value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => {\n return String.fromCharCode(parseInt(code, 16));\n }),\n );\n}\n\n// This API is still a work in progress; the future changes will likely be:\n// - ConnectionInfo => FetchDataRequest<T = any>\n// - FetchDataRequest.body? = string | Uint8Array | { contentType: string, data: string | Uint8Array }\n// - If string => text/plain, Uint8Array => application/octet-stream (if content-type unspecified)\n// - FetchDataRequest.processFunc = (body: Uint8Array, response: FetchDataResponse) => T\n// For this reason, it should be considered internal until the API is finalized\nexport function _fetchData<T = Uint8Array>(\n connection: string | ConnectionInfo,\n body?: Uint8Array,\n processFunc?: (value: Uint8Array | null, response: FetchJsonResponse) => T,\n): Promise<T> {\n // How many times to retry in the event of a throttle\n const attemptLimit =\n typeof connection === 'object' && connection.throttleLimit != null\n ? connection.throttleLimit\n : 12;\n logger.assertArgument(\n attemptLimit > 0 && attemptLimit % 1 === 0,\n 'invalid connection throttle limit',\n 'connection.throttleLimit',\n attemptLimit,\n );\n\n const throttleCallback =\n typeof connection === 'object' ? connection.throttleCallback : null;\n const throttleSlotInterval =\n typeof connection === 'object' &&\n typeof connection.throttleSlotInterval === 'number'\n ? connection.throttleSlotInterval\n : 100;\n logger.assertArgument(\n throttleSlotInterval > 0 && throttleSlotInterval % 1 === 0,\n 'invalid connection throttle slot interval',\n 'connection.throttleSlotInterval',\n throttleSlotInterval,\n );\n\n const errorPassThrough =\n typeof connection === 'object' ? !!connection.errorPassThrough : false;\n\n const headers: { [key: string]: Header } = {};\n\n let url: string;\n\n // @TODO: Allow ConnectionInfo to override some of these values\n const options: Options = {\n method: 'GET',\n };\n\n let allow304 = false;\n\n let timeout = 2 * 60 * 1000;\n\n if (typeof connection === 'string') {\n url = connection;\n } else if (typeof connection === 'object') {\n if (connection == null || connection.url == null) {\n logger.throwArgumentError('missing URL', 'connection.url', connection);\n }\n\n url = connection.url;\n\n if (typeof connection.timeout === 'number' && connection.timeout > 0) {\n timeout = connection.timeout;\n }\n\n if (connection.headers) {\n for (const key in connection.headers) {\n headers[key.toLowerCase()] = {\n key: key,\n value: String(connection.headers[key]),\n };\n if (\n ['if-none-match', 'if-modified-since'].indexOf(key.toLowerCase()) >= 0\n ) {\n allow304 = true;\n }\n }\n }\n\n options.allowGzip = !!connection.allowGzip;\n\n if (connection.user != null && connection.password != null) {\n if (\n url.substring(0, 6) !== 'https:' &&\n connection.allowInsecureAuthentication !== true\n ) {\n logger.throwError(\n 'basic authentication requires a secure https url',\n Logger.errors.INVALID_ARGUMENT,\n {\n argument: 'url',\n url: url,\n user: connection.user,\n password: '[REDACTED]',\n },\n );\n }\n\n const authorization = connection.user + ':' + connection.password;\n headers['authorization'] = {\n key: 'Authorization',\n value: 'Basic ' + base64Encode(toUtf8Bytes(authorization)),\n };\n }\n\n if (connection.skipFetchSetup != null) {\n options.skipFetchSetup = !!connection.skipFetchSetup;\n }\n\n if (connection.fetchOptions != null) {\n options.fetchOptions = shallowCopy(connection.fetchOptions);\n }\n\n if (connection.agents != null) {\n options.agents = connection.agents;\n }\n } else {\n throw new Error('invalid connection');\n }\n\n const reData = new RegExp('^data:([^;:]*)?(;base64)?,(.*)$', 'i');\n const dataMatch = url ? url.match(reData) : null;\n if (dataMatch) {\n try {\n const response = {\n statusCode: 200,\n statusMessage: 'OK',\n headers: { 'content-type': dataMatch[1] || 'text/plain' },\n body: dataMatch[2]\n ? base64Decode(dataMatch[3])\n : unpercent(dataMatch[3]),\n };\n\n let result: T = <T>(<unknown>response.body);\n if (processFunc) {\n result = processFunc(response.body, response);\n }\n return Promise.resolve(<T>(<unknown>result));\n } catch (error) {\n logger.throwError(\n 'processing response error',\n Logger.errors.SERVER_ERROR,\n {\n body: bodyify(dataMatch[1], dataMatch[2]),\n error: error,\n requestBody: null,\n requestMethod: 'GET',\n url: url,\n },\n );\n }\n }\n\n if (body) {\n options.method = 'POST';\n options.body = body;\n if (headers['content-type'] == null) {\n headers['content-type'] = {\n key: 'Content-Type',\n value: 'application/octet-stream',\n };\n }\n if (headers['content-length'] == null) {\n headers['content-length'] = {\n key: 'Content-Length',\n value: String(body.length),\n };\n }\n }\n\n const flatHeaders: { [key: string]: string } = {};\n Object.keys(headers).forEach((key) => {\n const header = headers[key];\n flatHeaders[header.key] = header.value;\n });\n options.headers = flatHeaders;\n\n const runningTimeout = (function () {\n let timer: NodeJS.Timeout | null = null;\n const promise: Promise<never> = new Promise(function (resolve, reject) {\n if (timeout) {\n timer = setTimeout(() => {\n if (timer == null) {\n return;\n }\n timer = null;\n\n reject(\n logger.makeError('timeout', Logger.errors.TIMEOUT, {\n requestBody: bodyify(options.body, flatHeaders['content-type']),\n requestMethod: options.method,\n timeout: timeout,\n url: url,\n }),\n );\n }, timeout);\n }\n });\n\n const cancel = function () {\n if (timer == null) {\n return;\n }\n clearTimeout(timer);\n timer = null;\n };\n\n return { promise, cancel };\n })();\n\n const runningFetch = (async function () {\n for (let attempt = 0; attempt < attemptLimit; attempt++) {\n let response: GetUrlResponse | null = null;\n\n try {\n response = await getUrl(url, options);\n\n if (response.statusCode === 301 || response.statusCode === 302) {\n // Redirection; for now we only support absolute locataions\n const location = response.headers.location || '';\n if (options.method === 'GET' && location.match(/^https:/)) {\n url = response.headers.location;\n continue;\n }\n } else if (response.statusCode === 429) {\n // If it's the last attempt we throw an error with the response\n if (attempt == attemptLimit - 1) {\n const err = new Error('rate limited');\n (err as any).response = response;\n throw err;\n }\n\n // Exponential back-off throttling\n let tryAgain = true;\n if (throttleCallback) {\n tryAgain = await throttleCallback(attempt, url);\n }\n\n if (tryAgain) {\n let stall = 0;\n\n const retryAfter = response.headers['retry-after'];\n if (\n typeof retryAfter === 'string' &&\n retryAfter.match(/^[1-9][0-9]*$/)\n ) {\n stall = parseInt(retryAfter) * 1000;\n } else {\n stall =\n throttleSlotInterval *\n parseInt(String(Math.random() * Math.pow(2, attempt)));\n }\n\n //console.log(\"Stalling 429\");\n await staller(stall);\n continue;\n }\n }\n } catch (error) {\n response = (<any>error).response;\n if (response == null) runningTimeout.cancel();\n throw logger.throwError(\n 'missing response',\n Logger.errors.SERVER_ERROR,\n {\n requestBody: bodyify(options.body, flatHeaders['content-type']),\n requestMethod: options.method,\n serverError: error,\n url: url,\n },\n );\n }\n\n let body: Uint8Array | null = response.body;\n\n if (allow304 && response.statusCode === 304) {\n body = null;\n } else if (\n !errorPassThrough &&\n (response.statusCode < 200 || response.statusCode >= 300)\n ) {\n runningTimeout.cancel();\n throw logger.throwError('bad response', Logger.errors.SERVER_ERROR, {\n status: response.statusCode,\n headers: response.headers,\n body: bodyify(\n body,\n response.headers ? response.headers['content-type'] : null,\n ),\n requestBody: bodyify(options.body, flatHeaders['content-type']),\n requestMethod: options.method,\n url: url,\n });\n }\n\n if (processFunc) {\n try {\n const result = await processFunc(body, response);\n runningTimeout.cancel();\n return result;\n } catch (error: any) {\n // Allow the processFunc to trigger a throttle\n if (error.throttleRetry && attempt < attemptLimit) {\n let tryAgain = true;\n if (throttleCallback) {\n tryAgain = await throttleCallback(attempt, url);\n }\n\n if (tryAgain) {\n const timeout =\n throttleSlotInterval *\n parseInt(String(Math.random() * Math.pow(2, attempt)));\n //console.log(\"Stalling callback\");\n await staller(timeout);\n continue;\n }\n }\n\n runningTimeout.cancel();\n throw logger.throwError(\n 'processing response error',\n Logger.errors.SERVER_ERROR,\n {\n body: bodyify(\n body,\n response.headers ? response.headers['content-type'] : null,\n ),\n error: error,\n requestBody: bodyify(options.body, flatHeaders['content-type']),\n requestMethod: options.method,\n url: url,\n },\n );\n }\n }\n\n runningTimeout.cancel();\n\n // If we had a processFunc, it either returned a T or threw above.\n // The \"body\" is now a Uint8Array.\n return <T>(<unknown>body);\n }\n\n return logger.throwError('failed response', Logger.errors.SERVER_ERROR, {\n requestBody: bodyify(options.body, flatHeaders['content-type']),\n requestMethod: options.method,\n url: url,\n });\n })();\n\n return Promise.race([runningTimeout.promise, runningFetch]);\n}\n\nexport function fetchJson(\n connection: string | ConnectionInfo,\n json?: string,\n processFunc?: (value: any, response: FetchJsonResponse) => any,\n): Promise<any> {\n let processJsonFunc = (\n value: Uint8Array | null,\n response: FetchJsonResponse,\n ) => {\n let result: any = null;\n if (value != null) {\n try {\n // This is modified from the ethers source, the previous code caused a massive memory leak with logs for this block https://sonicscan.org/block/20222346\n result = JSON.parse(new TextDecoder('utf8').decode(value));\n } catch (error) {\n logger.throwError('invalid JSON', Logger.errors.SERVER_ERROR, {\n body: value,\n error: error,\n });\n }\n }\n\n if (processFunc) {\n result = processFunc(result, response);\n }\n\n return result;\n };\n\n // If we have json to send, we must\n // - add content-type of application/json (unless already overridden)\n // - convert the json to bytes\n let body: Uint8Array | undefined;\n if (json != null) {\n body = toUtf8Bytes(json);\n\n // Create a connection with the content-type set for JSON\n const updated: ConnectionInfo =\n typeof connection === 'string'\n ? { url: connection }\n : shallowCopy(connection);\n if (updated.headers) {\n const hasContentType =\n Object.keys(updated.headers).filter(\n (k) => k.toLowerCase() === 'content-type',\n ).length !== 0;\n if (!hasContentType) {\n updated.headers = shallowCopy(updated.headers);\n updated.headers['content-type'] = 'application/json';\n }\n } else {\n updated.headers = { 'content-type': 'application/json' };\n }\n connection = updated;\n }\n\n return _fetchData<any>(connection, body, processJsonFunc);\n}\n\nexport function poll<T>(\n func: () => Promise<T>,\n options?: PollOptions,\n): Promise<T> {\n if (!options) {\n options = {};\n }\n options = shallowCopy(options);\n if (options.floor == null) {\n options.floor = 0;\n }\n if (options.ceiling == null) {\n options.ceiling = 10000;\n }\n if (options.interval == null) {\n options.interval = 250;\n }\n\n return new Promise(function (resolve, reject) {\n let timer: NodeJS.Timeout | null = null;\n let done: boolean = false;\n\n // Returns true if cancel was successful. Unsuccessful cancel means we're already done.\n const cancel = (): boolean => {\n if (done) {\n return false;\n }\n done = true;\n if (timer) {\n clearTimeout(timer);\n }\n return true;\n };\n\n if (options?.timeout) {\n timer = setTimeout(() => {\n if (cancel()) {\n reject(new Error('timeout'));\n }\n }, options.timeout);\n }\n\n const retryLimit = options?.retryLimit ?? 0;\n\n let attempt = 0;\n function check() {\n return func().then(\n function (result) {\n // If we have a result, or are allowed null then we're done\n if (result !== undefined) {\n if (cancel()) {\n resolve(result);\n }\n } else if (options?.oncePoll) {\n options.oncePoll.once('poll', check);\n } else if (options?.onceBlock) {\n options.onceBlock.once('block', check);\n\n // Otherwise, exponential back-off (up to 10s) our next request\n } else if (!done) {\n attempt++;\n if (attempt > retryLimit) {\n if (cancel()) {\n reject(new Error('retry limit reached'));\n }\n return;\n }\n\n let timeout =\n options!.interval! *\n parseInt(String(Math.random() * Math.pow(2, attempt)));\n if (timeout < options!.floor!) {\n timeout = options!.floor!;\n }\n if (timeout > options!.ceiling!) {\n timeout = options!.ceiling!;\n }\n\n setTimeout(check, timeout);\n }\n\n return null;\n },\n function (error) {\n if (cancel()) {\n reject(error);\n }\n },\n );\n }\n check();\n });\n}\n"]}
|
|
@@ -43,11 +43,10 @@ exports.FetchModule = FetchModule = __decorate([
|
|
|
43
43
|
useClass: blockchain_service_1.BlockchainService,
|
|
44
44
|
},
|
|
45
45
|
indexer_manager_1.IndexerManager,
|
|
46
|
+
node_core_1.MultiChainRewindService,
|
|
46
47
|
{
|
|
47
48
|
provide: 'IBlockDispatcher',
|
|
48
|
-
useFactory: (
|
|
49
|
-
? new node_core_1.WorkerBlockDispatcher(nodeConfig, eventEmitter, projectService, projectUpgradeService, storeService, storeModelProvider, cacheService, poiSyncService, dynamicDsService, unfinalizedBlocks, connectionPoolState, project, blockchainService, node_path_1.default.resolve(__dirname, '../../dist/indexer/worker/worker.js'), [], monitorService)
|
|
50
|
-
: new node_core_1.BlockDispatcher(nodeConfig, eventEmitter, projectService, projectUpgradeService, storeService, storeModelProvider, poiSyncService, project, blockchainService, indexerManager),
|
|
49
|
+
useFactory: (0, node_core_1.blockDispatcherFactory)(node_path_1.default.resolve(__dirname, '../../dist/indexer/worker/worker.js'), []),
|
|
51
50
|
inject: [
|
|
52
51
|
node_core_1.NodeConfig,
|
|
53
52
|
event_emitter_1.EventEmitter2,
|
|
@@ -63,6 +62,7 @@ exports.FetchModule = FetchModule = __decorate([
|
|
|
63
62
|
node_core_1.ConnectionPoolStateManager,
|
|
64
63
|
'IBlockchainService',
|
|
65
64
|
indexer_manager_1.IndexerManager,
|
|
65
|
+
node_core_1.MultiChainRewindService,
|
|
66
66
|
node_core_1.MonitorService,
|
|
67
67
|
],
|
|
68
68
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.module.js","sourceRoot":"","sources":["../../src/indexer/fetch.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;AAEnC,0DAA6B;AAC7B,2CAAwC;AACxC,yDAAsD;
|
|
1
|
+
{"version":3,"file":"fetch.module.js","sourceRoot":"","sources":["../../src/indexer/fetch.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;AAEnC,0DAA6B;AAC7B,2CAAwC;AACxC,yDAAsD;AACtD,gDAgB0B;AAC1B,8DAA0D;AAC1D,2EAAsE;AACtE,8EAA0E;AAC1E,uDAAmD;AACnD,2EAAuE;AA+DhE,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,kCAAW;sBAAX,WAAW;IA7DvB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,sBAAU,CAAC;QACrB,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,YAAY;gBACrB,UAAU,EAAE,yCAAkB,CAAC,IAAI;gBACnC,MAAM,EAAE;oBACN,kBAAkB;oBAClB,iCAAqB;oBACrB,6BAAa;oBACb,sBAAU;iBACX;aACF;YACD;gBACE,OAAO,EAAE,oBAAoB;gBAC7B,QAAQ,EAAE,sCAAiB;aAC5B;YACD,gCAAc;YACd,mCAAuB;YACvB;gBACE,OAAO,EAAE,kBAAkB;gBAC3B,UAAU,EAAE,IAAA,kCAAsB,EAChC,mBAAI,CAAC,OAAO,CAAC,SAAS,EAAE,qCAAqC,CAAC,EAC9D,EAAE,CACH;gBACD,MAAM,EAAE;oBACN,sBAAU;oBACV,6BAAa;oBACb,iBAAiB;oBACjB,wBAAwB;oBACxB,gCAAoB;oBACpB,wBAAY;oBACZ,qBAAqB;oBACrB,0BAAc;oBACd,kBAAkB;oBAClB,4BAAgB;oBAChB,2BAA2B;oBAC3B,sCAA0B;oBAC1B,oBAAoB;oBACpB,gCAAc;oBACd,mCAAuB;oBACvB,0BAAc;iBACf;aACF;YACD,wBAAY;YACZ;gBACE,OAAO,EAAE,6BAAiB;gBAC1B,QAAQ,EAAE,4CAAoB;aAC/B;YACD,8BAAkB;YAClB,4BAAgB;YAChB;gBACE,QAAQ,EAAE,0BAAc;gBACxB,OAAO,EAAE,iBAAiB;aAC3B;YACD;gBACE,OAAO,EAAE,2BAA2B;gBACpC,QAAQ,EAAE,oDAAwB;aACnC;SACF;KACF,CAAC;GACW,WAAW,CAAG","sourcesContent":["// Copyright 2020-2025 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport path from 'node:path';\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n StoreService,\n NodeConfig,\n ConnectionPoolService,\n ConnectionPoolStateManager,\n PoiSyncService,\n InMemoryCacheService,\n MonitorService,\n CoreModule,\n ProjectService,\n DynamicDsService,\n DsProcessorService,\n FetchService,\n DictionaryService,\n MultiChainRewindService,\n blockDispatcherFactory,\n} from '@subql/node-core';\nimport { BlockchainService } from '../blockchain.service';\nimport { EthereumApiService } from '../ethereum/api.service.ethereum';\nimport { EthDictionaryService } from './dictionary/ethDictionary.service';\nimport { IndexerManager } from './indexer.manager';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\n\n@Module({\n imports: [CoreModule],\n providers: [\n {\n provide: 'APIService',\n useFactory: EthereumApiService.init,\n inject: [\n 'ISubqueryProject',\n ConnectionPoolService,\n EventEmitter2,\n NodeConfig,\n ],\n },\n {\n provide: 'IBlockchainService',\n useClass: BlockchainService,\n },\n IndexerManager,\n MultiChainRewindService,\n {\n provide: 'IBlockDispatcher',\n useFactory: blockDispatcherFactory(\n path.resolve(__dirname, '../../dist/indexer/worker/worker.js'),\n [],\n ),\n inject: [\n NodeConfig,\n EventEmitter2,\n 'IProjectService',\n 'IProjectUpgradeService',\n InMemoryCacheService,\n StoreService,\n 'IStoreModelProvider',\n PoiSyncService,\n 'ISubqueryProject',\n DynamicDsService,\n 'IUnfinalizedBlocksService',\n ConnectionPoolStateManager,\n 'IBlockchainService',\n IndexerManager,\n MultiChainRewindService,\n MonitorService,\n ],\n },\n FetchService,\n {\n provide: DictionaryService,\n useClass: EthDictionaryService,\n },\n DsProcessorService,\n DynamicDsService,\n {\n useClass: ProjectService,\n provide: 'IProjectService',\n },\n {\n provide: 'IUnfinalizedBlocksService',\n useClass: UnfinalizedBlocksService,\n },\n ],\n})\nexport class FetchModule {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reindex.module.js","sourceRoot":"","sources":["../../src/subcommands/reindex.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,yDAA0E;AAC1E,+CAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"reindex.module.js","sourceRoot":"","sources":["../../src/subcommands/reindex.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,yDAA0E;AAC1E,+CAAqD;AACrD,gDAa0B;AAC1B,oDAA+C;AAC/C,8DAA0D;AAC1D,oEAAgE;AAChE,0CAAiD;AACjD,oFAAgF;AA2CzE,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAAG,CAAA;AAAvB,oDAAoB;+BAApB,oBAAoB;IAzChC,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,qBAAqB;gBAC9B,UAAU,EAAE,6BAAiB;gBAC7B,MAAM,EAAE,CAAC,sBAAU,EAAE,6BAAa,EAAE,uBAAS,CAAC;aAC/C;YACD,wBAAY;YACZ,0BAAc;YACd,sBAAU;YACV,6BAAiB;YACjB;gBACE,OAAO,EAAE,0BAA0B;gBACnC,QAAQ,EAAE,oDAAwB;aACnC;YACD;gBACE,OAAO,EAAE,kBAAkB;gBAC3B,QAAQ,EAAE,4BAAgB;aAC3B;YACD,8BAAkB;YAClB,sCAA0B;YAC1B,iCAAqB;YACrB;gBACE,OAAO,EAAE,YAAY;gBACrB,UAAU,EAAE,6BAAkB,CAAC,IAAI;gBACnC,MAAM,EAAE;oBACN,kBAAkB;oBAClB,iCAAqB;oBACrB,6BAAa;oBACb,sBAAU;iBACX;aACF;YACD;gBACE,OAAO,EAAE,oBAAoB;gBAC7B,QAAQ,EAAE,sCAAiB;aAC5B;YACD,4BAAiB;YACjB,mCAAuB;SACxB;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,oBAAoB,CAAG;AAW7B,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IATzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,oBAAQ,CAAC,OAAO,EAAE;YAClB,kCAAe,CAAC,QAAQ,EAAE;YAC1B,oBAAoB;YACpB,kCAAkB,CAAC,OAAO,EAAE;SAC7B;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,aAAa,CAAG","sourcesContent":["// Copyright 2020-2025 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2, EventEmitterModule } from '@nestjs/event-emitter';\nimport { SchedulerRegistry } from '@nestjs/schedule';\nimport {\n DbModule,\n ForceCleanService,\n StoreService,\n ReindexService,\n PoiService,\n NodeConfig,\n storeModelFactory,\n ConnectionPoolService,\n ConnectionPoolStateManager,\n DynamicDsService,\n DsProcessorService,\n MultiChainRewindService,\n} from '@subql/node-core';\nimport { Sequelize } from '@subql/x-sequelize';\nimport { BlockchainService } from '../blockchain.service';\nimport { ConfigureModule } from '../configure/configure.module';\nimport { EthereumApiService } from '../ethereum';\nimport { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service';\n\n@Module({\n providers: [\n {\n provide: 'IStoreModelProvider',\n useFactory: storeModelFactory,\n inject: [NodeConfig, EventEmitter2, Sequelize],\n },\n StoreService,\n ReindexService,\n PoiService,\n ForceCleanService,\n {\n provide: 'UnfinalizedBlocksService',\n useClass: UnfinalizedBlocksService,\n },\n {\n provide: 'DynamicDsService',\n useClass: DynamicDsService,\n },\n DsProcessorService,\n ConnectionPoolStateManager,\n ConnectionPoolService,\n {\n provide: 'APIService',\n useFactory: EthereumApiService.init,\n inject: [\n 'ISubqueryProject',\n ConnectionPoolService,\n EventEmitter2,\n NodeConfig,\n ],\n },\n {\n provide: 'IBlockchainService',\n useClass: BlockchainService,\n },\n SchedulerRegistry,\n MultiChainRewindService,\n ],\n controllers: [],\n})\nexport class ReindexFeatureModule {}\n\n@Module({\n imports: [\n DbModule.forRoot(),\n ConfigureModule.register(),\n ReindexFeatureModule,\n EventEmitterModule.forRoot(),\n ],\n controllers: [],\n})\nexport class ReindexModule {}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subql/node-ethereum",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1-0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Ian He",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"subql-node-ethereum": "./bin/run"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@nestjs/common": "^11.0.
|
|
23
|
-
"@nestjs/core": "^11.0.
|
|
24
|
-
"@nestjs/event-emitter": "^
|
|
25
|
-
"@nestjs/platform-express": "^11.0.
|
|
22
|
+
"@nestjs/common": "^11.0.16",
|
|
23
|
+
"@nestjs/core": "^11.0.7",
|
|
24
|
+
"@nestjs/event-emitter": "^3.0.0",
|
|
25
|
+
"@nestjs/platform-express": "^11.0.7",
|
|
26
26
|
"@nestjs/schedule": "^5.0.1",
|
|
27
|
-
"@subql/common": "^5.
|
|
28
|
-
"@subql/common-ethereum": "4.
|
|
29
|
-
"@subql/node-core": "^
|
|
27
|
+
"@subql/common": "^5.5.0",
|
|
28
|
+
"@subql/common-ethereum": "4.8.0",
|
|
29
|
+
"@subql/node-core": "^18.0.3",
|
|
30
30
|
"@subql/testing": "^2.2.1",
|
|
31
31
|
"@subql/types-ethereum": "4.1.0",
|
|
32
32
|
"cacheable-lookup": "6",
|
|
@@ -59,5 +59,6 @@
|
|
|
59
59
|
"files": [
|
|
60
60
|
"/dist",
|
|
61
61
|
"/bin"
|
|
62
|
-
]
|
|
62
|
+
],
|
|
63
|
+
"stableVersion": "6.0.0"
|
|
63
64
|
}
|