@@ -202,6 +202,17 @@ class CardanoWallet extends Bip39Wallet<Cardano> {
202202 address: ADABaseAddress ((await getCurrentReceivingAddress ())! .value),
203203 amount: Value (coin: totalBalance - (txData.amount! .raw)),
204204 );
205+
206+ final outputAddress = ADAAddress .fromAddress (
207+ txData.recipients! .first.address,
208+ );
209+ if (! (outputAddress is ADABaseAddress ||
210+ outputAddress is ADAEnterpriseAddress )) {
211+ throw Exception (
212+ "Address of type ${outputAddress .runtimeType } currently not supported." ,
213+ );
214+ }
215+
205216 final body = TransactionBody (
206217 inputs:
207218 listOfUtxosToBeUsed
@@ -215,7 +226,7 @@ class CardanoWallet extends Bip39Wallet<Cardano> {
215226 outputs: [
216227 change,
217228 TransactionOutput (
218- address: ADABaseAddress (txData.recipients ! .first.address) ,
229+ address: outputAddress ,
219230 amount: Value (coin: txData.amount! .raw - exampleFee),
220231 ),
221232 ],
@@ -323,19 +334,30 @@ class CardanoWallet extends Bip39Wallet<Cardano> {
323334 coin: totalUtxoAmount - (txData.amount! .raw + txData.fee! .raw),
324335 ),
325336 );
337+
338+ final outputAddress = ADAAddress .fromAddress (
339+ txData.recipients! .first.address,
340+ );
341+ if (! (outputAddress is ADABaseAddress ||
342+ outputAddress is ADAEnterpriseAddress )) {
343+ throw Exception (
344+ "Address of type ${outputAddress .runtimeType } currently not supported." ,
345+ );
346+ }
347+
326348 List <TransactionOutput > outputs = [];
327349 if (totalBalance == (txData.amount! .raw + txData.fee! .raw)) {
328350 outputs = [
329351 TransactionOutput (
330- address: ADABaseAddress (txData.recipients ! .first.address) ,
352+ address: outputAddress ,
331353 amount: Value (coin: txData.amount! .raw),
332354 ),
333355 ];
334356 } else {
335357 outputs = [
336358 change,
337359 TransactionOutput (
338- address: ADABaseAddress (txData.recipients ! .first.address) ,
360+ address: outputAddress ,
339361 amount: Value (coin: txData.amount! .raw),
340362 ),
341363 ];
0 commit comments