Updated on 2026-08-14
This commit is contained in:
parent
07bc724ecd
commit
75f19d41f4
278 changed files with 19571 additions and 206 deletions
40
app/src/main/java/org/stellar/sdk/MemoId.java
Normal file
40
app/src/main/java/org/stellar/sdk/MemoId.java
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package org.stellar.sdk;
|
||||
|
||||
import org.stellar.sdk.xdr.MemoType;
|
||||
import org.stellar.sdk.xdr.Uint64;
|
||||
|
||||
/**
|
||||
* Represents MEMO_ID.
|
||||
*/
|
||||
public class MemoId extends Memo {
|
||||
private long id;
|
||||
|
||||
public MemoId(long id) {
|
||||
if (Long.compareUnsigned(id, 0) < 0) {
|
||||
throw new IllegalArgumentException("id must be a positive number");
|
||||
}
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
org.stellar.sdk.xdr.Memo toXdr() {
|
||||
org.stellar.sdk.xdr.Memo memo = new org.stellar.sdk.xdr.Memo();
|
||||
memo.setDiscriminant(MemoType.MEMO_ID);
|
||||
Uint64 idXdr = new Uint64();
|
||||
idXdr.setUint64(id);
|
||||
memo.setId(idXdr);
|
||||
return memo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MemoId memoId = (MemoId) o;
|
||||
return id == memoId.id;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue