File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -1955,3 +1955,22 @@ Transaction successfully executed.
19551955
19561956"# ] ] ) ;
19571957} ) ;
1958+
1959+ // https://github.com/foundry-rs/foundry/issues/9476
1960+ forgetest_async ! ( cast_call_custom_chain_id, |_prj, cmd| {
1961+ let chain_id = 55555u64 ;
1962+ let ( _api, handle) = anvil:: spawn( NodeConfig :: test( ) . with_chain_id( Some ( chain_id) ) ) . await ;
1963+
1964+ let http_endpoint = handle. http_endpoint( ) ;
1965+
1966+ cmd. cast_fuse( )
1967+ . args( [
1968+ "call" ,
1969+ "5FbDB2315678afecb367f032d93F642f64180aa3" ,
1970+ "--rpc-url" ,
1971+ & http_endpoint,
1972+ "--chain" ,
1973+ & chain_id. to_string( ) ,
1974+ ] )
1975+ . assert_success( ) ;
1976+ } ) ;
Original file line number Diff line number Diff line change 11use crate :: opts:: ChainValueParser ;
2+ use alloy_chains:: ChainKind ;
23use clap:: Parser ;
34use eyre:: Result ;
45use foundry_config:: {
@@ -154,7 +155,11 @@ impl EtherscanOpts {
154155 dict. insert ( "etherscan_api_key" . into ( ) , key. into ( ) ) ;
155156 }
156157 if let Some ( chain) = self . chain {
157- dict. insert ( "chain_id" . into ( ) , chain. to_string ( ) . into ( ) ) ;
158+ if let ChainKind :: Id ( id) = chain. kind ( ) {
159+ dict. insert ( "chain_id" . into ( ) , ( * id) . into ( ) ) ;
160+ } else {
161+ dict. insert ( "chain_id" . into ( ) , chain. to_string ( ) . into ( ) ) ;
162+ }
158163 }
159164 dict
160165 }
You can’t perform that action at this time.
0 commit comments