diff --git a/common/changes/@subsquid/substrate-processor/master_2024-01-01-10-47.json b/common/changes/@subsquid/substrate-processor/master_2024-01-01-10-47.json new file mode 100644 index 000000000..32933c784 --- /dev/null +++ b/common/changes/@subsquid/substrate-processor/master_2024-01-01-10-47.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@subsquid/substrate-processor", + "comment": "fix archive error when limiting item request by block range", + "type": "patch" + } + ], + "packageName": "@subsquid/substrate-processor" +} \ No newline at end of file diff --git a/substrate/substrate-processor/src/processor.ts b/substrate/substrate-processor/src/processor.ts index 36601fbe4..672be01ee 100644 --- a/substrate/substrate-processor/src/processor.ts +++ b/substrate/substrate-processor/src/processor.ts @@ -311,49 +311,56 @@ export class SubstrateBatchProcessor { addEvent(options: EventRequest & BlockRange): this { this.assertNotRunning() - this.add({events: [options]}, options.range) + let {range, ...req} = options + this.add({events: [req]}, range) return this } addCall(options: CallRequest & BlockRange): this { this.assertNotRunning() - this.add({calls: [options]}, options.range) + let {range, ...req} = options + this.add({calls: [req]}, range) return this } addEvmLog(options: EvmLogRequest & BlockRange): this { this.assertNotRunning() + let {range, address, ...req} = options this.add({evmLogs: [{ - ...options, - address: options.address?.map(s => s.toLowerCase()) - }]}, options.range) + ...req, + address: address?.map(s => s.toLowerCase()) + }]}, range) return this } addEthereumTransaction(options: EthereumTransactRequest & BlockRange): this { this.assertNotRunning() + let {range, to, ...req} = options this.add({ethereumTransactions: [{ - ...options, - to: options.to?.map(s => s.toLowerCase()) - }]}, options.range) + ...req, + to: to?.map(s => s.toLowerCase()) + }]}, range) return this } addContractsContractEmitted(options: ContractsContractEmittedRequest & BlockRange): this { this.assertNotRunning() - this.add({contractsEvents: [options]}, options.range) + let {range, ...req} = options + this.add({contractsEvents: [req]}, range) return this } addGearMessageQueued(options: GearMessageQueuedRequest & BlockRange): this { this.assertNotRunning() - this.add({gearMessagesQueued: [options]}, options.range) + let {range, ...req} = options + this.add({gearMessagesQueued: [req]}, range) return this } addGearUserMessageSent(options: GearUserMessageSentRequest & BlockRange): this { this.assertNotRunning() - this.add({gearUserMessagesSent: [options]}, options.range) + let {range, ...req} = options + this.add({gearUserMessagesSent: [req]}, range) return this }