Skip to content

Commit

Permalink
feat:algin with v0.29.2
Browse files Browse the repository at this point in the history
Signed-off-by: grapebaba <[email protected]>
  • Loading branch information
GrapeBaBa committed Apr 12, 2023
1 parent ec25db1 commit 07d54f1
Show file tree
Hide file tree
Showing 37 changed files with 1,141 additions and 1,226 deletions.
68 changes: 68 additions & 0 deletions src/main/java/io/sui/bcsgen/Balance.java
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
);
}
}
}
77 changes: 77 additions & 0 deletions src/main/java/io/sui/bcsgen/Coin.java
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
);
}
}
}
68 changes: 68 additions & 0 deletions src/main/java/io/sui/bcsgen/GasCoin.java
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
);
}
}
}
Loading

0 comments on commit 07d54f1

Please sign in to comment.