org.tbk.electrum.bitcoinj.model.SimpleBitcoinjUtxos Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tbk-electrum-daemon-client-bitcoinj Show documentation
Show all versions of tbk-electrum-daemon-client-bitcoinj Show documentation
electrum daemon jsonrpc client bitcoinj extension package
The newest version!
package org.tbk.electrum.bitcoinj.model;
import com.google.common.collect.ImmutableList;
import lombok.Builder;
import lombok.Singular;
import lombok.Value;
import org.bitcoinj.core.Coin;
import java.util.Collections;
import java.util.List;
@Value
@Builder
public class SimpleBitcoinjUtxos implements BitcoinjUtxos {
public static BitcoinjUtxos empty() {
return SimpleBitcoinjUtxos.builder()
.utxos(Collections.emptyList())
.build();
}
@Singular("addUtxo")
List utxos;
@Override
public List getUtxos() {
return ImmutableList.copyOf(utxos);
}
@Override
public boolean isEmpty() {
return utxos.isEmpty();
}
@Override
public Coin getValue() {
return utxos.stream()
.map(BitcoinjUtxo::getValue)
.reduce(Coin.ZERO, Coin::add);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy