Skip to content

grpc doesn't connect to all url #205

@Imdavyking

Description

@Imdavyking

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

  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());
    }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions