From 8cc20ded52a67c8e53efa4b4bb7cdf7d21e2f5e7 Mon Sep 17 00:00:00 2001 From: Tornado Contrib Date: Tue, 30 Apr 2024 06:56:08 +0000 Subject: [PATCH] Use relayerEnsSubdomain Idea by @Theo --- dist/index.js | 22 +++++++++++----------- dist/index.mjs | 22 +++++++++++----------- dist/index.umd.js | 22 +++++++++++----------- dist/networkConfig.d.ts | 2 +- src/networkConfig.ts | 20 ++++++++++---------- src/relayerClient.ts | 4 ++-- 6 files changed, 46 insertions(+), 46 deletions(-) diff --git a/dist/index.js b/dist/index.js index 809b43b..67c8946 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5976,7 +5976,7 @@ const defaultConfig = { gasLimit: 7e5 } }, - ensSubdomainKey: "mainnet-tornado", + relayerEnsSubdomain: "mainnet-tornado", pollInterval: 15, constants: { GOVERNANCE_BLOCK: 11474695, @@ -6044,7 +6044,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "bsc-tornado", + relayerEnsSubdomain: "bsc-tornado", pollInterval: 10, constants: { NOTE_ACCOUNT_BLOCK: 8159269, @@ -6102,7 +6102,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "polygon-tornado", + relayerEnsSubdomain: "polygon-tornado", pollInterval: 10, constants: { NOTE_ACCOUNT_BLOCK: 16257996, @@ -6168,7 +6168,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "optimism-tornado", + relayerEnsSubdomain: "optimism-tornado", pollInterval: 15, constants: { NOTE_ACCOUNT_BLOCK: 2243694, @@ -6233,7 +6233,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "arbitrum-tornado", + relayerEnsSubdomain: "arbitrum-tornado", pollInterval: 15, constants: { NOTE_ACCOUNT_BLOCK: 3430605, @@ -6298,7 +6298,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "gnosis-tornado", + relayerEnsSubdomain: "gnosis-tornado", pollInterval: 15, constants: { NOTE_ACCOUNT_BLOCK: 17754564, @@ -6353,7 +6353,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "avalanche-tornado", + relayerEnsSubdomain: "avalanche-tornado", pollInterval: 10, constants: { NOTE_ACCOUNT_BLOCK: 4429813, @@ -6427,7 +6427,7 @@ const defaultConfig = { gasLimit: 7e5 } }, - ensSubdomainKey: "sepolia-tornado", + relayerEnsSubdomain: "sepolia-tornado", pollInterval: 15, constants: { GOVERNANCE_BLOCK: 5594395, @@ -6476,7 +6476,7 @@ function getInstanceByAddress({ netId, address }) { } function getSubdomains() { const allConfig = getNetworkConfig(); - return enabledChains.map((chain) => allConfig[chain].ensSubdomainKey); + return enabledChains.map((chain) => allConfig[chain].relayerEnsSubdomain); } const addressType = { type: "string", pattern: "^0x[a-fA-F0-9]{40}$" }; @@ -7485,8 +7485,8 @@ class RelayerClient { filterRelayer(curr, relayer, subdomains, debugRelayer = false) { return __async$3(this, null, function* () { var _a; - const { ensSubdomainKey } = this.config; - const subdomainIndex = subdomains.indexOf(ensSubdomainKey); + const { relayerEnsSubdomain } = this.config; + const subdomainIndex = subdomains.indexOf(relayerEnsSubdomain); const mainnetSubdomain = curr.records[0]; const hostname = curr.records[subdomainIndex]; const isHostWithProtocol = hostname.includes("http"); diff --git a/dist/index.mjs b/dist/index.mjs index 436419f..956c70a 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -5955,7 +5955,7 @@ const defaultConfig = { gasLimit: 7e5 } }, - ensSubdomainKey: "mainnet-tornado", + relayerEnsSubdomain: "mainnet-tornado", pollInterval: 15, constants: { GOVERNANCE_BLOCK: 11474695, @@ -6023,7 +6023,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "bsc-tornado", + relayerEnsSubdomain: "bsc-tornado", pollInterval: 10, constants: { NOTE_ACCOUNT_BLOCK: 8159269, @@ -6081,7 +6081,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "polygon-tornado", + relayerEnsSubdomain: "polygon-tornado", pollInterval: 10, constants: { NOTE_ACCOUNT_BLOCK: 16257996, @@ -6147,7 +6147,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "optimism-tornado", + relayerEnsSubdomain: "optimism-tornado", pollInterval: 15, constants: { NOTE_ACCOUNT_BLOCK: 2243694, @@ -6212,7 +6212,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "arbitrum-tornado", + relayerEnsSubdomain: "arbitrum-tornado", pollInterval: 15, constants: { NOTE_ACCOUNT_BLOCK: 3430605, @@ -6277,7 +6277,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "gnosis-tornado", + relayerEnsSubdomain: "gnosis-tornado", pollInterval: 15, constants: { NOTE_ACCOUNT_BLOCK: 17754564, @@ -6332,7 +6332,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "avalanche-tornado", + relayerEnsSubdomain: "avalanche-tornado", pollInterval: 10, constants: { NOTE_ACCOUNT_BLOCK: 4429813, @@ -6406,7 +6406,7 @@ const defaultConfig = { gasLimit: 7e5 } }, - ensSubdomainKey: "sepolia-tornado", + relayerEnsSubdomain: "sepolia-tornado", pollInterval: 15, constants: { GOVERNANCE_BLOCK: 5594395, @@ -6455,7 +6455,7 @@ function getInstanceByAddress({ netId, address }) { } function getSubdomains() { const allConfig = getNetworkConfig(); - return enabledChains.map((chain) => allConfig[chain].ensSubdomainKey); + return enabledChains.map((chain) => allConfig[chain].relayerEnsSubdomain); } const addressType = { type: "string", pattern: "^0x[a-fA-F0-9]{40}$" }; @@ -7464,8 +7464,8 @@ class RelayerClient { filterRelayer(curr, relayer, subdomains, debugRelayer = false) { return __async$3(this, null, function* () { var _a; - const { ensSubdomainKey } = this.config; - const subdomainIndex = subdomains.indexOf(ensSubdomainKey); + const { relayerEnsSubdomain } = this.config; + const subdomainIndex = subdomains.indexOf(relayerEnsSubdomain); const mainnetSubdomain = curr.records[0]; const hostname = curr.records[subdomainIndex]; const isHostWithProtocol = hostname.includes("http"); diff --git a/dist/index.umd.js b/dist/index.umd.js index 037735a..5563d32 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -66859,7 +66859,7 @@ const defaultConfig = { gasLimit: 7e5 } }, - ensSubdomainKey: "mainnet-tornado", + relayerEnsSubdomain: "mainnet-tornado", pollInterval: 15, constants: { GOVERNANCE_BLOCK: 11474695, @@ -66927,7 +66927,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "bsc-tornado", + relayerEnsSubdomain: "bsc-tornado", pollInterval: 10, constants: { NOTE_ACCOUNT_BLOCK: 8159269, @@ -66985,7 +66985,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "polygon-tornado", + relayerEnsSubdomain: "polygon-tornado", pollInterval: 10, constants: { NOTE_ACCOUNT_BLOCK: 16257996, @@ -67051,7 +67051,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "optimism-tornado", + relayerEnsSubdomain: "optimism-tornado", pollInterval: 15, constants: { NOTE_ACCOUNT_BLOCK: 2243694, @@ -67116,7 +67116,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "arbitrum-tornado", + relayerEnsSubdomain: "arbitrum-tornado", pollInterval: 15, constants: { NOTE_ACCOUNT_BLOCK: 3430605, @@ -67181,7 +67181,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "gnosis-tornado", + relayerEnsSubdomain: "gnosis-tornado", pollInterval: 15, constants: { NOTE_ACCOUNT_BLOCK: 17754564, @@ -67236,7 +67236,7 @@ const defaultConfig = { decimals: 18 } }, - ensSubdomainKey: "avalanche-tornado", + relayerEnsSubdomain: "avalanche-tornado", pollInterval: 10, constants: { NOTE_ACCOUNT_BLOCK: 4429813, @@ -67310,7 +67310,7 @@ const defaultConfig = { gasLimit: 7e5 } }, - ensSubdomainKey: "sepolia-tornado", + relayerEnsSubdomain: "sepolia-tornado", pollInterval: 15, constants: { GOVERNANCE_BLOCK: 5594395, @@ -67359,7 +67359,7 @@ function getInstanceByAddress({ netId, address }) { } function getSubdomains() { const allConfig = getNetworkConfig(); - return enabledChains.map((chain) => allConfig[chain].ensSubdomainKey); + return enabledChains.map((chain) => allConfig[chain].relayerEnsSubdomain); } @@ -76814,8 +76814,8 @@ class RelayerClient { filterRelayer(curr, relayer, subdomains, debugRelayer = false) { return __async(this, null, function* () { var _a; - const { ensSubdomainKey } = this.config; - const subdomainIndex = subdomains.indexOf(ensSubdomainKey); + const { relayerEnsSubdomain } = this.config; + const subdomainIndex = subdomains.indexOf(relayerEnsSubdomain); const mainnetSubdomain = curr.records[0]; const hostname = curr.records[subdomainIndex]; const isHostWithProtocol = hostname.includes("http"); diff --git a/dist/networkConfig.d.ts b/dist/networkConfig.d.ts index 1789ac2..51b4503 100644 --- a/dist/networkConfig.d.ts +++ b/dist/networkConfig.d.ts @@ -76,7 +76,7 @@ export type Config = { subgraphs: SubgraphUrls; tokens: TokenInstances; optionalTokens?: string[]; - ensSubdomainKey: string; + relayerEnsSubdomain: string; pollInterval: number; constants: { GOVERNANCE_BLOCK?: number; diff --git a/src/networkConfig.ts b/src/networkConfig.ts index 1b3308a..8e73d32 100644 --- a/src/networkConfig.ts +++ b/src/networkConfig.ts @@ -87,7 +87,7 @@ export type Config = { subgraphs: SubgraphUrls; tokens: TokenInstances; optionalTokens?: string[]; - ensSubdomainKey: string; + relayerEnsSubdomain: string; // Should be in seconds pollInterval: number; constants: { @@ -252,7 +252,7 @@ export const defaultConfig: networkConfig = { gasLimit: 700_000, }, }, - ensSubdomainKey: 'mainnet-tornado', + relayerEnsSubdomain: 'mainnet-tornado', pollInterval: 15, constants: { GOVERNANCE_BLOCK: 11474695, @@ -320,7 +320,7 @@ export const defaultConfig: networkConfig = { decimals: 18, }, }, - ensSubdomainKey: 'bsc-tornado', + relayerEnsSubdomain: 'bsc-tornado', pollInterval: 10, constants: { NOTE_ACCOUNT_BLOCK: 8159269, @@ -378,7 +378,7 @@ export const defaultConfig: networkConfig = { decimals: 18, }, }, - ensSubdomainKey: 'polygon-tornado', + relayerEnsSubdomain: 'polygon-tornado', pollInterval: 10, constants: { NOTE_ACCOUNT_BLOCK: 16257996, @@ -444,7 +444,7 @@ export const defaultConfig: networkConfig = { decimals: 18, }, }, - ensSubdomainKey: 'optimism-tornado', + relayerEnsSubdomain: 'optimism-tornado', pollInterval: 15, constants: { NOTE_ACCOUNT_BLOCK: 2243694, @@ -509,7 +509,7 @@ export const defaultConfig: networkConfig = { decimals: 18, }, }, - ensSubdomainKey: 'arbitrum-tornado', + relayerEnsSubdomain: 'arbitrum-tornado', pollInterval: 15, constants: { NOTE_ACCOUNT_BLOCK: 3430605, @@ -574,7 +574,7 @@ export const defaultConfig: networkConfig = { decimals: 18, }, }, - ensSubdomainKey: 'gnosis-tornado', + relayerEnsSubdomain: 'gnosis-tornado', pollInterval: 15, constants: { NOTE_ACCOUNT_BLOCK: 17754564, @@ -629,7 +629,7 @@ export const defaultConfig: networkConfig = { decimals: 18, }, }, - ensSubdomainKey: 'avalanche-tornado', + relayerEnsSubdomain: 'avalanche-tornado', pollInterval: 10, constants: { NOTE_ACCOUNT_BLOCK: 4429813, @@ -703,7 +703,7 @@ export const defaultConfig: networkConfig = { gasLimit: 700_000, }, }, - ensSubdomainKey: 'sepolia-tornado', + relayerEnsSubdomain: 'sepolia-tornado', pollInterval: 15, constants: { GOVERNANCE_BLOCK: 5594395, @@ -786,5 +786,5 @@ export function getInstanceByAddress({ netId, address }: { netId: NetIdType; add export function getSubdomains() { const allConfig = getNetworkConfig(); - return enabledChains.map((chain) => allConfig[chain].ensSubdomainKey); + return enabledChains.map((chain) => allConfig[chain].relayerEnsSubdomain); } diff --git a/src/relayerClient.ts b/src/relayerClient.ts index 5326891..5f633c5 100644 --- a/src/relayerClient.ts +++ b/src/relayerClient.ts @@ -257,8 +257,8 @@ export class RelayerClient { subdomains: string[], debugRelayer: boolean = false, ): Promise { - const { ensSubdomainKey } = this.config; - const subdomainIndex = subdomains.indexOf(ensSubdomainKey); + const { relayerEnsSubdomain } = this.config; + const subdomainIndex = subdomains.indexOf(relayerEnsSubdomain); const mainnetSubdomain = curr.records[0]; const hostname = curr.records[subdomainIndex]; const isHostWithProtocol = hostname.includes('http');