Binary Data
We encapsulate binary data using theFBinaryData
structs, which is a wrapper around a pointer to a shared byte array TSharedPtr<TArray<uint8>>
. Binary data is further subtyped into FUnsizedData
, which represents data of any variable size, and TSizedData<TSize>
, which represents data of a required byte length TSize.
Important cryptographic types of set size, such as 32-byte private keys, are defined as subtypes of TSizedData- for example, we define FPrivateKey : TSizedData<32>
. These can also be loaded from hex strings using From(FString Str)
, such as FPrivateKey::From("0x0...0");
. Ensure that the input string is the correct size.
The ABI
To call contracts on the blockchain, you will need to encode any data you wish to pass as arguments using the ABI. To read more about the ABI and its specification, check out the solidity docs. Our ABI implementation centers around the ABI class inABI/ABI.h
, which provides functions to convert the following types: UInt32, Int32, Bool, FAddress, and FString. Any other data may be transformed directly into TFixedABIArray or TDynamicABIArray for fixed-length and dynamic length arrays respectively, or to TFixedABIData and TDynamicABIData
for fixed-length and dynamic length binary data.
Once you have your data stored in ABIEncodeable types, you can provide the ABI an array of the type TArray<ABIEncodeable*>
to ABI::Encode
to receive the binary encoding of the arguments. See `TestABI.cpp for an example.