alan-sdk / alan.dart

Pure Dart library allowing you to easily integrate with any Cosmos-based chain.
MIT License
32 stars 31 forks source link

grpc doesn't connect to all url #205

Open Imdavyking opened 3 months ago

Imdavyking commented 3 months ago
## Generic information - Alan.dart version: 0.41.4 - Application type (web/Flutter): Mobile App Android ## Bug description

Alan doesn't not connect to certain grpc url when send cosmos transaction example -> grpc.testnet-croeseid-4.cronos-pos.org, testnet.sentry.chain.grpc.injective.network

Steps to reproduce

```dart cosmos.NetworkInfo getNetworkInfo() { return cosmos.NetworkInfo( bech32Hrp: bech32Hrp, lcdInfo: cosmos.LCDInfo(host: lcdUrl), grpcInfo: cosmos.GRPCInfo(host: grpcUrl), ); } final networkInfo = getNetworkInfo(); final uatomToSend = double.parse(amount) * pow(10, decimals()); final feeD = await getTransactionFee(amount, to) * pow(10, decimals()); final keyPair = await compute(calculateCosmosKey, { mnemonicKey: pref.get(currentMmenomicKey), 'getCosmosKeys': true, "networkInfo": networkInfo, 'path': path, }); cosmos.Wallet wallet = keyPair; final message = bank.MsgSend.create() ..fromAddress = wallet.bech32Address ..toAddress = to; final coin = cosmos.Coin.create() ..denom = denom ..amount = uatomToSend.toInt().toString(); message.amount.add(coin); final signer = cosmos.TxSigner.fromNetworkInfo(networkInfo); final fee = cosmos.Fee(); fee.gasLimit = 200000.toInt64(); final feeCoin = cosmos.Coin.create() ..denom = denom ..amount = feeD.toInt().toString(); fee.amount.add(feeCoin); final tx = await signer.createAndSign( wallet, [message], memo: memo, fee: fee, ); final txSender = cosmos.TxSender.fromNetworkInfo(networkInfo); final response = await txSender.broadcastTx(tx); if (response.isSuccessful) { return response.txhash; } if (kDebugMode) { print(response.toString()); } ```