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

Decred: Add mock libwallet. #4

Closed
wants to merge 1 commit into from
Closed

Conversation

JoeGruffins
Copy link
Owner

Remove electrum wallet bits.

closes #2

@JoeGruffins
Copy link
Owner Author

Copy link
Collaborator

@itswisdomagain itswisdomagain left a comment

Choose a reason for hiding this comment

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

Something else I noticed:
cw_decred/README.md says cw_bitcoin. That's from the previous PR.

.gitignore Show resolved Hide resolved
configure_cake_wallet_android.sh Outdated Show resolved Hide resolved
cw_dcrlibwallet/lib/src/lib_dcrlibwallet.dart Outdated Show resolved Hide resolved
cw_decred/lib/mnemonic.dart Outdated Show resolved Hide resolved
required this.fee,
required this.rawHex});

final SPVWallet spv;
Copy link
Collaborator

Choose a reason for hiding this comment

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

final SPVWallet wallet?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Do you feel strongly about this? If I change this everywhere wallet conflicts with wallet in wallet.dart. I could do spv -> libwallet?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No, not strongly.

cw_decred/lib/wallet_addresses.dart Outdated Show resolved Hide resolved
Comment on lines 21 to 22
: assert(false), // Not feasable with current decred implementation. TODO: Surely this is not the correct way to do this.
super(name: name, password: password, walletInfo: walletInfo);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this for watch-only wallets, where the wif is the xpub? Don't know though. Especially since assert only works in dev mode, not in prod, I agree there would need to be a better way to disable this feature if decred doesn't support it. Can probably just throw an exception inside the constructor.

Comment on lines 88 to 90
Future<DecredWallet> restoreFromKeys(
DecredRestoreWalletFromWIFCredentials credentials) async =>
throw UnimplementedError();
Copy link
Collaborator

Choose a reason for hiding this comment

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

It appears this may be enough, based on my previous comment. The assert there may not be necessary. Is it even possible to not have that DecredRestoreWalletFromWIFCredentials class at all and just use WalletCredentials directly instead?

Copy link
Owner Author

Choose a reason for hiding this comment

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

The compiler was complaining without putting something there in the constructor I think. Also maybe can use for watching only if we have that? Leaving for now with the throws.

Comment on lines 7 to 11
@override
WalletCredentials createDecredRestoreWalletFromSeedCredentials({
required String name,
required String mnemonic,
required String password})
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file doesn't look formatted.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah formatting kind of all over the place. We just want two space indention? I attempted to correct this file and everywhere that's not copied code should be ok.

Comment on lines 489 to 492
// TODO: What is this for.
if (walletType == WalletType.decred) {
return Node();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

My preliminary research seems to suggest that it allows a user choose a custom address to connect to. The user's preferred node would be saved to the nodes map and we shouldn't need to do this if check.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ohhh.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Changed the todo do Implement connecting to a user's preferred node.

@JoeGruffins
Copy link
Owner Author

Going to make changes here first https://github.com/JoeGruffins/cake_wallet/tree/mocklibwalletonlinux and apply back to this branch because I think it is faster in the end building and testing on linux.

@JoeGruffins
Copy link
Owner Author

I got most of the suggestions https://github.com/JoeGruffins/cake_wallet/compare/75daa34c366a07df206655b5a5c5ae75f4893e68..f3cc7a316d50e3bb9cd978cc89996f0260c51be8

There are probably a lot of unused imports here and there still.

Use a mock libwallet for now.
@JoeGruffins
Copy link
Owner Author

These were pushed. Forgot to merge here first so just closing.

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.

3 participants