fix , bug and swapping for nano (#1123)

Matthew Fosse committed Oct 11, 2023 at 20:32 UTC acb05178713e2d4b0bad2ac84f410fb69e2e5f67
1 file changed +5 -3
cw_nano/lib/nano_wallet.dart
+5 -3
@@ -169,8 +169,8 @@ abstract class NanoWalletBase
169 if (txOut.sendAll) {
170 amt = balance[currency]?.currentBalance ?? BigInt.zero;
171 } else {
172 - amt = BigInt.tryParse(
173 - NanoUtil.getAmountAsRaw(txOut.cryptoAmount ?? "0", NanoUtil.rawPerNano)) ??
172 + amt = BigInt.tryParse(NanoUtil.getAmountAsRaw(
173 + txOut.cryptoAmount?.replaceAll(',', '.') ?? "0", NanoUtil.rawPerNano)) ??
174 BigInt.zero;
175 }
176
@@ -182,7 +182,9 @@ abstract class NanoWalletBase
182
183 final block = await _client.constructSendBlock(
184 amountRaw: amt.toString(),
185 - destinationAddress: txOut.extractedAddress ?? txOut.address,
185 + destinationAddress: credentials.outputs.first.isParsedAddress
186 + ? credentials.outputs.first.extractedAddress!
187 + : credentials.outputs.first.address,
188 privateKey: _privateKey!,
189 balanceAfterTx: runningBalance,
190 previousHash: previousHash,