@@ -18,21 +18,20 @@ import { computeEOAForwarderAddress } from "../../../common/any-evm-utils/comput
1818import { computeForwarderAddress } from "../../../common/any-evm-utils/computeForwarderAddress" ;
1919import { TransactionError , parseRevertReason } from "../../../common/error" ;
2020import { extractFunctionsFromAbi } from "../../../common/feature-detection/extractFunctionsFromAbi" ;
21- import { fetchSourceFilesFromMetadata } from "../../../common/fetchSourceFilesFromMetadata" ;
2221import {
2322 BiconomyForwarderAbi ,
2423 ChainAwareForwardRequest ,
2524 ForwardRequest ,
2625 getAndIncrementNonce ,
2726} from "../../../common/forwarder" ;
2827import { getDefaultGasOverrides } from "../../../common/gas-price" ;
29- import { fetchContractMetadataFromAddress } from "../../../common/metadata-resolver" ;
28+ import { fetchContractMetadataFromAddress , getContractMetadataFromCache } from "../../../common/metadata-resolver" ;
3029import { signEIP2612Permit } from "../../../common/permit" ;
3130import { signTypedDataInternal } from "../../../common/sign" ;
3231import { CONTRACT_ADDRESSES } from "../../../constants/addresses/CONTRACT_ADDRESSES" ;
3332import { getContractAddressByChainId } from "../../../constants/addresses/getContractAddressByChainId" ;
3433import { EventType } from "../../../constants/events" ;
35- import { AbiSchema , ContractSource } from "../../../schema/contracts/custom" ;
34+ import { AbiSchema } from "../../../schema/contracts/custom" ;
3635import { SDKOptions } from "../../../schema/sdk-options" ;
3736import { Address } from "../../../schema/shared/Address" ;
3837import { CallOverrideSchema } from "../../../schema/shared/CallOverrideSchema" ;
@@ -433,8 +432,8 @@ export class ContractWrapper<
433432 ...args ,
434433 ...( callOverrides . value ? [ { value : callOverrides . value } ] : [ ] ) ,
435434 ) ;
436- } catch ( err : any ) {
437- throw await this . formatError ( err , fn , args , callOverrides ) ;
435+ } catch ( staticErr : any ) {
436+ throw await this . formatError ( staticErr , fn , args , callOverrides ) ;
438437 }
439438 }
440439 }
@@ -495,24 +494,18 @@ export class ContractWrapper<
495494 // Parse the revert reason from the error
496495 const reason = parseRevertReason ( error ) ;
497496
498- // Get contract sources for stack trace
499- let sources : ContractSource [ ] | undefined = undefined ;
497+ // Get contract metadata for contract name if cached
500498 let contractName : string | undefined = undefined ;
501499 try {
502- const metadata = await fetchContractMetadataFromAddress (
500+ const chainId = ( await provider . getNetwork ( ) ) . chainId ;
501+ const metadata = getContractMetadataFromCache (
503502 this . address ,
504- this . getProvider ( ) ,
505- this . storage ,
506- this . options ,
503+ chainId ,
507504 ) ;
508505
509- if ( metadata . name ) {
506+ if ( metadata ? .name ) {
510507 contractName = metadata . name ;
511508 }
512-
513- if ( metadata . metadata . sources ) {
514- sources = await fetchSourceFilesFromMetadata ( metadata , this . storage ) ;
515- }
516509 } catch ( err ) {
517510 // no-op
518511 }
@@ -529,7 +522,6 @@ export class ContractWrapper<
529522 value,
530523 hash,
531524 contractName,
532- sources,
533525 } ,
534526 error ,
535527 ) ;
0 commit comments