-
Notifications
You must be signed in to change notification settings - Fork 69
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
Showing
35 changed files
with
1,615 additions
and
403 deletions.
There are no files selected for viewing
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
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
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
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
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
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
55 changes: 55 additions & 0 deletions
55
src/main/java/com/algorand/algosdk/transaction/AppBoxReference.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,55 @@ | ||
package com.algorand.algosdk.transaction; | ||
|
||
import com.algorand.algosdk.util.BoxQueryEncoding; | ||
|
||
import java.util.Arrays; | ||
import java.util.Objects; | ||
|
||
public class AppBoxReference { | ||
// the app ID of the app this box belongs to. Instead of serializing this value, | ||
// it's used to calculate the appIdx for AppBoxReference. | ||
private final long appId; | ||
|
||
// the name of the box unique to the app it belongs to | ||
private final byte[] name; | ||
|
||
public AppBoxReference(long appId, byte[] name) { | ||
this.appId = appId; | ||
this.name = Arrays.copyOf(name, name.length); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
AppBoxReference that = (AppBoxReference) o; | ||
return appId == that.appId && Arrays.equals(name, that.name); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = Objects.hash(appId); | ||
result = 31 * result + Arrays.hashCode(name); | ||
return result; | ||
} | ||
|
||
public long getAppId() { | ||
return appId; | ||
} | ||
|
||
public byte[] getName() { | ||
return Arrays.copyOf(name, name.length); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "AppBoxReference{" + | ||
"appID=" + appId + | ||
", name=" + Arrays.toString(name) + | ||
'}'; | ||
} | ||
|
||
public String nameQueryEncoded() { | ||
return BoxQueryEncoding.encodeBytes(name); | ||
} | ||
} |
Oops, something went wrong.