-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: grapebaba <[email protected]>
- Loading branch information
Showing
37 changed files
with
1,141 additions
and
1,226 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package io.sui.bcsgen; | ||
|
||
|
||
public final class Balance { | ||
public final @com.novi.serde.Unsigned Long value; | ||
|
||
public Balance(@com.novi.serde.Unsigned Long value) { | ||
java.util.Objects.requireNonNull(value, "value must not be null"); | ||
this.value = value; | ||
} | ||
|
||
public void serialize(com.novi.serde.Serializer serializer) throws com.novi.serde.SerializationError { | ||
serializer.increase_container_depth(); | ||
serializer.serialize_u64(value); | ||
serializer.decrease_container_depth(); | ||
} | ||
|
||
public byte[] bcsSerialize() throws com.novi.serde.SerializationError { | ||
com.novi.serde.Serializer serializer = new com.novi.bcs.BcsSerializer(); | ||
serialize(serializer); | ||
return serializer.get_bytes(); | ||
} | ||
|
||
public static Balance deserialize(com.novi.serde.Deserializer deserializer) throws com.novi.serde.DeserializationError { | ||
deserializer.increase_container_depth(); | ||
Builder builder = new Builder(); | ||
builder.value = deserializer.deserialize_u64(); | ||
deserializer.decrease_container_depth(); | ||
return builder.build(); | ||
} | ||
|
||
public static Balance bcsDeserialize(byte[] input) throws com.novi.serde.DeserializationError { | ||
if (input == null) { | ||
throw new com.novi.serde.DeserializationError("Cannot deserialize null array"); | ||
} | ||
com.novi.serde.Deserializer deserializer = new com.novi.bcs.BcsDeserializer(input); | ||
Balance value = deserialize(deserializer); | ||
if (deserializer.get_buffer_offset() < input.length) { | ||
throw new com.novi.serde.DeserializationError("Some input bytes were not read"); | ||
} | ||
return value; | ||
} | ||
|
||
public boolean equals(Object obj) { | ||
if (this == obj) return true; | ||
if (obj == null) return false; | ||
if (getClass() != obj.getClass()) return false; | ||
Balance other = (Balance) obj; | ||
if (!java.util.Objects.equals(this.value, other.value)) { return false; } | ||
return true; | ||
} | ||
|
||
public int hashCode() { | ||
int value = 7; | ||
value = 31 * value + (this.value != null ? this.value.hashCode() : 0); | ||
return value; | ||
} | ||
|
||
public static final class Builder { | ||
public @com.novi.serde.Unsigned Long value; | ||
|
||
public Balance build() { | ||
return new Balance( | ||
value | ||
); | ||
} | ||
} | ||
} |
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,77 @@ | ||
package io.sui.bcsgen; | ||
|
||
|
||
public final class Coin { | ||
public final UID id; | ||
public final Balance balance; | ||
|
||
public Coin(UID id, Balance balance) { | ||
java.util.Objects.requireNonNull(id, "id must not be null"); | ||
java.util.Objects.requireNonNull(balance, "balance must not be null"); | ||
this.id = id; | ||
this.balance = balance; | ||
} | ||
|
||
public void serialize(com.novi.serde.Serializer serializer) throws com.novi.serde.SerializationError { | ||
serializer.increase_container_depth(); | ||
id.serialize(serializer); | ||
balance.serialize(serializer); | ||
serializer.decrease_container_depth(); | ||
} | ||
|
||
public byte[] bcsSerialize() throws com.novi.serde.SerializationError { | ||
com.novi.serde.Serializer serializer = new com.novi.bcs.BcsSerializer(); | ||
serialize(serializer); | ||
return serializer.get_bytes(); | ||
} | ||
|
||
public static Coin deserialize(com.novi.serde.Deserializer deserializer) throws com.novi.serde.DeserializationError { | ||
deserializer.increase_container_depth(); | ||
Builder builder = new Builder(); | ||
builder.id = UID.deserialize(deserializer); | ||
builder.balance = Balance.deserialize(deserializer); | ||
deserializer.decrease_container_depth(); | ||
return builder.build(); | ||
} | ||
|
||
public static Coin bcsDeserialize(byte[] input) throws com.novi.serde.DeserializationError { | ||
if (input == null) { | ||
throw new com.novi.serde.DeserializationError("Cannot deserialize null array"); | ||
} | ||
com.novi.serde.Deserializer deserializer = new com.novi.bcs.BcsDeserializer(input); | ||
Coin value = deserialize(deserializer); | ||
if (deserializer.get_buffer_offset() < input.length) { | ||
throw new com.novi.serde.DeserializationError("Some input bytes were not read"); | ||
} | ||
return value; | ||
} | ||
|
||
public boolean equals(Object obj) { | ||
if (this == obj) return true; | ||
if (obj == null) return false; | ||
if (getClass() != obj.getClass()) return false; | ||
Coin other = (Coin) obj; | ||
if (!java.util.Objects.equals(this.id, other.id)) { return false; } | ||
if (!java.util.Objects.equals(this.balance, other.balance)) { return false; } | ||
return true; | ||
} | ||
|
||
public int hashCode() { | ||
int value = 7; | ||
value = 31 * value + (this.id != null ? this.id.hashCode() : 0); | ||
value = 31 * value + (this.balance != null ? this.balance.hashCode() : 0); | ||
return value; | ||
} | ||
|
||
public static final class Builder { | ||
public UID id; | ||
public Balance balance; | ||
|
||
public Coin build() { | ||
return new Coin( | ||
id, | ||
balance | ||
); | ||
} | ||
} | ||
} |
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,68 @@ | ||
package io.sui.bcsgen; | ||
|
||
|
||
public final class GasCoin { | ||
public final Coin value; | ||
|
||
public GasCoin(Coin value) { | ||
java.util.Objects.requireNonNull(value, "value must not be null"); | ||
this.value = value; | ||
} | ||
|
||
public void serialize(com.novi.serde.Serializer serializer) throws com.novi.serde.SerializationError { | ||
serializer.increase_container_depth(); | ||
value.serialize(serializer); | ||
serializer.decrease_container_depth(); | ||
} | ||
|
||
public byte[] bcsSerialize() throws com.novi.serde.SerializationError { | ||
com.novi.serde.Serializer serializer = new com.novi.bcs.BcsSerializer(); | ||
serialize(serializer); | ||
return serializer.get_bytes(); | ||
} | ||
|
||
public static GasCoin deserialize(com.novi.serde.Deserializer deserializer) throws com.novi.serde.DeserializationError { | ||
deserializer.increase_container_depth(); | ||
Builder builder = new Builder(); | ||
builder.value = Coin.deserialize(deserializer); | ||
deserializer.decrease_container_depth(); | ||
return builder.build(); | ||
} | ||
|
||
public static GasCoin bcsDeserialize(byte[] input) throws com.novi.serde.DeserializationError { | ||
if (input == null) { | ||
throw new com.novi.serde.DeserializationError("Cannot deserialize null array"); | ||
} | ||
com.novi.serde.Deserializer deserializer = new com.novi.bcs.BcsDeserializer(input); | ||
GasCoin value = deserialize(deserializer); | ||
if (deserializer.get_buffer_offset() < input.length) { | ||
throw new com.novi.serde.DeserializationError("Some input bytes were not read"); | ||
} | ||
return value; | ||
} | ||
|
||
public boolean equals(Object obj) { | ||
if (this == obj) return true; | ||
if (obj == null) return false; | ||
if (getClass() != obj.getClass()) return false; | ||
GasCoin other = (GasCoin) obj; | ||
if (!java.util.Objects.equals(this.value, other.value)) { return false; } | ||
return true; | ||
} | ||
|
||
public int hashCode() { | ||
int value = 7; | ||
value = 31 * value + (this.value != null ? this.value.hashCode() : 0); | ||
return value; | ||
} | ||
|
||
public static final class Builder { | ||
public Coin value; | ||
|
||
public GasCoin build() { | ||
return new GasCoin( | ||
value | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.