-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upgrade generated XDR definitions to Protocol 22 (#641)
- Loading branch information
Showing
52 changed files
with
2,879 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
// Automatically generated by xdrgen | ||
// DO NOT EDIT or your changes may be overwritten | ||
|
||
package org.stellar.sdk.xdr; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.stellar.sdk.Base64Factory; | ||
|
||
/** | ||
* ArchivalProof's original definition in the XDR file is: | ||
* | ||
* <pre> | ||
* struct ArchivalProof | ||
* { | ||
* uint32 epoch; // AST Subtree for this proof | ||
* | ||
* union switch (ArchivalProofType t) | ||
* { | ||
* case EXISTENCE: | ||
* NonexistenceProofBody nonexistenceProof; | ||
* case NONEXISTENCE: | ||
* ExistenceProofBody existenceProof; | ||
* } body; | ||
* }; | ||
* </pre> | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder(toBuilder = true) | ||
public class ArchivalProof implements XdrElement { | ||
private Uint32 epoch; | ||
private ArchivalProofBody body; | ||
|
||
public void encode(XdrDataOutputStream stream) throws IOException { | ||
epoch.encode(stream); | ||
body.encode(stream); | ||
} | ||
|
||
public static ArchivalProof decode(XdrDataInputStream stream) throws IOException { | ||
ArchivalProof decodedArchivalProof = new ArchivalProof(); | ||
decodedArchivalProof.epoch = Uint32.decode(stream); | ||
decodedArchivalProof.body = ArchivalProofBody.decode(stream); | ||
return decodedArchivalProof; | ||
} | ||
|
||
public static ArchivalProof fromXdrBase64(String xdr) throws IOException { | ||
byte[] bytes = Base64Factory.getInstance().decode(xdr); | ||
return fromXdrByteArray(bytes); | ||
} | ||
|
||
public static ArchivalProof fromXdrByteArray(byte[] xdr) throws IOException { | ||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); | ||
XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); | ||
return decode(xdrDataInputStream); | ||
} | ||
|
||
/** | ||
* ArchivalProofBody's original definition in the XDR file is: | ||
* | ||
* <pre> | ||
* union switch (ArchivalProofType t) | ||
* { | ||
* case EXISTENCE: | ||
* NonexistenceProofBody nonexistenceProof; | ||
* case NONEXISTENCE: | ||
* ExistenceProofBody existenceProof; | ||
* } | ||
* </pre> | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder(toBuilder = true) | ||
public static class ArchivalProofBody implements XdrElement { | ||
private ArchivalProofType discriminant; | ||
private NonexistenceProofBody nonexistenceProof; | ||
private ExistenceProofBody existenceProof; | ||
|
||
public void encode(XdrDataOutputStream stream) throws IOException { | ||
stream.writeInt(discriminant.getValue()); | ||
switch (discriminant) { | ||
case EXISTENCE: | ||
nonexistenceProof.encode(stream); | ||
break; | ||
case NONEXISTENCE: | ||
existenceProof.encode(stream); | ||
break; | ||
} | ||
} | ||
|
||
public static ArchivalProofBody decode(XdrDataInputStream stream) throws IOException { | ||
ArchivalProofBody decodedArchivalProofBody = new ArchivalProofBody(); | ||
ArchivalProofType discriminant = ArchivalProofType.decode(stream); | ||
decodedArchivalProofBody.setDiscriminant(discriminant); | ||
switch (decodedArchivalProofBody.getDiscriminant()) { | ||
case EXISTENCE: | ||
decodedArchivalProofBody.nonexistenceProof = NonexistenceProofBody.decode(stream); | ||
break; | ||
case NONEXISTENCE: | ||
decodedArchivalProofBody.existenceProof = ExistenceProofBody.decode(stream); | ||
break; | ||
} | ||
return decodedArchivalProofBody; | ||
} | ||
|
||
public static ArchivalProofBody fromXdrBase64(String xdr) throws IOException { | ||
byte[] bytes = Base64Factory.getInstance().decode(xdr); | ||
return fromXdrByteArray(bytes); | ||
} | ||
|
||
public static ArchivalProofBody fromXdrByteArray(byte[] xdr) throws IOException { | ||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); | ||
XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); | ||
return decode(xdrDataInputStream); | ||
} | ||
} | ||
} |
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 @@ | ||
// Automatically generated by xdrgen | ||
// DO NOT EDIT or your changes may be overwritten | ||
|
||
package org.stellar.sdk.xdr; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.stellar.sdk.Base64Factory; | ||
|
||
/** | ||
* ArchivalProofNode's original definition in the XDR file is: | ||
* | ||
* <pre> | ||
* struct ArchivalProofNode | ||
* { | ||
* uint32 index; | ||
* Hash hash; | ||
* }; | ||
* </pre> | ||
*/ | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder(toBuilder = true) | ||
public class ArchivalProofNode implements XdrElement { | ||
private Uint32 index; | ||
private Hash hash; | ||
|
||
public void encode(XdrDataOutputStream stream) throws IOException { | ||
index.encode(stream); | ||
hash.encode(stream); | ||
} | ||
|
||
public static ArchivalProofNode decode(XdrDataInputStream stream) throws IOException { | ||
ArchivalProofNode decodedArchivalProofNode = new ArchivalProofNode(); | ||
decodedArchivalProofNode.index = Uint32.decode(stream); | ||
decodedArchivalProofNode.hash = Hash.decode(stream); | ||
return decodedArchivalProofNode; | ||
} | ||
|
||
public static ArchivalProofNode fromXdrBase64(String xdr) throws IOException { | ||
byte[] bytes = Base64Factory.getInstance().decode(xdr); | ||
return fromXdrByteArray(bytes); | ||
} | ||
|
||
public static ArchivalProofNode fromXdrByteArray(byte[] xdr) throws IOException { | ||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); | ||
XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); | ||
return decode(xdrDataInputStream); | ||
} | ||
} |
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,61 @@ | ||
// Automatically generated by xdrgen | ||
// DO NOT EDIT or your changes may be overwritten | ||
|
||
package org.stellar.sdk.xdr; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import org.stellar.sdk.Base64Factory; | ||
|
||
/** | ||
* ArchivalProofType's original definition in the XDR file is: | ||
* | ||
* <pre> | ||
* enum ArchivalProofType | ||
* { | ||
* EXISTENCE = 0, | ||
* NONEXISTENCE = 1 | ||
* }; | ||
* </pre> | ||
*/ | ||
public enum ArchivalProofType implements XdrElement { | ||
EXISTENCE(0), | ||
NONEXISTENCE(1); | ||
|
||
private final int value; | ||
|
||
ArchivalProofType(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
public static ArchivalProofType decode(XdrDataInputStream stream) throws IOException { | ||
int value = stream.readInt(); | ||
switch (value) { | ||
case 0: | ||
return EXISTENCE; | ||
case 1: | ||
return NONEXISTENCE; | ||
default: | ||
throw new IllegalArgumentException("Unknown enum value: " + value); | ||
} | ||
} | ||
|
||
public void encode(XdrDataOutputStream stream) throws IOException { | ||
stream.writeInt(value); | ||
} | ||
|
||
public static ArchivalProofType fromXdrBase64(String xdr) throws IOException { | ||
byte[] bytes = Base64Factory.getInstance().decode(xdr); | ||
return fromXdrByteArray(bytes); | ||
} | ||
|
||
public static ArchivalProofType fromXdrByteArray(byte[] xdr) throws IOException { | ||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); | ||
XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); | ||
return decode(xdrDataInputStream); | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/org/stellar/sdk/xdr/BinaryFuseFilterType.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,65 @@ | ||
// Automatically generated by xdrgen | ||
// DO NOT EDIT or your changes may be overwritten | ||
|
||
package org.stellar.sdk.xdr; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import org.stellar.sdk.Base64Factory; | ||
|
||
/** | ||
* BinaryFuseFilterType's original definition in the XDR file is: | ||
* | ||
* <pre> | ||
* enum BinaryFuseFilterType | ||
* { | ||
* BINARY_FUSE_FILTER_8_BIT = 0, | ||
* BINARY_FUSE_FILTER_16_BIT = 1, | ||
* BINARY_FUSE_FILTER_32_BIT = 2 | ||
* }; | ||
* </pre> | ||
*/ | ||
public enum BinaryFuseFilterType implements XdrElement { | ||
BINARY_FUSE_FILTER_8_BIT(0), | ||
BINARY_FUSE_FILTER_16_BIT(1), | ||
BINARY_FUSE_FILTER_32_BIT(2); | ||
|
||
private final int value; | ||
|
||
BinaryFuseFilterType(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
public static BinaryFuseFilterType decode(XdrDataInputStream stream) throws IOException { | ||
int value = stream.readInt(); | ||
switch (value) { | ||
case 0: | ||
return BINARY_FUSE_FILTER_8_BIT; | ||
case 1: | ||
return BINARY_FUSE_FILTER_16_BIT; | ||
case 2: | ||
return BINARY_FUSE_FILTER_32_BIT; | ||
default: | ||
throw new IllegalArgumentException("Unknown enum value: " + value); | ||
} | ||
} | ||
|
||
public void encode(XdrDataOutputStream stream) throws IOException { | ||
stream.writeInt(value); | ||
} | ||
|
||
public static BinaryFuseFilterType fromXdrBase64(String xdr) throws IOException { | ||
byte[] bytes = Base64Factory.getInstance().decode(xdr); | ||
return fromXdrByteArray(bytes); | ||
} | ||
|
||
public static BinaryFuseFilterType fromXdrByteArray(byte[] xdr) throws IOException { | ||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); | ||
XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); | ||
return decode(xdrDataInputStream); | ||
} | ||
} |
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,65 @@ | ||
// Automatically generated by xdrgen | ||
// DO NOT EDIT or your changes may be overwritten | ||
|
||
package org.stellar.sdk.xdr; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import org.stellar.sdk.Base64Factory; | ||
|
||
/** | ||
* BucketListType's original definition in the XDR file is: | ||
* | ||
* <pre> | ||
* enum BucketListType | ||
* { | ||
* LIVE = 0, | ||
* HOT_ARCHIVE = 1, | ||
* COLD_ARCHIVE = 2 | ||
* }; | ||
* </pre> | ||
*/ | ||
public enum BucketListType implements XdrElement { | ||
LIVE(0), | ||
HOT_ARCHIVE(1), | ||
COLD_ARCHIVE(2); | ||
|
||
private final int value; | ||
|
||
BucketListType(int value) { | ||
this.value = value; | ||
} | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
public static BucketListType decode(XdrDataInputStream stream) throws IOException { | ||
int value = stream.readInt(); | ||
switch (value) { | ||
case 0: | ||
return LIVE; | ||
case 1: | ||
return HOT_ARCHIVE; | ||
case 2: | ||
return COLD_ARCHIVE; | ||
default: | ||
throw new IllegalArgumentException("Unknown enum value: " + value); | ||
} | ||
} | ||
|
||
public void encode(XdrDataOutputStream stream) throws IOException { | ||
stream.writeInt(value); | ||
} | ||
|
||
public static BucketListType fromXdrBase64(String xdr) throws IOException { | ||
byte[] bytes = Base64Factory.getInstance().decode(xdr); | ||
return fromXdrByteArray(bytes); | ||
} | ||
|
||
public static BucketListType fromXdrByteArray(byte[] xdr) throws IOException { | ||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(xdr); | ||
XdrDataInputStream xdrDataInputStream = new XdrDataInputStream(byteArrayInputStream); | ||
return decode(xdrDataInputStream); | ||
} | ||
} |
Oops, something went wrong.