AbiSerializationProvider
class EosSharp::Core::Providers::AbiSerializationProvider
: public IAbiSerializationProviderSerialize / deserialize transaction and fields using a Abi schema https://developers.eos.io/eosio-home/docs/the-abi.
Summary
private Dictionary< string, Action< MemoryStream, object > > TypeWriters
private Dictionary< string, ReaderDelegate> TypeReaders
public AbiSerializationProvider( EosApi api)
Construct abi serialization provided using EOS api.
public AbiSerializationProvider()
Construct abi serialization provided using EOS api.
public async Task< byte[]> SerializePackedTransaction( Transaction trx)
Serialize transaction to packed asynchronously.
public byte[] SerializePackedTransaction( Transactiontrx, Dictionary< string, Abi > abiMap)
Serialize transaction to packed asynchronously.
public async Task< Transaction> DeserializePackedTransaction(string packtrx)
Deserialize packed transaction asynchronously.
public Abi DeserializePackedAbi(string packabi)
Deserialize packed abi.
public byte[] SerializeActionData( Core.Api.v1.Actionaction, Abi abi)
Serialize action to packed action data.
public Dictionary< string, object > DeserializeStructData(string structType, string dataHex, Abi abi)
Deserialize structure data as "Dictionary<string, object>".
public TStructData DeserializeStructData< TStructData >(string structType, string dataHex, Abi abi)
Deserialize structure data with generic TStructData type.
public TStructData DeserializeStructData< TStructData >(string structType, string dataHex, Abi abi, ref int readIndex)
Deserialize structure data with generic TStructData type.
public TStructData DeserializeStructData< TStructData >(string structType, byte[] data, Abi abi, ref int readIndex)
Deserialize structure data with generic TStructData type.
public Task< Abi GetTransactionAbis( Transaction trx)
Get abi schemas used in transaction.
public T DeserializeType< T >(string dataHex)
Deserialize type by encoded string data.
public T DeserializeType< T >(byte[] data)
Deserialize type by binary data.
public T DeserializeType< T >(byte[] data, ref int readIndex)
Deserialize type by binary data, ref readIndex.
public byte[] SerializeTypeData(string typeName, object value, Abi abi)
public byte[] SerializeTypeData(object value, AbiTypeabiType, Abi abi)
public byte[] SerializeStructData(object value, AbiStructabiStruct, Abi abi)
public byte[] Serialize(object value, string type)
#### Parameters
public T Deserialize< T >(byte[] value, string type)
#### Parameters
private delegate object ReaderDelegate(byte[] data, ref int readIndex)
private void WriteAction(MemoryStream ms, Core.Api.v1.Actionaction, Abi abi)
private void WriteAbiType(MemoryStream ms, object value, string type, Abi abi, bool isBinaryExtensionAllowed)
private void WriteAbiStruct(MemoryStream ms, object value, AbiStructabiStruct, Abi abi)
private void WriteAbiVariant(MemoryStream ms, object value, VariantabiVariant, Abi abi, bool isBinaryExtensionAllowed)
private string UnwrapTypeDef( Abi abi, string type)
private TSerializer GetTypeSerializerAndCache< TSerializer >(string type, Dictionary< string, TSerializer > typeSerializers, Abi abi)
private object ReadByte(byte[] data, ref int readIndex)
private object ReadInt16(byte[] data, ref int readIndex)
private object ReadUint16(byte[] data, ref int readIndex)
private object ReadInt32(byte[] data, ref int readIndex)
private object ReadUint32(byte[] data, ref int readIndex)
private object ReadInt64(byte[] data, ref int readIndex)
private object ReadUint64(byte[] data, ref int readIndex)
private object ReadInt128(byte[] data, ref int readIndex)
private object ReadUInt128(byte[] data, ref int readIndex)
private object ReadVarUint32(byte[] data, ref int readIndex)
private object ReadVarInt32(byte[] data, ref int readIndex)
private object ReadFloat32(byte[] data, ref int readIndex)
private object ReadFloat64(byte[] data, ref int readIndex)
private object ReadFloat128(byte[] data, ref int readIndex)
private object ReadBytes(byte[] data, ref int readIndex)
private object ReadBool(byte[] data, ref int readIndex)
private object ReadString(byte[] data, ref int readIndex)
private object ReadName(byte[] data, ref int readIndex)
private object ReadAsset(byte[] data, ref int readIndex)
private object ReadTimePoint(byte[] data, ref int readIndex)
private object ReadTimePointSec(byte[] data, ref int readIndex)
private object ReadBlockTimestampType(byte[] data, ref int readIndex)
private object ReadSymbolString(byte[] data, ref int readIndex)
private object ReadSymbolCode(byte[] data, ref int readIndex)
private object ReadChecksum160(byte[] data, ref int readIndex)
private object ReadChecksum256(byte[] data, ref int readIndex)
private object ReadChecksum512(byte[] data, ref int readIndex)
private object ReadPublicKey(byte[] data, ref int readIndex)
private object ReadPrivateKey(byte[] data, ref int readIndex)
private object ReadSignature(byte[] data, ref int readIndex)
private object ReadExtendedAsset(byte[] data, ref int readIndex)
private object ReadSymbol(byte[] data, ref int readIndex)
private object ReadPermissionLevel(byte[] data, ref int readIndex)
private object ReadActionHeader(byte[] data, ref int readIndex)
private object ReadAction(byte[] data, Core.Api.v1.Actionaction, Abi abi, ref int readIndex)
private List< AbiAction> ReadAbiActionList(byte[] data, ref int readIndex)
private List< AbiTable> ReadAbiTableList(byte[] data, ref int readIndex)
private object ReadAbiType(byte[] data, string type, Abi abi, ref int readIndex, bool isBinaryExtensionAllowed)
private object ReadAbiStruct(byte[] data, AbiStructabiStruct, Abi abi, ref int readIndex)
private T ReadAbiStruct< T >(byte[] data, AbiStructabiStruct, Abi abi, ref int readIndex)
private object ReadAbiVariant(byte[] data, VariantabiVariant, Abi abi, ref int readIndex, bool isBinaryExtensionAllowed)
private T ReadType< T >(byte[] data, ref int readIndex)
private object ReadType(byte[] data, Type objectType, ref int readIndex)
private IList ReadCollectionType(byte[] data, Type objectType, ref int readIndex)
private string FindObjectFieldName(string name, System.Collections.IDictionary value)
private string FindObjectFieldName(string name, Type objectType)
private string FindObjectPropertyName(string name, Type objectType)
private static void WriteByte(MemoryStream ms, object value)
private static void WriteInt16(MemoryStream ms, object value)
private static void WriteUint16(MemoryStream ms, object value)
private static void WriteUint32(MemoryStream ms, object value)
private static void WriteInt32(MemoryStream ms, object value)
private static void WriteInt64(MemoryStream ms, object value)
private static void WriteUint64(MemoryStream ms, object value)
private static void WriteInt128(MemoryStream ms, object value)
private static void WriteUInt128(MemoryStream ms, object value)
private static void WriteVarUint32(MemoryStream ms, object value)
private static void WriteVarInt32(MemoryStream ms, object value)
private static void WriteFloat32(MemoryStream ms, object value)
private static void WriteFloat64(MemoryStream ms, object value)
private static void WriteFloat128(MemoryStream ms, object value)
private static void WriteBytes(MemoryStream ms, object value)
private static void WriteBool(MemoryStream ms, object value)
private static void WriteString(MemoryStream ms, object value)
private static void WriteName(MemoryStream ms, object value)
private static void WriteAsset(MemoryStream ms, object value)
private static void WriteTimePoint(MemoryStream ms, object value)
private static void WriteTimePointSec(MemoryStream ms, object value)
private static void WriteBlockTimestampType(MemoryStream ms, object value)
private static void WriteSymbolString(MemoryStream ms, object value)
private static void WriteSymbolCode(MemoryStream ms, object value)
private static void WriteChecksum160(MemoryStream ms, object value)
private static void WriteChecksum256(MemoryStream ms, object value)
private static void WriteChecksum512(MemoryStream ms, object value)
private static void WritePublicKey(MemoryStream ms, object value)
private static void WritePrivateKey(MemoryStream ms, object value)
private static void WriteSignature(MemoryStream ms, object value)
private static void WriteExtendedAsset(MemoryStream ms, object value)
private static void WriteSymbol(MemoryStream ms, object value)
private static void WriteExtension(MemoryStream ms, Core.Api.v1.Extension extension)
private static void WritePermissionLevel(MemoryStream ms, PermissionLevel perm)
private static bool IsCollection(Type type)
private static bool IsOptional(Type type)
private static Type GetFirstGenericType(Type type)
private static bool IsPrimitive(Type type)
private static string GetNormalizedReaderName(Type type, IEnumerable< Attribute > customAttributes)
Members
private Dictionary< string, Action< MemoryStream, object > > TypeWriters
private Dictionary< string, ReaderDelegate> TypeReaders
public AbiSerializationProvider( EosApi api)
Construct abi serialization provided using EOS api.
Parameters
api
public AbiSerializationProvider()
Construct abi serialization provided using EOS api.
Parameters
api
public async Task< byte[]> SerializePackedTransaction( Transaction trx)
Serialize transaction to packed asynchronously.
Parameters
trxtransaction to pack
Returns
public byte[] SerializePackedTransaction( Transactiontrx, Dictionary< string, Abi > abiMap)
Serialize transaction to packed asynchronously.
Parameters
trxtransaction to pack
Returns
public async Task< Transaction> DeserializePackedTransaction(string packtrx)
Deserialize packed transaction asynchronously.
Parameters
packtrxhex encoded strinh with packed transaction
Returns
public Abi DeserializePackedAbi(string packabi)
Deserialize packed abi.
Parameters
packabistring encoded abi
Returns
public byte[] SerializeActionData( Core.Api.v1.Actionaction, Abi abi)
Serialize action to packed action data.
Parameters
actionaction to packabiabi schema to look action structure
Returns
public Dictionary< string, object > DeserializeStructData(string structType, string dataHex, Abi abi)
Deserialize structure data as "Dictionary<string, object>".
Parameters
structTypestruct type in abidataHexdata to deserializeabiabi schema to look for struct type
Returns
public TStructData DeserializeStructData< TStructData >(string structType, string dataHex, Abi abi)
Deserialize structure data with generic TStructData type.
Parameters
TStructDatadeserialization struct data type
Parameters
structTypestruct type in abidataHexdata to deserializeabiabi schema to look for struct type
Returns
public TStructData DeserializeStructData< TStructData >(string structType, string dataHex, Abi abi, ref int readIndex)
Deserialize structure data with generic TStructData type.
Parameters
TStructDatadeserialization struct data type
Parameters
structTypestruct type in abidataHexdata to deserializeabiabi schema to look for struct typereadIndex
Returns
public TStructData DeserializeStructData< TStructData >(string structType, byte[] data, Abi abi, ref int readIndex)
Deserialize structure data with generic TStructData type.
Parameters
TStructDatadeserialization struct data type
Parameters
structTypestruct type in abidatadata to deserializeabiabi schema to look for struct typereadIndex
Returns
public Task< Abi GetTransactionAbis( Transaction trx)
Get abi schemas used in transaction.
Parameters
trx
Returns
public async Task< Abi> GetAbi(string accountName)
Get abi schema by contract account name.
Parameters
accountNameaccount name
Returns
public T DeserializeType< T >(string dataHex)
Deserialize type by encoded string data.
Parameters
T
Parameters
dataHex
Returns
public T DeserializeType< T >(byte[] data)
Deserialize type by binary data.
Parameters
T
Parameters
data
Returns
public T DeserializeType< T >(byte[] data, ref int readIndex)
Deserialize type by binary data, ref readIndex.
Parameters
T
Parameters
datareadIndex
Returns
public byte[] SerializeTypeData(string typeName, object value, Abi abi)
public byte[] SerializeTypeData(object value, AbiTypeabiType, Abi abi)
public byte[] SerializeStructData(object value, AbiStructabiStruct, Abi abi)
public byte[] Serialize(object value, string type)
Parameters
valueobject to packtypeabi-type (base-type) used for serialization
Returns
public T Deserialize< T >(byte[] value, string type)
Parameters
valuebytes to unpacktypeabi-type (base-type) used for deserialization
Returns
private delegate object ReaderDelegate(byte[] data, ref int readIndex)
private void WriteAction(MemoryStream ms, Core.Api.v1.Actionaction, Abi abi)
private void WriteAbiType(MemoryStream ms, object value, string type, Abi abi, bool isBinaryExtensionAllowed)
private void WriteAbiStruct(MemoryStream ms, object value, AbiStructabiStruct, Abi abi)
private void WriteAbiVariant(MemoryStream ms, object value, VariantabiVariant, Abi abi, bool isBinaryExtensionAllowed)
private string UnwrapTypeDef( Abi abi, string type)
private TSerializer GetTypeSerializerAndCache< TSerializer >(string type, Dictionary< string, TSerializer > typeSerializers, Abi abi)
private object ReadByte(byte[] data, ref int readIndex)
private object ReadInt16(byte[] data, ref int readIndex)
private object ReadUint16(byte[] data, ref int readIndex)
private object ReadInt32(byte[] data, ref int readIndex)
private object ReadUint32(byte[] data, ref int readIndex)
private object ReadInt64(byte[] data, ref int readIndex)
private object ReadUint64(byte[] data, ref int readIndex)
private object ReadInt128(byte[] data, ref int readIndex)
private object ReadUInt128(byte[] data, ref int readIndex)
private object ReadVarUint32(byte[] data, ref int readIndex)
private object ReadVarInt32(byte[] data, ref int readIndex)
private object ReadFloat32(byte[] data, ref int readIndex)
private object ReadFloat64(byte[] data, ref int readIndex)
private object ReadFloat128(byte[] data, ref int readIndex)
private object ReadBytes(byte[] data, ref int readIndex)
private object ReadBool(byte[] data, ref int readIndex)
private object ReadString(byte[] data, ref int readIndex)
private object ReadName(byte[] data, ref int readIndex)
private object ReadAsset(byte[] data, ref int readIndex)
private object ReadTimePoint(byte[] data, ref int readIndex)
private object ReadTimePointSec(byte[] data, ref int readIndex)
private object ReadBlockTimestampType(byte[] data, ref int readIndex)
private object ReadSymbolString(byte[] data, ref int readIndex)
private object ReadSymbolCode(byte[] data, ref int readIndex)
private object ReadChecksum160(byte[] data, ref int readIndex)
private object ReadChecksum256(byte[] data, ref int readIndex)
private object ReadChecksum512(byte[] data, ref int readIndex)
private object ReadPublicKey(byte[] data, ref int readIndex)
private object ReadPrivateKey(byte[] data, ref int readIndex)
private object ReadSignature(byte[] data, ref int readIndex)
private object ReadExtendedAsset(byte[] data, ref int readIndex)
private object ReadSymbol(byte[] data, ref int readIndex)
private object ReadPermissionLevel(byte[] data, ref int readIndex)
private object ReadActionHeader(byte[] data, ref int readIndex)
private object ReadAction(byte[] data, Core.Api.v1.Actionaction, Abi abi, ref int readIndex)
private List< AbiAction> ReadAbiActionList(byte[] data, ref int readIndex)
private List< AbiTable> ReadAbiTableList(byte[] data, ref int readIndex)
private object ReadAbiType(byte[] data, string type, Abi abi, ref int readIndex, bool isBinaryExtensionAllowed)
private object ReadAbiStruct(byte[] data, AbiStructabiStruct, Abi abi, ref int readIndex)
private T ReadAbiStruct< T >(byte[] data, AbiStructabiStruct, Abi abi, ref int readIndex)
private object ReadAbiVariant(byte[] data, VariantabiVariant, Abi abi, ref int readIndex, bool isBinaryExtensionAllowed)
private T ReadType< T >(byte[] data, ref int readIndex)
private object ReadType(byte[] data, Type objectType, ref int readIndex)
private IList ReadCollectionType(byte[] data, Type objectType, ref int readIndex)
private string FindObjectFieldName(string name, System.Collections.IDictionary value)
private string FindObjectFieldName(string name, Type objectType)
private string FindObjectPropertyName(string name, Type objectType)
private static void WriteByte(MemoryStream ms, object value)
private static void WriteInt16(MemoryStream ms, object value)
private static void WriteUint16(MemoryStream ms, object value)
private static void WriteUint32(MemoryStream ms, object value)
private static void WriteInt32(MemoryStream ms, object value)
private static void WriteInt64(MemoryStream ms, object value)
private static void WriteUint64(MemoryStream ms, object value)
private static void WriteInt128(MemoryStream ms, object value)
private static void WriteUInt128(MemoryStream ms, object value)
private static void WriteVarUint32(MemoryStream ms, object value)
private static void WriteVarInt32(MemoryStream ms, object value)
private static void WriteFloat32(MemoryStream ms, object value)
private static void WriteFloat64(MemoryStream ms, object value)
private static void WriteFloat128(MemoryStream ms, object value)
private static void WriteBytes(MemoryStream ms, object value)
private static void WriteBool(MemoryStream ms, object value)
private static void WriteString(MemoryStream ms, object value)
private static void WriteName(MemoryStream ms, object value)
private static void WriteAsset(MemoryStream ms, object value)
private static void WriteTimePoint(MemoryStream ms, object value)
private static void WriteTimePointSec(MemoryStream ms, object value)
private static void WriteBlockTimestampType(MemoryStream ms, object value)
private static void WriteSymbolString(MemoryStream ms, object value)
private static void WriteSymbolCode(MemoryStream ms, object value)
private static void WriteChecksum160(MemoryStream ms, object value)
private static void WriteChecksum256(MemoryStream ms, object value)
private static void WriteChecksum512(MemoryStream ms, object value)
private static void WritePublicKey(MemoryStream ms, object value)
private static void WritePrivateKey(MemoryStream ms, object value)
private static void WriteSignature(MemoryStream ms, object value)
private static void WriteExtendedAsset(MemoryStream ms, object value)
private static void WriteSymbol(MemoryStream ms, object value)
private static void WriteExtension(MemoryStream ms, Core.Api.v1.Extension extension)
private static void WritePermissionLevel(MemoryStream ms, PermissionLevel perm)
private static bool IsCollection(Type type)
private static bool IsOptional(Type type)
private static Type GetFirstGenericType(Type type)
private static bool IsPrimitive(Type type)
private static string GetNormalizedReaderName(Type type, IEnumerable< Attribute > customAttributes)
Last updated