use of com.novi.bcs.BcsSerializer in project starcoin-java by starcoinorg.
the class BcsSerializeHelper method serializeListToBytes.
@SneakyThrows
public static Bytes serializeListToBytes(List<String> list) {
List<Bytes> bytesList = list.stream().map(s -> serializeVectorU8ToBytes(s)).collect(Collectors.toList());
BcsSerializer s = new BcsSerializer();
s.serialize_len(bytesList.size());
for (Bytes item : bytesList) {
s.serialize_bytes(item);
}
byte[] bytes = s.get_bytes();
return Bytes.valueOf(bytes);
}
use of com.novi.bcs.BcsSerializer in project starcoin-java by starcoinorg.
the class BcsSerializeHelper method serializeU128ToBytes.
@SneakyThrows
public static Bytes serializeU128ToBytes(BigInteger v) {
BcsSerializer s = new BcsSerializer();
s.serialize_u128(v);
return Bytes.valueOf(s.get_bytes());
}
use of com.novi.bcs.BcsSerializer in project starcoin-java by starcoinorg.
the class BcsSerializeHelper method serializeU64ToBytes.
@SneakyThrows
public static Bytes serializeU64ToBytes(Long v) {
BcsSerializer s = new BcsSerializer();
s.serialize_u64(v);
return Bytes.valueOf(s.get_bytes());
}
use of com.novi.bcs.BcsSerializer in project starcoin-java by starcoinorg.
the class Helpers method encode_bool_argument.
private static Bytes encode_bool_argument(Boolean arg) {
try {
BcsSerializer s = new BcsSerializer();
s.serialize_bool(arg);
return Bytes.valueOf(s.get_bytes());
} catch (SerializationError e) {
throw new IllegalArgumentException("Unable to serialize argument of type bool");
}
}
use of com.novi.bcs.BcsSerializer in project starcoin-java by starcoinorg.
the class Helpers method encode_u8_argument.
private static Bytes encode_u8_argument(@Unsigned Byte arg) {
try {
BcsSerializer s = new BcsSerializer();
s.serialize_u8(arg);
return Bytes.valueOf(s.get_bytes());
} catch (SerializationError e) {
throw new IllegalArgumentException("Unable to serialize argument of type u8");
}
}
Aggregations