mirror of
https://github.com/sparrowwallet/hummingbird.git
synced 2024-12-26 10:06:45 +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
|
```java
|
||||||
RegistryType urRegistryType = ur.getRegistryType();
|
RegistryType urRegistryType = ur.getRegistryType();
|
||||||
if(urRegistryType.equals(RegistryType.CRYPTO_PSBT)) {
|
if(urRegistryType.equals(RegistryType.CRYPTO_PSBT)) {
|
||||||
CryptoPSBT cryptoPSBT = (CryptoPSBT)ur.decodeFromRegistry();
|
CryptoPSBT cryptoPSBT = (CryptoPSBT)ur.decodeFromRegistry();
|
||||||
|
UR cryptoPSBTUR = cryptoPSBT.toUR();
|
||||||
} else if(urRegistryType.equals(RegistryType.CRYPTO_ADDRESS)) {
|
} else if(urRegistryType.equals(RegistryType.CRYPTO_ADDRESS)) {
|
||||||
CryptoAddress cryptoAddress = (CryptoAddress)ur.decodeFromRegistry();
|
CryptoAddress cryptoAddress = (CryptoAddress)ur.decodeFromRegistry();
|
||||||
|
UR cryptoAddressUR = cryptoAddress.toUR();
|
||||||
} else if(urRegistryType.equals(RegistryType.CRYPTO_HDKEY)) {
|
} else if(urRegistryType.equals(RegistryType.CRYPTO_HDKEY)) {
|
||||||
CryptoHDKey cryptoHDKey = (CryptoHDKey)ur.decodeFromRegistry();
|
CryptoHDKey cryptoHDKey = (CryptoHDKey)ur.decodeFromRegistry();
|
||||||
|
UR cryptoHDKeyUR = cryptoHDKey.toUR();
|
||||||
} else if(urRegistryType.equals(RegistryType.CRYPTO_OUTPUT)) {
|
} else if(urRegistryType.equals(RegistryType.CRYPTO_OUTPUT)) {
|
||||||
CryptoOutput cryptoOutput = (CryptoOutput)ur.decodeFromRegistry();
|
CryptoOutput cryptoOutput = (CryptoOutput)ur.decodeFromRegistry();
|
||||||
|
UR cryptoOutputUR = cryptoOutput.toUR();
|
||||||
} else if(urRegistryType.equals(RegistryType.CRYPTO_ACCOUNT)) {
|
} else if(urRegistryType.equals(RegistryType.CRYPTO_ACCOUNT)) {
|
||||||
CryptoAccount cryptoAccount = (CryptoAccount)ur.decodeFromRegistry();
|
CryptoAccount cryptoAccount = (CryptoAccount)ur.decodeFromRegistry();
|
||||||
|
UR cryptoAccountUR = cryptoAccount.toUR();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,11 @@ public class CryptoCoinInfo extends RegistryItem {
|
||||||
this.network = network;
|
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() {
|
public Type getType() {
|
||||||
return type == null ? Type.BITCOIN : Type.values()[type];
|
return type == null ? Type.BITCOIN : Type.values()[type];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue