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 27 commits into
base: main
Choose a base branch
from
Open

Electrum sp refactors #1781

wants to merge 27 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
@OmarHatem28 OmarHatem28 marked this pull request as ready for review November 6, 2024 03:03

factory BitcoinAddressRecord.fromJSON(String jsonSource, {BasedUtxoNetwork? network}) {
this.scriptHash = scriptHash ?? BitcoinAddressUtils.scriptHash(address, network: network!);
Copy link
Contributor

Choose a reason for hiding this comment

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

if we are sure that network won't be null, then shouldn't we make it required?

you are not setting it in the fromJson function so it will be null

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

network: (decoded['network'] as String?) == null
? network
: BasedUtxoNetwork.fromName(decoded['network'] as String),
silentPaymentTweak: decoded['silent_payment_tweak'] as String?,
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we no longer saving the tweak? isn't it needed for sending

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

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

Comment on lines -36 to -37
required this.silentPaymentTweak,
required this.silentPaymentLabel,
Copy link
Contributor

Choose a reason for hiding this comment

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

do you not need to save them anymore?
or are you saving them somewhere else

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)

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