Skip to content

Commit

Permalink
Patch gen tools for no archive url
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-snx committed Nov 6, 2024
1 parent fe8a67c commit 2eeaa5d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion indexers-v2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def load_network_config(path):
message = f"Network '{network_name}' not found in {path}/network_config.yaml"
raise Exception(message)
network_id = network_params["network_id"]
archive_url = network_params["archive_url"]
archive_url = network_params.get("archive_url", "None")

# Load custom config
custom_config = config_file["configs"][config_name]
Expand Down
45 changes: 45 additions & 0 deletions indexers-v2/patches/@subsquid+squid-gen-evm+1.2.1.patch
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ index 2839b6f..e751702 100644
this.out.block(`for (let log of block.logs)`, () => {
for (let contract of this.options.contracts) {
this.out.block(`if (log.address === '${contract.address}')`, () => {
diff --git a/node_modules/@subsquid/squid-gen-evm/lib/interfaces.d.ts b/node_modules/@subsquid/squid-gen-evm/lib/interfaces.d.ts
index 0d82fa8..cb0e924 100644
--- a/node_modules/@subsquid/squid-gen-evm/lib/interfaces.d.ts
+++ b/node_modules/@subsquid/squid-gen-evm/lib/interfaces.d.ts
@@ -22,7 +22,7 @@ export interface SquidContract {
}
export interface SquidArchive {
value: string;
- kind: 'url' | 'name';
+ kind: 'url' | 'name' | 'None';
}
export type SquidChainRpc = string | {
url: string;
diff --git a/node_modules/@subsquid/squid-gen-evm/lib/mappings.js b/node_modules/@subsquid/squid-gen-evm/lib/mappings.js
index f427ab2..4ad7c89 100644
--- a/node_modules/@subsquid/squid-gen-evm/lib/mappings.js
Expand All @@ -39,3 +52,35 @@ index f427ab2..4ad7c89 100644
else {
return `e[${i}]`;
}
diff --git a/node_modules/@subsquid/squid-gen-evm/lib/processor.js b/node_modules/@subsquid/squid-gen-evm/lib/processor.js
index 6b2ba62..52c2902 100644
--- a/node_modules/@subsquid/squid-gen-evm/lib/processor.js
+++ b/node_modules/@subsquid/squid-gen-evm/lib/processor.js
@@ -21,7 +21,10 @@ class ProcessorCodegen {
this.out.indentation(() => {
this.out.line(`.setDataSource({`);
this.out.indentation(() => {
- if (this.options.archive.kind === 'name') {
+ if (this.options.archive.kind === 'None') {
+ // do nothing
+ }
+ else if (this.options.archive.kind === 'name') {
this.useArchiveRegistry();
this.out.line(`archive: lookupArchive('${this.options.archive.value}', {type: 'EVM'}),`);
}
diff --git a/node_modules/@subsquid/squid-gen-evm/lib/util.js b/node_modules/@subsquid/squid-gen-evm/lib/util.js
index 48689cf..e9da291 100644
--- a/node_modules/@subsquid/squid-gen-evm/lib/util.js
+++ b/node_modules/@subsquid/squid-gen-evm/lib/util.js
@@ -47,7 +47,10 @@ function getArchive(str) {
};
}
else {
- throw new Error(`Invalid archive "${str}"`);
+ return {
+ value: 'None',
+ kind: 'None',
+ };
}
}
exports.getArchive = getArchive;

0 comments on commit 2eeaa5d

Please sign in to comment.