mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-25 09:36:44 +00:00
add helper to construct payment from bitcoin uri
This commit is contained in:
parent
db9617ee10
commit
cc32285d58
1 changed files with 6 additions and 0 deletions
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue