Skip to content

Commit

Permalink
Update how we're matching chains with scw verification (#1131)
Browse files Browse the repository at this point in the history
* update chain matching

* spelling
  • Loading branch information
codabrink authored Oct 10, 2024
1 parent 79eb445 commit cebf673
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
14 changes: 7 additions & 7 deletions xmtp_id/src/scw_verifier/chain_urls_default.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"1": "https://eth.llamarpc.com",
"10": "https://rpc.ankr.com/optimism",
"137": "https://polygon.llamarpc.com",
"324": "https://mainnet.era.zksync.io",
"8453": "https://base.llamarpc.com",
"42161": "https://arbitrum.llamarpc.com",
"59144": "https://linea-rpc.publicnode.com"
"eip155:1": "https://eth.llamarpc.com",
"eip155:10": "https://rpc.ankr.com/optimism",
"eip155:137": "https://polygon.llamarpc.com",
"eip155:324": "https://mainnet.era.zksync.io",
"eip155:8453": "https://base.llamarpc.com",
"eip155:42161": "https://arbitrum.llamarpc.com",
"eip155:59144": "https://linea-rpc.publicnode.com"
}
7 changes: 6 additions & 1 deletion xmtp_id/src/scw_verifier/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ impl MultiSmartContractSignatureVerifier {
/// Upgrade the default urls to paid/private/alternative urls if the env vars are present.
pub fn upgrade(mut self) -> Self {
self.verifiers.iter_mut().for_each(|(id, verif)| {
if let Ok(url) = env::var(format!("CHAIN_RPC_{id}")) {
// TODO: coda - update the chain id env var ids to preceeded with "EIP155_"
let eip_id = id
.split(":")
.nth(1)
.expect("All chain ids are preceeded with 'eip155:' for now.");
if let Ok(url) = env::var(format!("CHAIN_RPC_{eip_id}")) {
*verif = Box::new(RpcSmartContractWalletVerifier::new(url));
} else {
info!("No upgraded chain url for chain {id}, using default.");
Expand Down

0 comments on commit cebf673

Please sign in to comment.