bcs library

Classes

Bcs
BcsConfig
Configuration that is passed into BCS constructor.
BcsConfigTypes
BcsType<T, Input>
BcsTypeOptions<T, Input>
BcsWriterOptions
LegacyBCS
BCS implementation for Move types and few additional built-ins.
SerializedBcs<T, Input>
TypeEncodeDecode

Enums

Encoding

Mixins

TypeInterface
Set of methods that allows data encoding/decoding as standalone BCS value or a part of a composed structure/vector.

Constants

SUI_ADDRESS_LENGTH → const int

Functions

bigUIntBcsType({required String name, required int size, required String readMethod, required String writeMethod, required BigInt maxValue, void validate(BigInt)?}) BcsType<BigInt, dynamic>
compareBcsBytes(Uint8List a, Uint8List b) int
Lexicographic byte compare (byte-by-byte, then length) for BTreeMap key order.
decodeStr(String data, Encoding encoding) Uint8List
dynamicSizeBcsType<T, Input>({required String name, required T read(BcsReader), required Uint8List serialize(Input, {BcsWriterOptions? options}), void validate(Input)?}) BcsType<T, Input>
encodeStr(Uint8List data, Encoding encoding) String
fixedSizeBcsType<T, Input>({required String name, required int size, required T read(BcsReader), required void write(Input, BcsWriter), void validate(Input)?}) BcsType<T, Input>
fromB58(String str) Uint8List
fromB64(String str) Uint8List
fromHEX(String str) Uint8List
getRustConfig() BcsConfig
getSuiMoveConfig() BcsConfig
isSerializedBcs(Object? obj) bool
Whether obj is a SerializedBcs.
lazyBcsType<T, Input>(BcsType<T, Input> cb()) BcsType<T, Input>
registerPrimitives(LegacyBCS bcs) → void
Register the base set of primitive and common types. Is called in the BCS constructor automatically but can be ignored if the withPrimitives argument is not set.
stringLikeBcsType({required String name, required Uint8List toBytes(String), required String fromBytes(Uint8List), int? serializedSize(dynamic, {BcsWriterOptions? options})?, void validate(String)?}) BcsType<String, dynamic>
toB58(Uint8List buffer) String
toB64(Uint8List buffer) String
toBN(dynamic number) BigInt
Unify argument types by converting them to BigInt.
toHEX(Uint8List buffer) String
uIntBcsType({required String name, required int size, required String readMethod, required String writeMethod, required int maxValue, void validate(int)?}) BcsType<int, dynamic>

Typedefs

DecodeCb = dynamic Function(BcsReader reader, List<TypeName> typeParams, Map<String, TypeName> typeMap)
EncodeCb = BcsWriter Function(BcsWriter writer, dynamic data, List<TypeName> typeParams, Map<String, TypeName> typeMap)
EnumTypeDefinition = Map<String, TypeName>
Enum type definition. Used as input format in BcsConfig.types as well as an argument type for bcs.registerEnumType.
StructTypeDefinition = Map<String, TypeName>
Struct type definition. Used as input format in BcsConfig.types as well as an argument type for bcs.registerStructType.
TypeName = dynamic
Allows for array definitions for names.
ValidateCb = bool Function(dynamic data)