diff --git a/lib/app/shared/constants/parameters.dart b/lib/app/shared/constants/parameters.dart index cd3209bf5..dcc3b0808 100644 --- a/lib/app/shared/constants/parameters.dart +++ b/lib/app/shared/constants/parameters.dart @@ -31,7 +31,7 @@ class Parameters { static const web3RpcMainnetUrl = 'https://mainnet.infura.io/v3/'; static const POLYGON_MAIN_NETWORK = 'main'; - static const INFURA_URL = 'https://polygon-mainnet.infura.io/v3/'; + static const POLYGON_INFURA_URL = 'https://polygon-mainnet.infura.io/v3/'; static const INFURA_RDP_URL = 'wss://polygon-mainnet.infura.io/v3/'; static const ID_STATE_CONTRACT_ADDR = '0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D'; diff --git a/lib/app/shared/helper_functions/helper_functions.dart b/lib/app/shared/helper_functions/helper_functions.dart index 9900c2af5..057047a56 100644 --- a/lib/app/shared/helper_functions/helper_functions.dart +++ b/lib/app/shared/helper_functions/helper_functions.dart @@ -2117,15 +2117,22 @@ String? getWalletAddress(CredentialSubjectModel credentialSubjectModel) { Future fetchRpcUrl(BlockchainNetwork blockchainNetwork) async { String rpcUrl = ''; - if (blockchainNetwork is PolygonNetwork || - blockchainNetwork is BinanceNetwork || + if (blockchainNetwork is BinanceNetwork || blockchainNetwork is FantomNetwork) { rpcUrl = blockchainNetwork.rpcNodeUrl as String; } else { if (blockchainNetwork.networkname == 'Mainnet') { await dotenv.load(); final String infuraApiKey = dotenv.get('INFURA_API_KEY'); - const String prefixUrl = Parameters.web3RpcMainnetUrl; + + late String prefixUrl; + + if (blockchainNetwork is PolygonNetwork) { + prefixUrl = Parameters.POLYGON_INFURA_URL; + } else { + prefixUrl = Parameters.web3RpcMainnetUrl; + } + return '$prefixUrl$infuraApiKey'; } else { rpcUrl = blockchainNetwork.rpcNodeUrl as String; diff --git a/lib/polygon_id/cubit/polygon_id_cubit.dart b/lib/polygon_id/cubit/polygon_id_cubit.dart index c4b3ef130..458370e98 100644 --- a/lib/polygon_id/cubit/polygon_id_cubit.dart +++ b/lib/polygon_id/cubit/polygon_id_cubit.dart @@ -87,7 +87,7 @@ class PolygonIdCubit extends Cubit { currentNetwork = PolygonIdNetwork.PolygonMainnet; await polygonId.init( network: network, - web3Url: Parameters.INFURA_URL, + web3Url: Parameters.POLYGON_INFURA_URL, web3RdpUrl: Parameters.INFURA_RDP_URL, web3ApiKey: dotenv.get('INFURA_API_KEY'), idStateContract: Parameters.ID_STATE_CONTRACT_ADDR, @@ -147,7 +147,7 @@ class PolygonIdCubit extends Cubit { network = Parameters.POLYGON_MAIN_NETWORK; await polygonId.setEnv( network: Parameters.POLYGON_MAIN_NETWORK, - web3Url: Parameters.INFURA_URL, + web3Url: Parameters.POLYGON_INFURA_URL, web3RdpUrl: Parameters.INFURA_RDP_URL, web3ApiKey: dotenv.get('INFURA_API_KEY'), idStateContract: Parameters.ID_STATE_CONTRACT_ADDR,