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

Cw 565 sign messages #1378

Merged
merged 124 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from 117 commits
Commits
Show all changes
124 commits
Select commit Hold shift + click to select a range
0043a91
version bump to 3.13.9, auth working on mac
fossephate Apr 5, 2024
e7f55ed
bump flutter version in workflow file
fossephate Apr 5, 2024
99fcd3a
workflow fix
fossephate Apr 5, 2024
f004fb1
test fix
fossephate Apr 5, 2024
91752bd
downgrade flutter version
fossephate Apr 5, 2024
91fc247
test fix
fossephate Apr 5, 2024
37c9f90
test fix
fossephate Apr 5, 2024
8cfca29
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Apr 8, 2024
223f167
update gradle version
fossephate Apr 8, 2024
1adf9ae
start working on ui for message signing
fossephate Apr 8, 2024
d4e3e50
updates
fossephate Apr 9, 2024
82dc036
sign working for a few wallet types
fossephate Apr 9, 2024
ff0bdf8
updates & verification for electrum currencies
fossephate Apr 9, 2024
f341f7e
nano support
fossephate Apr 9, 2024
00befca
sign/verify working on eth, bitcoin broken
fossephate Apr 10, 2024
73a995e
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Apr 10, 2024
3463109
update translations
fossephate Apr 10, 2024
04fccb8
Implement Verify Message for Monero
konstantinullrich Apr 11, 2024
2fe5236
save [skip ci]
fossephate Apr 11, 2024
75c4520
pub key extraction working
fossephate Apr 12, 2024
827c109
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Apr 12, 2024
2e9f688
fixes for electrum signing
fossephate Apr 12, 2024
5eee920
verify working for solana!
fossephate Apr 15, 2024
f5df81a
electrum still not working :( [skip ci]
fossephate Apr 15, 2024
70f2ac4
electrum messages working!
fossephate Apr 15, 2024
d817911
fixes for updated dart version, localization file updates
fossephate Apr 16, 2024
e358683
remove accidental inclusion
fossephate Apr 16, 2024
c84df39
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Apr 16, 2024
6fbbfce
missed some unimplemented throws
fossephate Apr 16, 2024
37d1644
Update res/values/strings_de.arb
fossephate Apr 17, 2024
5aa384c
Apply suggestions from code review
fossephate Apr 17, 2024
65ecb7c
review suggestions and updates [skip ci]
fossephate Apr 17, 2024
bdaf874
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Apr 17, 2024
2c10322
[skip ci] add polygon
fossephate Apr 17, 2024
4a32c7d
Merge branch 'CW-394-mac-auth' of https://github.com/cake-tech/cake_w…
fossephate Apr 17, 2024
428b7cc
[skip ci] merge mac-auth/update version
fossephate Apr 17, 2024
b08bac5
fix litecoin
fossephate Apr 18, 2024
08c9926
bio auth mac fix
fossephate Apr 18, 2024
6a93877
remove comment and change duration from 2 to 0
fossephate Apr 18, 2024
7737215
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Apr 18, 2024
f1910b5
cherry pick previous changes
fossephate Apr 18, 2024
dd486a2
litecoin fixes, sign form fixes, use new walletAddressPicker
fossephate Apr 18, 2024
94434c4
support accounts
fossephate Apr 18, 2024
34b37d9
verify messages working for monero
fossephate Apr 19, 2024
4fb5f8d
working sign and verify messages for nano
fossephate Apr 23, 2024
37dc4ed
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Apr 23, 2024
541e0f2
electrum signing working [skip ci]
fossephate Apr 23, 2024
2ac3587
additional nano fixes
fossephate Apr 23, 2024
843cff4
update translations
fossephate Apr 23, 2024
efc23c9
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Apr 24, 2024
c36e912
attempt to decode signatures with base64
fossephate Apr 24, 2024
46c46c3
workaround for secure storage bug on mac
fossephate Apr 25, 2024
3c05bae
bump version to 3.19.5 (because breez will need this version anyways)
fossephate Apr 25, 2024
1e46817
some code cleanup
fossephate Apr 25, 2024
56f88fd
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Apr 25, 2024
56232a1
some changess didn't get saved
fossephate Apr 25, 2024
aac44e4
just documenting the issue [skip ci]
OmarHatem28 Apr 26, 2024
10ad96d
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Apr 29, 2024
196d3cb
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 1, 2024
371cf5b
Merge branch 'main' into CW-394-mac-auth-2
fossephate May 3, 2024
ebfdcee
undo accidental removal + minor code cleanup
fossephate May 6, 2024
28f5dcc
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 6, 2024
d22700c
merge conflicts
fossephate May 6, 2024
65ed9f7
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 6, 2024
b84b761
Merge branch 'CW-394-mac-auth-2' of https://github.com/cake-tech/cake…
fossephate May 6, 2024
c126c5c
merge fixes [skip ci]
fossephate May 6, 2024
385b670
add tron support
fossephate May 6, 2024
11455a8
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 8, 2024
bb4eb46
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 8, 2024
64c08a1
[skip ci] Merge branch 'main' of https://github.com/cake-tech/cake_wa…
fossephate May 9, 2024
66194ac
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 9, 2024
a5f6378
[wip] fixing
fossephate May 9, 2024
68e20b2
remove duplicate references to electrum path for maintainability
fossephate May 9, 2024
3a5bf42
Merge pull request #1444 from cake-tech/sign-message-fixes
fossephate May 10, 2024
999058c
fixes
fossephate May 10, 2024
b25c176
Merge branch 'CW-565-sign-messages' of https://github.com/cake-tech/c…
fossephate May 10, 2024
045d3c9
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 10, 2024
7c895cc
minor fix
fossephate May 13, 2024
9746b1e
fixes
fossephate May 13, 2024
c33f676
undo debug comment
fossephate May 13, 2024
7d4c664
update migration for all electrum based wallets
fossephate May 13, 2024
3e09127
hotfixes
fossephate May 13, 2024
e24b6f2
copy over the rest of the fixes
fossephate May 13, 2024
459d994
Merge branch 'electrum_hotfixes' of https://github.com/cake-tech/cake…
fossephate May 13, 2024
2c12c2a
minor code cleanup [skip ci]
fossephate May 13, 2024
01d0154
Merge branch 'main' into electrum_hotfixes
fossephate May 16, 2024
99276fc
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 16, 2024
e501764
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 17, 2024
ac503ef
Merge branch 'main' into electrum_hotfixes
fossephate May 20, 2024
e59750b
[skip ci] Merge branch 'electrum_hotfixes' of https://github.com/cake…
fossephate May 20, 2024
89bacfc
updates
fossephate May 21, 2024
f567c6f
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 22, 2024
9d83339
electrum signing workinggit statusgit statusgit statusgit status!
fossephate May 22, 2024
5db0b75
copy same fixes for litecoin
fossephate May 22, 2024
a409c8a
litecoin fixes
fossephate May 23, 2024
d3ec746
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 23, 2024
c7889ae
add v to litecoin signatures
fossephate May 23, 2024
bbe623b
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 28, 2024
37c7559
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate May 29, 2024
3f92fe9
fix dependencies
fossephate May 29, 2024
f9d009a
fix bitcoin_base version
fossephate May 29, 2024
2f5bdbd
merge fix
fossephate May 30, 2024
2010490
dep override
fossephate May 30, 2024
95a98ae
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
OmarHatem28 Jun 26, 2024
0f44b70
fix conflicts with main
OmarHatem28 Jun 26, 2024
4415fd2
Merge branch 'main' into CW-565-sign-messages
OmarHatem28 Jul 2, 2024
07be199
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 5, 2024
105257b
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 12, 2024
f41e225
trial fix for android build
OmarHatem28 Aug 12, 2024
2f506b6
Merge remote-tracking branch 'origin/CW-565-sign-messages' into CW-56…
OmarHatem28 Aug 12, 2024
eb9e73d
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 13, 2024
d6604b1
fixes
fossephate Aug 13, 2024
713423e
fix
fossephate Aug 13, 2024
cc5cf7a
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 13, 2024
fc51ed5
dep fix, should build
fossephate Aug 13, 2024
925686a
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 13, 2024
2ea51aa
fix signing for bitcoin cash
fossephate Aug 13, 2024
6addbab
[skip ci] minor code cleanup
fossephate Aug 14, 2024
b14aa52
[skip ci] minor code cleanup 2
fossephate Aug 14, 2024
37bc071
forgot wonero, various other fixes
fossephate Aug 15, 2024
cc12fd7
more fixes
fossephate Aug 15, 2024
86cea47
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 15, 2024
167181f
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into …
fossephate Aug 16, 2024
1a2d7b3
fix solana (untested)
fossephate Aug 16, 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
73 changes: 67 additions & 6 deletions cw_bitcoin/lib/electrum_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart';
import 'package:rxdart/subjects.dart';
import 'package:http/http.dart' as http;
import 'package:sp_scanner/sp_scanner.dart';

part 'electrum_wallet.g.dart';
Expand Down Expand Up @@ -132,6 +133,7 @@ abstract class ElectrumWalletBase
final String? _mnemonic;

Bip32Slip10Secp256k1 get hd => accountHD.childKey(Bip32KeyIndex(0));
Bip32Slip10Secp256k1 get sideHd => accountHD.childKey(Bip32KeyIndex(1));

final EncryptionFileUtils encryptionFileUtils;
final String? passphrase;
Expand Down Expand Up @@ -591,7 +593,7 @@ abstract class ElectrumWalletBase
}

final derivationPath =
"${_hardenedDerivationPath(walletInfo.derivationInfo?.derivationPath ?? "m/0'")}"
"${_hardenedDerivationPath(walletInfo.derivationInfo?.derivationPath ?? electrum_path)}"
"/${utx.bitcoinAddressRecord.isHidden ? "1" : "0"}"
"/${utx.bitcoinAddressRecord.index}";
publicKeys[address.pubKeyHash()] = PublicKeyWithDerivationPath(pubKeyHex, derivationPath);
Expand Down Expand Up @@ -1851,11 +1853,70 @@ abstract class ElectrumWalletBase
? walletAddresses.allAddresses.firstWhere((element) => element.address == address).index
: null;
final HD = index == null ? hd : hd.childKey(Bip32KeyIndex(index));
final priv = ECPrivate.fromWif(
WifEncoder.encode(HD.privateKey.raw, netVer: network.wifNetVer),
netVersion: network.wifNetVer,
);
return priv.signMessage(StringUtils.encode(message));
final priv = ECPrivate.fromHex(HD.privateKey.privKey.toHex());

String messagePrefix = '\x18Bitcoin Signed Message:\n';
final hexEncoded = priv.signMessage(utf8.encode(message), messagePrefix: messagePrefix);
final decodedSig = hex.decode(hexEncoded);
return base64Encode(decodedSig);
}

@override
Future<bool> verifyMessage(String message, String signature, {String? address = null}) async {
if (address == null) {
return false;
}

List<int> sigDecodedBytes = [];

if (signature.endsWith('=')) {
sigDecodedBytes = base64.decode(signature);
} else {
sigDecodedBytes = hex.decode(signature);
}

if (sigDecodedBytes.length != 64 && sigDecodedBytes.length != 65) {
throw ArgumentException(
"signature must be 64 bytes without recover-id or 65 bytes with recover-id");
}

String messagePrefix = '\x18Bitcoin Signed Message:\n';
final messageHash = QuickCrypto.sha256Hash(
fossephate marked this conversation as resolved.
Show resolved Hide resolved
BitcoinSignerUtils.magicMessage(utf8.encode(message), messagePrefix));

List<int> correctSignature =
sigDecodedBytes.length == 65 ? sigDecodedBytes.sublist(1) : List.from(sigDecodedBytes);
List<int> rBytes = correctSignature.sublist(0, 32);
List<int> sBytes = correctSignature.sublist(32);
final sig = ECDSASignature(BigintUtils.fromBytes(rBytes), BigintUtils.fromBytes(sBytes));

List<int> possibleRecoverIds = [0, 1];

final baseAddress = addressTypeFromStr(address, network);

for (int recoveryId in possibleRecoverIds) {
final pubKey = sig.recoverPublicKey(messageHash, Curves.generatorSecp256k1, recoveryId);

final recoveredPub = ECPublic.fromBytes(pubKey!.toBytes());

String? recoveredAddress;

if (baseAddress is P2pkAddress) {
recoveredAddress = recoveredPub.toP2pkAddress().toAddress(network);
} else if (baseAddress is P2pkhAddress) {
recoveredAddress = recoveredPub.toP2pkhAddress().toAddress(network);
} else if (baseAddress is P2wshAddress) {
recoveredAddress = recoveredPub.toP2wshAddress().toAddress(network);
} else if (baseAddress is P2wpkhAddress) {
recoveredAddress = recoveredPub.toP2wpkhAddress().toAddress(network);
}

if (recoveredAddress == address) {
return true;
}
}

return false;
}

Future<void> _setInitialHeight() async {
Expand Down
131 changes: 130 additions & 1 deletion cw_bitcoin/lib/litecoin_wallet.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import 'package:bip39/bip39.dart' as bip39;
import 'dart:convert';

import 'package:bitcoin_base/bitcoin_base.dart';
import 'package:blockchain_utils/blockchain_utils.dart';
import 'package:blockchain_utils/signer/ecdsa_signing_key.dart';
import 'package:bip39/bip39.dart' as bip39;
import 'package:cw_bitcoin/bitcoin_address_record.dart';
import 'package:cw_bitcoin/bitcoin_mnemonic.dart';
import 'package:cw_bitcoin/bitcoin_transaction_priority.dart';
Expand All @@ -17,6 +20,9 @@ import 'package:cw_core/wallet_keys_file.dart';
import 'package:flutter/foundation.dart';
import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart';
import 'package:bitcoin_base/src/crypto/keypair/sign_utils.dart';
import 'package:pointycastle/ecc/api.dart';
import 'package:pointycastle/ecc/curves/secp256k1.dart';

part 'litecoin_wallet.g.dart';

Expand Down Expand Up @@ -167,4 +173,127 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {

return 0;
}

@override
Future<String> signMessage(String message, {String? address = null}) async {
final index = address != null
? walletAddresses.allAddresses.firstWhere((element) => element.address == address).index
: null;
final HD = index == null ? hd : hd.childKey(Bip32KeyIndex(index));
final priv = ECPrivate.fromHex(HD.privateKey.privKey.toHex());

final privateKey = ECDSAPrivateKey.fromBytes(
priv.toBytes(),
Curves.generatorSecp256k1,
);

final signature =
signLitecoinMessage(utf8.encode(message), privateKey: privateKey, bipPrive: priv.prive);

return base64Encode(signature);
}

List<int> _magicPrefix(List<int> message, List<int> messagePrefix) {
final encodeLength = IntUtils.encodeVarint(message.length);

return [...messagePrefix, ...encodeLength, ...message];
}

List<int> signLitecoinMessage(List<int> message,
{required ECDSAPrivateKey privateKey, required Bip32PrivateKey bipPrive}) {
String messagePrefix = '\x19Litecoin Signed Message:\n';
final messageHash = QuickCrypto.sha256Hash(magicMessage(message, messagePrefix));
final signingKey = EcdsaSigningKey(privateKey);
ECDSASignature ecdsaSign =
signingKey.signDigestDeterminstic(digest: messageHash, hashFunc: () => SHA256());
final n = Curves.generatorSecp256k1.order! >> 1;
BigInt newS;
if (ecdsaSign.s.compareTo(n) > 0) {
newS = Curves.generatorSecp256k1.order! - ecdsaSign.s;
} else {
newS = ecdsaSign.s;
}
final rawSig = ECDSASignature(ecdsaSign.r, newS);
final rawSigBytes = rawSig.toBytes(BitcoinSignerUtils.baselen);

final pub = bipPrive.publicKey;
final ECDomainParameters curve = ECCurve_secp256k1();
final point = curve.curve.decodePoint(pub.point.toBytes());

final rawSigEc = ECSignature(rawSig.r, rawSig.s);

final recId = SignUtils.findRecoveryId(
SignUtils.getHexString(messageHash, offset: 0, length: messageHash.length),
rawSigEc,
Uint8List.fromList(pub.uncompressed),
);

final v = recId + 27 + (point!.isCompressed ? 4 : 0);

final combined = Uint8List.fromList([v, ...rawSigBytes]);

return combined;
}

List<int> magicMessage(List<int> message, String messagePrefix) {
final prefixBytes = StringUtils.encode(messagePrefix);
final magic = _magicPrefix(message, prefixBytes);
return QuickCrypto.sha256Hash(magic);
}

@override
Future<bool> verifyMessage(String message, String signature, {String? address = null}) async {
if (address == null) {
return false;
}

List<int> sigDecodedBytes = [];

if (signature.endsWith('=')) {
sigDecodedBytes = base64.decode(signature);
} else {
sigDecodedBytes = hex.decode(signature);
}

if (sigDecodedBytes.length != 64 && sigDecodedBytes.length != 65) {
throw ArgumentException(
"litecoin signature must be 64 bytes without recover-id or 65 bytes with recover-id");
}

String messagePrefix = '\x19Litecoin Signed Message:\n';
final messageHash = QuickCrypto.sha256Hash(magicMessage(utf8.encode(message), messagePrefix));

List<int> correctSignature =
sigDecodedBytes.length == 65 ? sigDecodedBytes.sublist(1) : List.from(sigDecodedBytes);
List<int> rBytes = correctSignature.sublist(0, 32);
List<int> sBytes = correctSignature.sublist(32);
final sig = ECDSASignature(BigintUtils.fromBytes(rBytes), BigintUtils.fromBytes(sBytes));

List<int> possibleRecoverIds = [0, 1];

final baseAddress = addressTypeFromStr(address, network);

for (int recoveryId in possibleRecoverIds) {
final pubKey = sig.recoverPublicKey(messageHash, Curves.generatorSecp256k1, recoveryId);
final recoveredPub = ECPublic.fromBytes(pubKey!.toBytes());

String? recoveredAddress;

if (baseAddress is P2pkAddress) {
recoveredAddress = recoveredPub.toP2pkAddress().toAddress(network);
} else if (baseAddress is P2pkhAddress) {
recoveredAddress = recoveredPub.toP2pkhAddress().toAddress(network);
} else if (baseAddress is P2wshAddress) {
recoveredAddress = recoveredPub.toP2wshAddress().toAddress(network);
} else if (baseAddress is P2wpkhAddress) {
recoveredAddress = recoveredPub.toP2wpkhAddress().toAddress(network);
}

if (recoveredAddress == address) {
return true;
}
}

return false;
}
}
6 changes: 5 additions & 1 deletion cw_bitcoin/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies:
bitcoin_base:
git:
url: https://github.com/cake-tech/bitcoin_base
ref: cake-update-v4
ref: cake-update-v5
blockchain_utils:
git:
url: https://github.com/cake-tech/blockchain_utils
Expand Down Expand Up @@ -57,6 +57,10 @@ dependency_overrides:
url: https://github.com/cake-tech/ledger-flutter.git
ref: cake-v3
watcher: ^1.1.0
bitcoin_base:
git:
url: https://github.com/cake-tech/bitcoin_base
ref: cake-update-v5
fossephate marked this conversation as resolved.
Show resolved Hide resolved

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
11 changes: 6 additions & 5 deletions cw_bitcoin_cash/lib/src/bitcoin_cash_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,12 @@ abstract class BitcoinCashWalletBase extends ElectrumWallet with Store {

@override
Future<String> signMessage(String message, {String? address = null}) async {
final index = address != null
? walletAddresses.allAddresses
.firstWhere((element) => element.address == AddressUtils.toLegacyAddress(address))
.index
: null;
int? index;
try {
index = address != null
? walletAddresses.allAddresses.firstWhere((element) => element.address == address).index
: null;
} catch (_) {}
final HD = index == null ? hd : hd.childKey(Bip32KeyIndex(index));
final priv = ECPrivate.fromWif(
WifEncoder.encode(HD.privateKey.raw, netVer: network.wifNetVer),
Expand Down
6 changes: 5 additions & 1 deletion cw_bitcoin_cash/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies:
bitcoin_base:
git:
url: https://github.com/cake-tech/bitcoin_base
ref: cake-update-v4
ref: cake-update-v5
blockchain_utils:
git:
url: https://github.com/cake-tech/blockchain_utils
Expand All @@ -43,6 +43,10 @@ dev_dependencies:

dependency_overrides:
watcher: ^1.1.0
bitcoin_base:
git:
url: https://github.com/cake-tech/bitcoin_base
ref: cake-update-v5
fossephate marked this conversation as resolved.
Show resolved Hide resolved

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
37 changes: 37 additions & 0 deletions cw_core/lib/nano_block_info_response.dart
fossephate marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
class BlockContentsResponse {
String type;
String account;
String previous;
String representative;
String balance;
String link;
String linkAsAccount;
String signature;
String work;

BlockContentsResponse({
required this.type,
required this.account,
required this.previous,
required this.representative,
required this.balance,
required this.link,
required this.linkAsAccount,
required this.signature,
required this.work,
});

factory BlockContentsResponse.fromJson(Map<String, dynamic> json) {
return BlockContentsResponse(
type: json['type'] as String,
account: json['account'] as String,
previous: json['previous'] as String,
representative: json['representative'] as String,
balance: json['balance'] as String,
link: json['link'] as String,
linkAsAccount: json['link_as_account'] as String,
signature: json['signature'] as String,
work: json['work'] as String,
);
}
}
7 changes: 5 additions & 2 deletions cw_core/lib/wallet_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ abstract class WalletBase<BalanceType extends Balance, HistoryType extends Trans

int calculateEstimatedFee(TransactionPriority priority, int? amount);


// void fetchTransactionsAsync(
// void Function(TransactionType transaction) onTransactionLoaded,
// {void Function() onFinished});
Expand All @@ -92,7 +91,11 @@ abstract class WalletBase<BalanceType extends Balance, HistoryType extends Trans

Future<void> renameWalletFiles(String newWalletName);

Future<String> signMessage(String message, {String? address = null}) => throw UnimplementedError();
Future<String> signMessage(String message, {String? address = null}) =>
throw UnimplementedError();

Future<bool> verifyMessage(String message, String signature, {String? address = null}) =>
throw UnimplementedError();
fossephate marked this conversation as resolved.
Show resolved Hide resolved

bool? isTestnet;
}
Loading
Loading