add helper to construct payment from bitcoin uri

This commit is contained in:
Craig Raw 2021-05-06 14:20:58 +02:00
parent db9617ee10
commit cc32285d58

View file

@ -2,6 +2,7 @@ package com.sparrowwallet.drongo.uri;
import com.sparrowwallet.drongo.address.Address;
import com.sparrowwallet.drongo.address.InvalidAddressException;
import com.sparrowwallet.drongo.wallet.Payment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -325,6 +326,11 @@ public class BitcoinURI {
return builder.toString();
}
public Payment toPayment() {
long amount = getAmount() == null ? -1 : getAmount();
return new Payment(getAddress(), getLabel(), amount, false);
}
/**
* Constructs a new BitcoinURI from the given address.
*