GsplTxSigner constructor

GsplTxSigner(
  1. WalletType wallet,
  2. GsplTxData txData
)

Implementation

GsplTxSigner(WalletType wallet, this.txData) : super(wallet: wallet) {
  // Validate and identify coin type and parameters
  final isDoge = wallet is DogeCoin;
  final isLtc = wallet is LtcCoin;
  final isBch = wallet is BchCoin;
  if (!isDoge && !isLtc && !isBch) {
    throw Exception('GSPL signer only support DOGE/LTC/BCH');
  }
  if (isDoge) {
    networkType = wallet.setting.networkType!;
  } else if (isLtc) {
    networkType = wallet.setting.networkType!;
  } else if (isBch) {
    networkType = wallet.setting.networkType!;
  } else {
    throw Exception('Unsupported wallet type for GSPL signing');
  }

  // Mainnet/testnet share the same BIP44 coin-type segment for these
  // chains, so GsplTxData can't recover the right one from an input path
  // alone; give it the wallet's actually-selected NetworkType so output
  // address decoding (e.g. bech32 HRP) matches the signing network.
  txData.networkType = networkType;
}