mirror of
https://github.com/sparrowwallet/hummingbird.git
synced 2024-11-02 10:36:44 +00:00
update readme
This commit is contained in:
parent
bb5d5488ed
commit
327f0490e2
2 changed files with 11 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue