Cw 537 integrate thor chain swaps (#1280)

* thorChain btc to eth swap

* eth to btc swap

* update the UI

* update localization

* Update thorchain_exchange.provider.dart

* minor fixes

* minor fix

* fix min amount bug

* revert amount_converter changes

* fetching thorChain traid info

* resolve evm related merge conflicts

* minor fix

* Fix eth transaction hash for Thorchain Integration

* add new status endpoint and refund address for eth

* Adjust affiliate fee

* Fix conflicts with main

* review comments + transaction filter item

* taproot addresses check

* added 10 outputs check

* Update thorchain_exchange.provider.dart

* minor fixes

* update thorchain title

* fix fetching rate for thorchain

* Revert "fix fetching rate for thorchain"

This reverts commit 3aa1386ecf.

* fix thorchain exchange rate

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
Serhii 2024-03-28 14:41:11 +02:00 committed by GitHub
parent b9e803f3bd
commit cdf081edfd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 534 additions and 102 deletions

View file

@ -195,7 +195,8 @@ abstract class ElectrumWalletBase
List<BitcoinOutput> outputs,
int? feeRate,
BitcoinTransactionPriority? priority,
{int? inputsCount}) async {
{int? inputsCount,
String? memo}) async {
final utxos = <UtxoWithAddress>[];
List<ECPrivate> privateKeys = [];
@ -253,7 +254,11 @@ abstract class ElectrumWalletBase
}
final estimatedSize = BitcoinTransactionBuilder.estimateTransactionSize(
utxos: utxos, outputs: outputs, network: network);
utxos: utxos,
outputs: outputs,
network: network,
memo: memo,
);
int fee = feeRate != null
? feeAmountWithFeeRate(feeRate, 0, 0, size: estimatedSize)
@ -300,7 +305,13 @@ abstract class ElectrumWalletBase
}
}
return EstimatedTxResult(utxos: utxos, privateKeys: privateKeys, fee: fee, amount: amount);
return EstimatedTxResult(
utxos: utxos,
privateKeys: privateKeys,
fee: fee,
amount: amount,
memo: memo,
);
}
@override
@ -348,13 +359,17 @@ abstract class ElectrumWalletBase
outputs,
transactionCredentials.feeRate,
transactionCredentials.priority,
memo: transactionCredentials.outputs.first.memo,
);
final txb = BitcoinTransactionBuilder(
utxos: estimatedTx.utxos,
outputs: outputs,
fee: BigInt.from(estimatedTx.fee),
network: network);
utxos: estimatedTx.utxos,
outputs: outputs,
fee: BigInt.from(estimatedTx.fee),
network: network,
memo: estimatedTx.memo,
outputOrdering: BitcoinOrdering.none,
);
final transaction = txb.buildTransaction((txDigest, utxo, publicKey, sighash) {
final key = estimatedTx.privateKeys
@ -888,13 +903,19 @@ class EstimateTxParams {
}
class EstimatedTxResult {
EstimatedTxResult(
{required this.utxos, required this.privateKeys, required this.fee, required this.amount});
EstimatedTxResult({
required this.utxos,
required this.privateKeys,
required this.fee,
required this.amount,
this.memo,
});
final List<UtxoWithAddress> utxos;
final List<ECPrivate> privateKeys;
final int fee;
final int amount;
final String? memo;
}
BitcoinBaseAddress addressTypeFromStr(String address, BasedUtxoNetwork network) {