@@ -70,6 +70,7 @@ import { type SuiChains } from "@wormhole-foundation/sdk-sui";
7070
7171import { colorizeDiff , diffObjects } from "./diff" ;
7272import { forgeSignerArgs , getSigner , type SignerType } from "./getSigner" ;
73+ import { handleRpcError } from "./error" ;
7374
7475// Configuration fields that should be excluded from diff operations
7576// These are local-only configurations that don't have on-chain representations
@@ -3032,6 +3033,7 @@ async function deployEvm<N extends Network, C extends Chain>(
30323033 }
30333034
30343035 const rpc = ch . config . rpc ;
3036+
30353037 // TODO: how to make specialRelayer configurable??
30363038 let specialRelayer : string ;
30373039 if ( ch . chain === "Avalanche" ) {
@@ -3042,10 +3044,17 @@ async function deployEvm<N extends Network, C extends Chain>(
30423044 specialRelayer = "0x63BE47835c7D66c4aA5B2C688Dc6ed9771c94C74" ;
30433045 }
30443046
3045- const provider = new ethers . JsonRpcProvider ( rpc ) ;
3046- const abi = [ "function decimals() external view returns (uint8)" ] ;
3047- const tokenContract = new ethers . Contract ( token , abi , provider ) ;
3048- const decimals : number = await tokenContract . decimals ( ) ;
3047+ let provider : ethers . JsonRpcProvider ;
3048+ let decimals : number ;
3049+
3050+ try {
3051+ provider = new ethers . JsonRpcProvider ( rpc ) ;
3052+ const abi = [ "function decimals() external view returns (uint8)" ] ;
3053+ const tokenContract = new ethers . Contract ( token , abi , provider ) ;
3054+ decimals = await tokenContract . decimals ( ) ;
3055+ } catch ( error ) {
3056+ handleRpcError ( error , ch . chain , ch . network , rpc ) ;
3057+ }
30493058
30503059 // TODO: should actually make these ENV variables.
30513060 const sig = "run(address,address,address,address,uint8,uint8)" ;
@@ -3279,7 +3288,12 @@ async function deploySolana<N extends Network, C extends SolanaChains>(
32793288 // get the mint authority of 'token'
32803289 const tokenMint = new PublicKey ( token ) ;
32813290 const connection : Connection = await ch . getRpc ( ) ;
3282- const mintInfo = await connection . getAccountInfo ( tokenMint ) ;
3291+ let mintInfo ;
3292+ try {
3293+ mintInfo = await connection . getAccountInfo ( tokenMint ) ;
3294+ } catch ( error ) {
3295+ handleRpcError ( error , ch . chain , ch . network , ch . config . rpc ) ;
3296+ }
32833297 if ( ! mintInfo ) {
32843298 console . error ( `Mint ${ token } not found on ${ ch . chain } ${ ch . network } ` ) ;
32853299 process . exit ( 1 ) ;
@@ -4092,7 +4106,7 @@ async function deploySui<N extends Network, C extends Chain>(
40924106 } catch ( deploymentError ) {
40934107 // Restore original Move.toml files if deployment fails
40944108 restore ( ) ;
4095- throw deploymentError ;
4109+ handleRpcError ( deploymentError , ch . chain , ch . network , ch . config . rpc ) ;
40964110 }
40974111 } ) ;
40984112}
0 commit comments