mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
comment update
This commit is contained in:
parent
2495673f79
commit
3794b18ba6
1 changed files with 4 additions and 0 deletions
|
@ -310,6 +310,8 @@ abstract class CoinServiceAPI {
|
|||
|
||||
// Certain outputs return address as an array/list of strings like List<String> ["addresses"][0], some return it as a string like String ["address"]
|
||||
String? getAddress(dynamic output) {
|
||||
// Julian's code from https://github.com/cypherstack/stack_wallet/blob/35a8172d35f1b5cdbd22f0d56c4db02f795fd032/lib/services/coins/coin_paynym_extension.dart#L170 wins codegolf for this, I'd love to commit it now but need to retest this section ... should make unit tests for this case
|
||||
// final String? address = output["scriptPubKey"]?["addresses"]?[0] as String? ?? output["scriptPubKey"]?["address"] as String?;
|
||||
String? address;
|
||||
if (output.containsKey('scriptPubKey') as bool) {
|
||||
// Make sure the key exists before using it
|
||||
|
@ -330,6 +332,8 @@ abstract class CoinServiceAPI {
|
|||
|
||||
// Firo wants an array/list of address strings like List<String>
|
||||
List? getAddresses(dynamic output) {
|
||||
// Inspired by Julian's code as referenced above, need to test before committing
|
||||
// final List? addresses = output["scriptPubKey"]?["addresses"] as List? ?? [output["scriptPubKey"]?["address"]] as List?;
|
||||
List? addresses;
|
||||
if (output.containsKey('scriptPubKey') as bool) {
|
||||
if (output["scriptPubKey"].containsKey('addresses') as bool) {
|
||||
|
|
Loading…
Reference in a new issue