Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electrum sp refactors #1781

Open
wants to merge 79 commits into
base: main
Choose a base branch
from
Open

Electrum sp refactors #1781

wants to merge 79 commits into from

Conversation

rafael-xmr
Copy link
Contributor

Issue Number (if Applicable): Fixes #

Description

Please include a summary of the changes and which issue is fixed / feature is added.

Pull Request - Checklist

  • Initial Manual Tests Passed
  • Double check modified code and verify it with the feature/task requirements
  • Format code
  • Look for code duplication
  • Clear naming for variables and methods

@rafael-xmr rafael-xmr marked this pull request as draft October 29, 2024 23:57
@rafael-xmr rafael-xmr force-pushed the electrum-sp-refactors branch from 927b639 to a3e131d Compare November 4, 2024 22:39
@OmarHatem28 OmarHatem28 marked this pull request as ready for review November 6, 2024 03:03
cw_bitcoin/lib/bitcoin_address_record.dart Outdated Show resolved Hide resolved
Comment on lines 182 to 183
decoded['address'] as String,
index: decoded['index'] as int,
isHidden: decoded['isHidden'] as bool? ?? false,
labelIndex: decoded['labelIndex'] as int,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't be backward compatible

cw_bitcoin/lib/bitcoin_address_record.dart Show resolved Hide resolved
Comment on lines 23 to 27
final derivationPath = "m/84'/0'/$i'";
final xpub =
await bitcoinLedgerApp.getXPubKey(derivationPath: derivationPath);
Bip32Slip10Secp256k1 hd =
Bip32Slip10Secp256k1.fromExtendedKey(xpub).childKey(Bip32KeyIndex(0));

final address = generateP2WPKHAddress(
hd: hd, index: 0, network: BitcoinNetwork.mainnet);
final xpub = await bitcoinLedgerApp.getXPubKey(derivationPath: derivationPath);
final hd = Bip32Slip10Secp256k1.fromExtendedKey(xpub)
.childKey(Bip32KeyIndex(0))
.childKey(Bip32KeyIndex(index));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to double check this with you and Konstantin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be 0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it be better if we unify the BitcoinTransactionPriority with the ElectrumTransactionPriority?
i.e have a single model that we map both to it, so we only use one model and not have checks on which model we should be using

plus, like this which one would we show the values of?
I noticed that you keep using ElectrumTransactionPriority everywhere anyway, so there will be some edge cases and stuff, so let's just unify them into 1 model at the time of fetching (i.e in _handleGetFeeRates in the worker) and use that unified model everywhere

cw_bitcoin/lib/bitcoin_unspent.dart Show resolved Hide resolved
Box<WalletInfo> walletInfoSource,
Box<UnspentCoinsInfo> unspentCoinSource,
bool isDirect,
bool mempoolAPIEnabled,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this to be passed to the wallet service? why not just get it from the shared prefs, so that if it's value changes we get the latest update

that's for all 3 electrum wallets (btc, ltc, bch)

cw_bitcoin/lib/bitcoin_address_record.dart Show resolved Hide resolved
cw_bitcoin/lib/bitcoin_address_record.dart Outdated Show resolved Hide resolved
cw_bitcoin/lib/bitcoin_address_record.dart Outdated Show resolved Hide resolved
cw_bitcoin/lib/bitcoin_address_record.dart Outdated Show resolved Hide resolved
cw_bitcoin/lib/bitcoin_address_record.dart Outdated Show resolved Hide resolved
Comment on lines 23 to 27
final derivationPath = "m/84'/0'/$i'";
final xpub =
await bitcoinLedgerApp.getXPubKey(derivationPath: derivationPath);
Bip32Slip10Secp256k1 hd =
Bip32Slip10Secp256k1.fromExtendedKey(xpub).childKey(Bip32KeyIndex(0));

final address = generateP2WPKHAddress(
hd: hd, index: 0, network: BitcoinNetwork.mainnet);
final xpub = await bitcoinLedgerApp.getXPubKey(derivationPath: derivationPath);
final hd = Bip32Slip10Secp256k1.fromExtendedKey(xpub)
.childKey(Bip32KeyIndex(0))
.childKey(Bip32KeyIndex(index));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be 0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nutralize them into one class (BitcoinTransactionPriority)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be reverted as discussed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants