LegacyBCS class
BCS implementation for Move types and few additional built-ins.
Constructors
- LegacyBCS(BcsConfig scheme)
- Construct a BCS instance with a prepared schema.
- LegacyBCS.fromBCS(LegacyBCS bcs)
-
factory
Properties
- counter ↔ int
-
Count temp keys to generate a new one when requested.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schema ↔ BcsConfig
-
Stored BcsConfig for the current instance of BCS.
getter/setter pair
-
types
↔ Map<
String, dynamic> -
Map of kind
TypeName => TypeInterface
. Holds all callbacks for (de)serialization of every registered type.getter/setter pair
Methods
-
de(
dynamic type, dynamic data, [Encoding? encoding]) → dynamic - Deserialize BCS into a Dart type.
-
getTypeInterface(
String type) → TypeInterface - Get a set of encoders/decoders for specific type. Mainly used to define custom type de/serialization logic.
-
hasType(
String type) → bool -
Check whether a
TypeInterface
has been loaded for atype
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseTypeName(
dynamic name) → (String, List) - Parse a type name and get the type's generics.
-
registerAddressType(
String name, int length, [Encoding encoding = Encoding.hex]) → LegacyBCS - Register an address type which is a sequence of U8s of specified length.
-
registerAlias(
String name, String forType) → LegacyBCS - Create an alias for a type. WARNING: this can potentially lead to recursion
-
registerEnumType(
dynamic typeName, EnumTypeDefinition variants) → LegacyBCS - Safe method to register custom enum type where each invariant holds the value of another type.
-
registerFixedArrayType(
String typeName) → LegacyBCS - Register custom fixed array type inside the bcs.
-
registerStructType(
dynamic typeName, StructTypeDefinition fields) → LegacyBCS - Safe method to register a custom Move struct. The first argument is a name of the struct which is only used on the FrontEnd and has no affect on serialization results, and the second is a struct description passed as an Object.
-
registerType(
dynamic typeName, EncodeCb encodeCb, DecodeCb decodeCb, [ValidateCb? validateCb]) → LegacyBCS - Method to register new types for BCS internal representation. For each registered type 2 callbacks must be specified and one is optional:
-
registerVectorType(
String typeName) → LegacyBCS - Register custom vector type inside the bcs.
-
ser(
dynamic type, dynamic data, [BcsWriterOptions? options]) → BcsWriter - Serialize data into bcs.
-
tempKey(
) → String - Name of the key to use for temporary struct definitions. Returns a temp key + index (for a case when multiple temp structs are processed).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited