-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a43f29f
commit 4eec012
Showing
2 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
16 changes: 13 additions & 3 deletions
16
...ain/java/onlydust/com/marketplace/kernel/model/blockchain/stellar/StellarTransaction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
.../onlydust/com/marketplace/kernel/model/blockchain/stellar/StellarTransferTransaction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package onlydust.com.marketplace.kernel.model.blockchain.stellar; | ||
|
||
import lombok.*; | ||
import lombok.experimental.Accessors; | ||
import lombok.experimental.FieldDefaults; | ||
import onlydust.com.marketplace.kernel.model.blockchain.Blockchain.TransferTransaction; | ||
|
||
import java.math.BigDecimal; | ||
import java.time.ZonedDateTime; | ||
import java.util.Optional; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) | ||
@Getter | ||
@Accessors(fluent = true) | ||
@ToString | ||
public class StellarTransferTransaction extends StellarTransaction implements TransferTransaction { | ||
@NonNull | ||
StellarAccountId sender; | ||
@NonNull | ||
StellarAccountId recipient; | ||
@NonNull | ||
BigDecimal amount; | ||
StellarContractAddress contractAddress; | ||
|
||
public StellarTransferTransaction(final @NonNull Hash hash, final @NonNull ZonedDateTime timestamp, final @NonNull Status status, final @NonNull StellarAccountId sender, final @NonNull StellarAccountId recipient, final @NonNull BigDecimal amount, final StellarContractAddress contractAddress) { | ||
super(hash, timestamp, status); | ||
|
||
this.sender = sender; | ||
this.recipient = recipient; | ||
this.amount = amount; | ||
this.contractAddress = contractAddress; | ||
} | ||
|
||
@Override | ||
public String senderAddress() { | ||
return sender.toString(); | ||
} | ||
|
||
@Override | ||
public String recipientAddress() { | ||
return recipient.toString(); | ||
} | ||
|
||
@Override | ||
public Optional<String> contractAddress() { | ||
return Optional.ofNullable(contractAddress).map(StellarContractAddress::toString); | ||
} | ||
} |