-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
94 changed files
with
3,771 additions
and
2,986 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "inject.dart"] | ||
path = inject.dart | ||
url = https://github.com/google/inject.dart | ||
[submodule ".vendor/inject.dart"] | ||
path = .vendor/inject.dart | ||
url = https://github.com/google/inject.dart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'dart:convert'; | ||
|
||
class BitcoinAddressRecord { | ||
BitcoinAddressRecord(this.address, {this.label}); | ||
|
||
factory BitcoinAddressRecord.fromJSON(String jsonSource) { | ||
final decoded = json.decode(jsonSource) as Map; | ||
|
||
return BitcoinAddressRecord(decoded['address'] as String, | ||
label: decoded['label'] as String); | ||
} | ||
|
||
final String address; | ||
String label; | ||
|
||
String toJSON() => json.encode({'label': label, 'address': address}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,35 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:flutter/foundation.dart'; | ||
import 'package:cake_wallet/bitcoin/bitcoin_amount_format.dart'; | ||
import 'package:cake_wallet/src/domain/common/balance.dart'; | ||
|
||
class BitcoinBalance extends Balance { | ||
BitcoinBalance({@required this.confirmed, @required this.unconfirmed}); | ||
const BitcoinBalance({@required this.confirmed, @required this.unconfirmed}) : super(); | ||
|
||
factory BitcoinBalance.fromJSON(String jsonSource) { | ||
if (jsonSource == null) { | ||
return null; | ||
} | ||
|
||
final decoded = json.decode(jsonSource) as Map; | ||
|
||
return BitcoinBalance( | ||
confirmed: decoded['confirmed'] as int ?? 0, | ||
unconfirmed: decoded['unconfirmed'] as int ?? 0); | ||
} | ||
|
||
final int confirmed; | ||
final int unconfirmed; | ||
|
||
int get total => confirmed + unconfirmed; | ||
|
||
String get confirmedFormatted => bitcoinAmountToString(amount: confirmed); | ||
|
||
String get unconfirmedFormatted => bitcoinAmountToString(amount: unconfirmed); | ||
|
||
String get totalFormatted => bitcoinAmountToString(amount: total); | ||
|
||
String toJSON() => | ||
json.encode({'confirmed': confirmed, 'unconfirmed': unconfirmed}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.