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

litecoin mweb support #1455

Merged
merged 253 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from 208 commits
Commits
Show all changes
253 commits
Select commit Hold shift + click to select a range
dbc005d
Fix stub creation
hectorchu Apr 21, 2024
29238ef
Generate MWEB addresses
hectorchu Apr 22, 2024
407b731
Fix mweb address derivation
hectorchu Apr 22, 2024
90588ee
Use camel-case
hectorchu Apr 22, 2024
9aa5ef8
Show utxos in tx list
hectorchu Apr 22, 2024
b07c3d8
A few fixes
hectorchu Apr 22, 2024
4fc1de8
Add spent processing
hectorchu Apr 22, 2024
50ef918
Update balance
hectorchu Apr 23, 2024
05b71a3
Balance fixes
hectorchu Apr 23, 2024
3e5a5f1
Update address records
hectorchu Apr 23, 2024
37ff38f
Get rid of debounce hack
hectorchu Apr 24, 2024
404672f
Get sending up to the confirmation box
hectorchu Apr 24, 2024
4abe700
Fee estimation
hectorchu Apr 25, 2024
c964242
Stop the daemon if plugin is unloaded
hectorchu Apr 25, 2024
b1caf79
Normal fee for non-mweb txns
hectorchu Apr 25, 2024
fea7e7a
Fix fee estimation for send all
hectorchu Apr 26, 2024
66d98a2
Don't hash mweb addresses
hectorchu Apr 26, 2024
796c953
More fee fixes
hectorchu Apr 26, 2024
f015710
Broadcast mweb
hectorchu Apr 26, 2024
68688ee
Remove test files
hectorchu Apr 26, 2024
70b07b2
One more
hectorchu Apr 26, 2024
b1f0334
Confirm sent txns
hectorchu Apr 27, 2024
2c941ef
Couple of fixes
hectorchu Apr 27, 2024
8964774
Resign inputs after mweb create
hectorchu Apr 28, 2024
b39b2bb
Some more fixes
hectorchu Apr 28, 2024
a936a3b
Update balance after sending
hectorchu Apr 28, 2024
d1ccf6e
Correctly update address records
hectorchu Apr 29, 2024
7978ad4
Update confs
hectorchu Apr 29, 2024
77142e3
Merge branch 'mweb' of https://github.com/ltcmweb/cake_wallet into mweb
fossephate May 17, 2024
7173c49
[skip ci] updates
fossephate May 17, 2024
32bfc3b
Merge branch 'main' into mweb
OmarHatem28 May 18, 2024
ec8b3f8
[skip ci] add dep overrides
fossephate May 20, 2024
db6eec0
Merge branch 'mweb' of https://github.com/cake-tech/cake_wallet into …
fossephate May 20, 2024
295026b
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate May 21, 2024
bdc1d03
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 22, 2024
2651073
working
fossephate May 24, 2024
48217cb
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 28, 2024
7656752
small fix
fossephate May 29, 2024
ac1fe6b
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 29, 2024
4e1b96e
merge fixes [skip ci]
fossephate May 29, 2024
0882ba0
merge fixes [skip ci]
fossephate May 30, 2024
2377a34
[skip ci] minor fixes
fossephate May 30, 2024
6edf0f8
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate May 31, 2024
1263235
silent payment fixes [skip ci]
fossephate May 31, 2024
fe7fc63
merge main [skip ci]
fossephate Jun 7, 2024
f354ae8
updates [skip ci]
fossephate Jun 8, 2024
b3e0c0b
save [skip ci]
fossephate Jun 8, 2024
006d08f
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Jun 13, 2024
cb84a47
use mwebutxos box
fossephate Jun 19, 2024
01ea1f1
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate Jun 20, 2024
e595d2d
[skip ci] lots of fixes, still testing
fossephate Jun 24, 2024
1430c44
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate Jun 26, 2024
29f77aa
add rescan from height feature and test workflow build
fossephate Jun 28, 2024
829efe5
install go
fossephate Jun 28, 2024
9bc7dc6
use sudo
fossephate Jun 28, 2024
57cfeae
correct package name
fossephate Jun 28, 2024
a6d604b
move building mweb higher for faster testing
fossephate Jun 28, 2024
61bffc1
install fixes
fossephate Jun 28, 2024
a125800
install later version of go
fossephate Jun 28, 2024
216949b
go fixes
fossephate Jun 28, 2024
2778759
testing
fossephate Jun 28, 2024
5dbdb25
testing
fossephate Jun 28, 2024
0a1aee7
testing
fossephate Jun 28, 2024
f04f173
testing
fossephate Jun 28, 2024
9ec108a
testing
fossephate Jun 28, 2024
bddfb2c
should workgit add .github/workflows/pr_test_build.yml
fossephate Jun 28, 2024
9eb2ae1
???
fossephate Jun 28, 2024
0aafd34
??? pt.2
fossephate Jun 28, 2024
9a85780
should work, for real this time
fossephate Jun 28, 2024
7869334
fix tx history not persisting + update build_mwebd script
fossephate Jun 28, 2024
dee77a6
updates
fossephate Jul 1, 2024
a1dbe3b
fix some rescan and address gen issues
fossephate Jul 1, 2024
14210d2
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate Jul 2, 2024
4008add
save [skip ci]
fossephate Jul 9, 2024
bee6ad5
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Jul 9, 2024
eaed450
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate Jul 10, 2024
dfdf16a
fix unconfirmed balance not updating when receiving
fossephate Jul 10, 2024
4ec9d7b
unspent coins / coin control fixes
fossephate Jul 11, 2024
e5e2a87
coin control fixes
fossephate Jul 11, 2024
c831b18
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate Jul 11, 2024
d81eb0c
address balance and txCount fixes, try/catch electrum call
fossephate Jul 11, 2024
7209147
fix txCount for addresses
fossephate Jul 12, 2024
8efe70f
save [skip ci]
fossephate Jul 12, 2024
a883780
potential fixes
fossephate Jul 15, 2024
45f2291
minor fix
fossephate Jul 16, 2024
ac6dc67
minor fix - 2
fossephate Jul 16, 2024
5a2a207
sync status fixes, potential fix for background state issue
fossephate Jul 16, 2024
80d56bc
workflow and script updates
fossephate Jul 17, 2024
ef458d1
updates
fossephate Jul 17, 2024
92669a6
expirimental optimization
fossephate Jul 17, 2024
7c5cd19
[skip ci] minor enhancements
fossephate Jul 17, 2024
8ef9678
workflow and script fixes
fossephate Jul 17, 2024
b77afee
workflow minor cleanup [skip ci]
fossephate Jul 17, 2024
b38deb4
minor code cleanup & friendlier error message on failed tx's
fossephate Jul 17, 2024
ba4893f
balance when sending fix
fossephate Jul 17, 2024
65509c0
experimental
fossephate Jul 17, 2024
adee6ff
more experiments
fossephate Jul 17, 2024
a2121ef
save
fossephate Jul 17, 2024
964f66c
updates
fossephate Jul 19, 2024
399d0ca
coin control edge cases
fossephate Jul 19, 2024
ea28698
remove neutrino.db if no litecoin wallets left after deleting
fossephate Jul 19, 2024
3103f3c
update translations
fossephate Jul 19, 2024
a51e902
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Jul 22, 2024
8e69011
updates
fossephate Jul 22, 2024
381830d
minor fix
fossephate Jul 22, 2024
c127743
[skip ci] update translations + minor fixes
fossephate Jul 22, 2024
6946db6
state fixes
fossephate Jul 22, 2024
eab8a87
configure fix
fossephate Jul 22, 2024
8f7716f
ui updates
fossephate Jul 22, 2024
bdc5506
translation fixes
fossephate Jul 22, 2024
14cb65b
[skip ci] addressbook updates
fossephate Jul 22, 2024
70764c3
fix popup
fossephate Jul 22, 2024
29a96a7
fix popup2
fossephate Jul 22, 2024
23199cd
fix litecoin address book
fossephate Jul 23, 2024
9b33e68
fix ios mwebd build script
fossephate Jul 24, 2024
93f6dd4
fix for building monero.com
fossephate Jul 24, 2024
e05b06e
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Jul 24, 2024
f3c976c
minor fix
fossephate Jul 24, 2024
c78243f
uncomment fix for state issues
fossephate Jul 24, 2024
2a7a185
potential mweb sync fix (ios)
fossephate Jul 25, 2024
ce9e605
remove print [skip ci]
fossephate Jul 25, 2024
3dbbffa
electrum stream potential fix
fossephate Jul 25, 2024
13aeaf2
fix ios build issues [skip ci]
MrCyjaneK Jul 26, 2024
56ea676
connection reliability updates, update kotlin code to match swift cod…
fossephate Jul 29, 2024
8f579b1
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 12, 2024
c1215f4
dep fixes
fossephate Aug 12, 2024
b686c82
minor fix
fossephate Aug 12, 2024
3408de8
more merge fixes
fossephate Aug 12, 2024
8949db3
bitcoin_flutter removal fixes
fossephate Aug 12, 2024
cfd1cf3
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 13, 2024
28437f1
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 13, 2024
bc340b3
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 13, 2024
ff8c869
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate Aug 14, 2024
91f8f8f
Merge branch 'mweb' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 14, 2024
d8accfb
[skip ci] fix always scan setting, swift updates
fossephate Aug 14, 2024
c449986
updates
fossephate Aug 14, 2024
1920453
fixes
fossephate Aug 14, 2024
51ce70e
Merge branch 'main' into mweb
OmarHatem28 Aug 16, 2024
dac4a12
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 19, 2024
7d36da9
small fix
fossephate Aug 19, 2024
d315617
small fix
fossephate Aug 19, 2024
501e499
fix
fossephate Aug 19, 2024
c620d6d
dart:convert != package:convert
fossephate Aug 19, 2024
ef077c8
change address fixes
fossephate Aug 19, 2024
e0a0b7a
update bitcoin_base to fix mweb address program checking
fossephate Aug 19, 2024
9cab9b9
fix ios xcode project [skip ci]
fossephate Aug 22, 2024
dc699af
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate Aug 22, 2024
527983a
updates
fossephate Aug 23, 2024
e7f7d20
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 23, 2024
10c2353
more fixes
fossephate Aug 23, 2024
a0c315c
more fixes
fossephate Aug 23, 2024
2552fb9
ensure we don't initialize mweb until we really have to
fossephate Aug 23, 2024
81b81f0
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 26, 2024
dadae35
fix regression
fossephate Aug 27, 2024
e8eedf7
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 27, 2024
008963e
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 28, 2024
b027223
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate Sep 3, 2024
d1c8565
improve mweb reliability
fossephate Sep 3, 2024
5ec0e26
[skip ci] wip adress generation
fossephate Sep 4, 2024
7b5c36e
wip
fossephate Sep 4, 2024
aa6cac8
wip
fossephate Sep 5, 2024
c8aa159
[skip ci] wip
fossephate Sep 5, 2024
20fa6a0
updates [skip ci]
fossephate Sep 5, 2024
14891ec
ios fixes
fossephate Sep 5, 2024
5dbc414
fix workflows + ios fix
fossephate Sep 5, 2024
fbffda7
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 6, 2024
bae741a
test old mweb version
fossephate Sep 6, 2024
ec60fa9
update go version and mwebd hash
fossephate Sep 6, 2024
56c505d
review updates pt.1
fossephate Sep 9, 2024
0f5ee47
Update cw_bitcoin/lib/litecoin_wallet.dart
fossephate Sep 9, 2024
577aec0
remove non-litecoin address types regex [skip ci]
OmarHatem28 Sep 9, 2024
729df41
Merge remote-tracking branch 'origin/mweb' into mweb
OmarHatem28 Sep 9, 2024
728a0bf
more minor fixes
fossephate Sep 9, 2024
69297d2
Merge branch 'mweb' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 9, 2024
3a70d72
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 9, 2024
18a9bde
remove duplicate [skip ci]
OmarHatem28 Sep 9, 2024
dc77dee
Update lib/store/settings_store.dart
fossephate Sep 9, 2024
fd578dd
script updates, swap params on createLitecoinWalletService
fossephate Sep 9, 2024
3963233
topup fix
fossephate Sep 9, 2024
1061b7d
[skip ci] wip
fossephate Sep 10, 2024
150d065
[skip ci] testing
fossephate Sep 10, 2024
69332b3
[skip ci] file didn't get saved
fossephate Sep 10, 2024
d8d26a0
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 10, 2024
2c38641
more address generation reliability fixes
fossephate Sep 10, 2024
2573ca6
[skip ci] minor
fossephate Sep 10, 2024
5086e39
Merge branch 'main' into mweb
OmarHatem28 Sep 11, 2024
1e73a51
minor code cleanup
fossephate Sep 11, 2024
818b69c
Merge branch 'mweb' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 11, 2024
0899197
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 11, 2024
a673d39
hopefully prevents send issue
fossephate Sep 11, 2024
c94c10c
[skip ci] wip address changes
fossephate Sep 11, 2024
cd307bf
[skip ci] save
fossephate Sep 11, 2024
554df09
save mweb addresses, auto-restart sync process if it gets stuck [skip…
fossephate Sep 11, 2024
f8d76fb
address generation issues mostly resolved
fossephate Sep 12, 2024
8aa95a2
more performance fixes
fossephate Sep 12, 2024
e55bd85
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 12, 2024
ec25c2b
[skip ci]
fossephate Sep 12, 2024
9dd696a
this should maybe be refactored, pt.1
fossephate Sep 12, 2024
6a4327a
separate mweb balances, pt.2
fossephate Sep 12, 2024
5c9a902
[skip ci] save
fossephate Sep 13, 2024
245f4d6
add translations [skip ci]
fossephate Sep 13, 2024
3a969ac
fix sending with mweb amounts
fossephate Sep 13, 2024
4503ad5
works for simple mweb-mweb case, further testing needed
fossephate Sep 13, 2024
17695d1
found an edge case
fossephate Sep 13, 2024
e970f70
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 16, 2024
34d5d96
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate Sep 18, 2024
d3cf372
[skip ci] make failed broadcast error message less serious
fossephate Sep 19, 2024
c49f2ed
minor
fossephate Sep 19, 2024
8d4443e
capture all grpc errors and much better error handling overall
fossephate Sep 19, 2024
0cd21f2
[skip ci] minor
fossephate Sep 19, 2024
7ee8949
prevent transactions with < 6 confirmations from being used + hide mw…
fossephate Sep 20, 2024
03a3fb8
fix
fossephate Sep 20, 2024
fc51847
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 20, 2024
f2ddbcf
merge fixes pt.1 [skip ci]
fossephate Sep 20, 2024
6bcda3b
fix mweb tags
fossephate Sep 20, 2024
4f046fe
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 21, 2024
d653713
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate Sep 23, 2024
fb6cea2
fix
fossephate Sep 23, 2024
69e2547
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 23, 2024
b3e346d
[skip ci] fix tag spacing
fossephate Sep 23, 2024
8d7bad3
fix transaction history not showing up
fossephate Sep 23, 2024
e48cd0d
fix mweb crash on non-fully deleted mweb cache, sync status ETA, othe…
fossephate Sep 23, 2024
dbc2fb3
[skip ci] minor code cleanup
fossephate Sep 23, 2024
371fb8c
[skip ci] minor code cleanup
fossephate Sep 23, 2024
a226a33
additional cleanup
fossephate Sep 23, 2024
7435db0
silent payments eta fixes and updates
fossephate Sep 23, 2024
af2f0e2
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 24, 2024
cb74505
revert sync eta changes into separate pr
fossephate Sep 24, 2024
ea1d4cb
[skip ci] minor
fossephate Sep 24, 2024
633d524
[skip ci] minor
fossephate Sep 24, 2024
6a4eaec
revert sync status title
fossephate Sep 24, 2024
6f462aa
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 24, 2024
840287c
review fixes, additional cleanup
fossephate Sep 24, 2024
31affa6
[skip ci] minor
fossephate Sep 24, 2024
967e333
[skip ci] minor
fossephate Sep 24, 2024
5cb8c4f
[skip ci] minor
fossephate Sep 24, 2024
29164b2
trigger build
fossephate Sep 24, 2024
ea92998
review fixes, pt.2
fossephate Sep 24, 2024
efa8324
check if still processing utxos before updating sync status [skip ci]
fossephate Sep 24, 2024
55d8b96
[skip ci] minor
fossephate Sep 24, 2024
154eee3
balance fix
fossephate Sep 24, 2024
d040793
minor
fossephate Sep 24, 2024
f66e369
minor
fossephate Sep 24, 2024
6f2cb4d
[skip ci] minor
fossephate Sep 24, 2024
1de4ccd
[skip ci] fix test net btc
fossephate Sep 25, 2024
48061ea
don't use mwebd for non-mweb tx's
fossephate Sep 25, 2024
dcac601
[skip ci] minor cleanup
fossephate Sep 25, 2024
3724681
don't show all 1000+ mweb addresses on receive page
fossephate Sep 25, 2024
23e7da3
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Sep 26, 2024
2f8c1a0
minor cleanup + additional logging
fossephate Sep 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/pr_test_build_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,25 @@ jobs:
cd /opt/android/cake_wallet
flutter pub get


- name: Install go and gomobile
run: |
# install go > 1.23:
wget https://go.dev/dl/go1.23.1.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.23.1.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:~/go/bin
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init

- name: Build mwebd
run: |
# paths are reset after each step, so we need to set them again:
OmarHatem28 marked this conversation as resolved.
Show resolved Hide resolved
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:~/go/bin
cd /opt/android/cake_wallet/scripts/android/
./build_mwebd.sh --dont-install

- name: Generate KeyStore
run: |
cd /opt/android/cake_wallet/android/app
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/pr_test_build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,25 @@ jobs:
cd /opt/android/cake_wallet
flutter pub get

- name: Install go and gomobile
run: |
# install go > 1.23:
wget https://go.dev/dl/go1.23.1.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.23.1.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:~/go/bin
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init

- name: Build mwebd
run: |
# paths are reset after each step, so we need to set them again:
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:~/go/bin
# build mwebd:
cd /opt/android/cake_wallet/scripts/android/
./build_mwebd.sh --dont-install

- name: Generate localization
run: |
cd /opt/android/cake_wallet
Expand Down
Binary file added assets/images/mweb_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion cw_bitcoin/lib/bitcoin_mnemonic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:cw_core/sec_random_native.dart';
import 'package:cw_core/utils/text_normalizer.dart';

const segwit = '100';
const mweb = 'eb';
final wordlist = englishWordlist;

double logBase(num x, num base) => log(x) / log(base);
Expand Down Expand Up @@ -125,7 +126,7 @@ Future<Uint8List> mnemonicToSeedBytes(String mnemonic,
return Uint8List.fromList(bytes);
}

bool matchesAnyPrefix(String mnemonic) => prefixMatches(mnemonic, [segwit]).any((el) => el);
bool matchesAnyPrefix(String mnemonic) => prefixMatches(mnemonic, [segwit, mweb]).any((el) => el);

bool validateMnemonic(String mnemonic, {String prefix = segwit}) {
try {
Expand Down
10 changes: 10 additions & 0 deletions cw_bitcoin/lib/bitcoin_receive_page_option.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class BitcoinReceivePageOption implements ReceivePageOption {
static const p2tr = BitcoinReceivePageOption._('Taproot (P2TR)');
static const p2wsh = BitcoinReceivePageOption._('Segwit (P2WSH)');
static const p2pkh = BitcoinReceivePageOption._('Legacy (P2PKH)');
static const mweb = BitcoinReceivePageOption._('MWEB');

static const silent_payments = BitcoinReceivePageOption._('Silent Payments');

Expand All @@ -27,6 +28,11 @@ class BitcoinReceivePageOption implements ReceivePageOption {
BitcoinReceivePageOption.p2pkh
];

static const allLitecoin = [
BitcoinReceivePageOption.p2wpkh,
BitcoinReceivePageOption.mweb
];

BitcoinAddressType toType() {
switch (this) {
case BitcoinReceivePageOption.p2tr:
Expand All @@ -39,6 +45,8 @@ class BitcoinReceivePageOption implements ReceivePageOption {
return P2shAddressType.p2wpkhInP2sh;
case BitcoinReceivePageOption.silent_payments:
return SilentPaymentsAddresType.p2sp;
case BitcoinReceivePageOption.mweb:
return SegwitAddresType.mweb;
case BitcoinReceivePageOption.p2wpkh:
default:
return SegwitAddresType.p2wpkh;
Expand All @@ -51,6 +59,8 @@ class BitcoinReceivePageOption implements ReceivePageOption {
return BitcoinReceivePageOption.p2tr;
case SegwitAddresType.p2wsh:
return BitcoinReceivePageOption.p2wsh;
case SegwitAddresType.mweb:
return BitcoinReceivePageOption.mweb;
case P2pkhAddressType.p2pkh:
return BitcoinReceivePageOption.p2pkh;
case P2shAddressType.p2wpkhInP2sh:
Expand Down
2 changes: 1 addition & 1 deletion cw_bitcoin/lib/bitcoin_transaction_priority.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class LitecoinTransactionPriority extends BitcoinTransactionPriority {
}

@override
String get units => 'Latoshi';
String get units => 'Litoshi';

@override
String toString() {
Expand Down
6 changes: 6 additions & 0 deletions cw_bitcoin/lib/electrum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,12 @@ class ElectrumClient {

void _methodHandler({required String method, required Map<String, dynamic> request}) {
switch (method) {
case 'blockchain.headers.subscribe':
final params = request['params'] as List<dynamic>;
final id = 'blockchain.headers.subscribe';

_tasks[id]?.subject?.add(params.last);
break;
case 'blockchain.scripthash.subscribe':
final params = request['params'] as List<dynamic>;
final scripthash = params.first as String?;
Expand Down
31 changes: 28 additions & 3 deletions cw_bitcoin/lib/electrum_balance.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ class ElectrumBalance extends Balance {
required this.confirmed,
required this.unconfirmed,
required this.frozen,
}) : super(confirmed, unconfirmed);
this.secondConfirmed = 0,
this.secondUnconfirmed = 0,
}) : super(
confirmed,
unconfirmed,
secondAvailable: secondConfirmed,
secondAdditional: secondUnconfirmed,
);

static ElectrumBalance? fromJSON(String? jsonSource) {
if (jsonSource == null) {
Expand All @@ -25,6 +32,8 @@ class ElectrumBalance extends Balance {
int confirmed;
int unconfirmed;
final int frozen;
int secondConfirmed = 0;
int secondUnconfirmed = 0;

@override
String get formattedAvailableBalance => bitcoinAmountToString(amount: confirmed - frozen);
Expand All @@ -38,6 +47,22 @@ class ElectrumBalance extends Balance {
return frozenFormatted == '0.0' ? '' : frozenFormatted;
}

String toJSON() =>
json.encode({'confirmed': confirmed, 'unconfirmed': unconfirmed, 'frozen': frozen});
@override
String get formattedSecondAvailableBalance => bitcoinAmountToString(amount: secondConfirmed ?? 0);

@override
String get formattedSecondAdditionalBalance =>
bitcoinAmountToString(amount: secondUnconfirmed ?? 0);

@override
String get formattedFullAvailableBalance =>
bitcoinAmountToString(amount: confirmed + (secondConfirmed ?? 0) - frozen);

String toJSON() => json.encode({
'confirmed': confirmed,
'unconfirmed': unconfirmed,
'frozen': frozen,
'secondConfirmed': secondConfirmed,
'secondUnconfirmed': secondUnconfirmed
});
}
Loading
Loading