From 327f0490e25d48a18d5013c93d2283e0b4a6006b Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Tue, 13 Apr 2021 17:32:30 +0200 Subject: [PATCH] update readme --- README.md | 7 ++++++- .../sparrowwallet/hummingbird/registry/CryptoCoinInfo.java | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6813216..6d4ea4f 100644 --- a/README.md +++ b/README.md @@ -50,20 +50,25 @@ while(true) { } ``` -Hummingbird also includes a type registry to assist with decoding from CBOR to POJOs: +Hummingbird also includes a type registry to assist with encoding and decoding from CBOR to and from POJOs: ```java RegistryType urRegistryType = ur.getRegistryType(); if(urRegistryType.equals(RegistryType.CRYPTO_PSBT)) { CryptoPSBT cryptoPSBT = (CryptoPSBT)ur.decodeFromRegistry(); + UR cryptoPSBTUR = cryptoPSBT.toUR(); } else if(urRegistryType.equals(RegistryType.CRYPTO_ADDRESS)) { CryptoAddress cryptoAddress = (CryptoAddress)ur.decodeFromRegistry(); + UR cryptoAddressUR = cryptoAddress.toUR(); } else if(urRegistryType.equals(RegistryType.CRYPTO_HDKEY)) { CryptoHDKey cryptoHDKey = (CryptoHDKey)ur.decodeFromRegistry(); + UR cryptoHDKeyUR = cryptoHDKey.toUR(); } else if(urRegistryType.equals(RegistryType.CRYPTO_OUTPUT)) { CryptoOutput cryptoOutput = (CryptoOutput)ur.decodeFromRegistry(); + UR cryptoOutputUR = cryptoOutput.toUR(); } else if(urRegistryType.equals(RegistryType.CRYPTO_ACCOUNT)) { CryptoAccount cryptoAccount = (CryptoAccount)ur.decodeFromRegistry(); + UR cryptoAccountUR = cryptoAccount.toUR(); } ``` diff --git a/src/main/java/com/sparrowwallet/hummingbird/registry/CryptoCoinInfo.java b/src/main/java/com/sparrowwallet/hummingbird/registry/CryptoCoinInfo.java index 2ee44c1..a78591b 100644 --- a/src/main/java/com/sparrowwallet/hummingbird/registry/CryptoCoinInfo.java +++ b/src/main/java/com/sparrowwallet/hummingbird/registry/CryptoCoinInfo.java @@ -16,6 +16,11 @@ public class CryptoCoinInfo extends RegistryItem { this.network = network; } + public CryptoCoinInfo(Type type, Network network) { + this.type = (type != null ? type.ordinal() : null); + this.network = (network != null ? network.ordinal() : null); + } + public Type getType() { return type == null ? Type.BITCOIN : Type.values()[type]; }