encode method
Encode values with ABI rules based on the ABI type schemes @return byte[] of ABI encoding @throws IllegalArgumentException if encoder cannot infer the type from obj
Implementation
@override
Uint8List encode(dynamic obj) {
if (obj is List<int> && obj.length == Address.PUBLIC_KEY_LENGTH) {
return AbiType.castToTupleType(byteLength(), TypeByte()).encode(obj);
} else if (obj is Address) {
return AbiType.castToTupleType(byteLength(), TypeByte())
.encode(obj.publicKey);
} else if (obj is String) {
final address = Address.fromAlgorandAddress(obj);
return AbiType.castToTupleType(byteLength(), TypeByte())
.encode(address.publicKey);
}
throw ArgumentError('Cannot infer type for uint value encode');
}