-
Notifications
You must be signed in to change notification settings - Fork 1
Serializer
A BCS (Binary Canonical Serialization) Serializer meant for serializing data
public class Serializer
public init()
Returns the _output
object.
public func output() -> Data
Data
object.
Serialize a boolean value or an array of boolean values using a custom Serializer.
public static func bool<T: EncodingContainer>(_ serializer: Serializer, _ value: T) throws
This function takes a custom Serializer and a generic value conforming to the EncodingContainer protocol, and attempts to serialize the value as a single boolean or an array of booleans. The serialized boolean value is represented as UInt8 where true is encoded as 1 and false is encoded as 0.
- serializer: A custom Serializer instance to be used for serialization.
- value: A generic value conforming to EncodingContainer, which is either a Bool or an array of Bools.
An AptosError object that's an invalid data value with the supported type of either Bool
or [Bool]
, if the provided value does not match either a Bool or an array of Bools.
Convert a Data value or an array of Data values into bytes using a custom Serializer.
public static func toBytes<T: EncodingContainer>(_ serializer: Serializer, _ value: T) throws
This function takes a custom Serializer and a generic value conforming to the EncodingContainer protocol, and attempts to convert the value as a single Data object or an array of Data objects into bytes. The bytes are appended to the Serializer's output buffer.
- serializer: A custom Serializer instance to be used for converting data into bytes.
- value: A generic value conforming to EncodingContainer, which is either a Data object or an array of Data objects.
An AptosError object that's an invalid data value with the supported type of either Data or [Data], if the provided value does not match either a Data object or an array of Data objects.
Serialize a value conforming to the EncodingProtocol using a custom Serializer, ensuring it conforms to the KeyProtocol.
public static func _struct(_ serializer: Serializer, value: EncodingProtocol) throws
This function takes a custom Serializer and a value conforming to the EncodingProtocol, and attempts to serialize the value by calling its serialize method. The value must also conform to the KeyProtocol.
- serializer: A custom Serializer instance to be used for serialization.
- value: A value conforming to EncodingProtocol and expected to conform to KeyProtocol.
An AptosError object with a message that the value does not conform to the required KeyProtocol, if the provided value does not conform to KeyProtocol.
Serialize a String value or an array of String values using a custom Serializer.
public static func str<T: EncodingContainer>(_ serializer: Serializer, _ value: T) throws
This function takes a custom Serializer and a generic value conforming to the EncodingContainer protocol, and attempts to serialize the value as a single String or an array of Strings. The serialized String values are converted to Data using UTF-8 encoding.
- serializer: A custom Serializer instance to be used for serialization.
- value: A generic value conforming to EncodingContainer, which is either a String or an array of Strings.
An AptosError object that's an invalid data value with the supported type of either String or [String], if the provided value does not match either a String object or an array of String objects.
Serialize a UInt8 value or an array of UInt8 values using a custom Serializer.
public static func u8<T: EncodingContainer>(_ serializer: Serializer, _ value: T) throws
This function takes a custom Serializer and a generic value conforming to the EncodingContainer protocol, and attempts to serialize the value as a single UInt8 or an array of UInt8s.
- serializer: A custom Serializer instance to be used for serialization.
- value: A generic value conforming to EncodingContainer, which is either a UInt8 or an array of UInt8s.
An AptosError object that's an invalid data value with the supported type of either UInt8 or [UInt8], if the provided value does not match either a UInt8 object or an array of UInt8 objects.
Serialize a UInt16 value or an array of UInt16 values using a custom Serializer.
public static func u16<T: EncodingContainer>(_ serializer: Serializer, _ value: T) throws
This function takes a custom Serializer and a generic value conforming to the EncodingContainer protocol, and attempts to serialize the value as a single UInt16 or an array of UInt16s.
- serializer: A custom Serializer instance to be used for serialization.
- value: A generic value conforming to EncodingContainer, which is either a UInt16 or an array of UInt16s.
An AptosError object that's an invalid data value with the supported type of either UInt16 or [UInt16], if the provided value does not match either a UInt16 or an array of UInt16s.
Serialize a UInt32 value or an array of UInt32 values using a custom Serializer.
public static func u32<T: EncodingContainer>(_ serializer: Serializer, _ value: T) throws
This function takes a custom Serializer and a generic value conforming to the EncodingContainer protocol, and attempts to serialize the value as a single UInt32 or an array of UInt32s.
- serializer: A custom Serializer instance to be used for serialization.
- value: A generic value conforming to EncodingContainer, which is either a UInt32 or an array of UInt32s.
An AptosError object that's an invalid data value with the supported type of either UInt32 or [UInt32], if the provided value does not match either a UInt32 or an array of UInt32s.
Serialize a UInt64 value or an array of UInt64 values using a custom Serializer.
public static func u64<T: EncodingContainer>(_ serializer: Serializer, _ value: T) throws
This function takes a custom Serializer and a generic value conforming to the EncodingContainer protocol, and attempts to serialize the value as a single UInt64 or an array of UInt64s.
- serializer: A custom Serializer instance to be used for serialization.
- value: A generic value conforming to EncodingContainer, which is either a UInt64 or an array of UInt64s.
An AptosError object that's an invalid data value with the supported type of either UInt64 or [UInt64], if the provided value does not match either a UInt64 or an array of UInt64s.
Serialize a UInt128 value or an array of UInt128 values using a custom Serializer.
public static func u128<T: EncodingContainer>(_ serializer: Serializer, _ value: T) throws
This function takes a custom Serializer and a generic value conforming to the EncodingContainer protocol, and attempts to serialize the value as a single UInt128 or an array of UInt128s.
- serializer: A custom Serializer instance to be used for serialization.
- value: A generic value conforming to EncodingContainer, which is either a UInt128 or an array of UInt128s.
An AptosError object that's an invalid data value with the supported type of either UInt128 or [UInt128], if the provided value does not match either a UInt128 or an array of UInt128s.
Serialize a UInt256 value or an array of UInt256 values using a custom Serializer.
public static func u256<T: EncodingContainer>(_ serializer: Serializer, _ value: T) throws
This function takes a custom Serializer and a generic value conforming to the EncodingContainer protocol, and attempts to serialize the value as a single UInt256 or an array of UInt256s.
- serializer: A custom Serializer instance to be used for serialization.
- value: A generic value conforming to EncodingContainer, which is either a UInt256 or an array of UInt256s.
An AptosError object that's an invalid data value with the supported type of either UInt256 or [UInt256], if the provided value does not match either a UInt256 or an array of UInt256s.
Generated at 2023-07-20T02:24:43+0000 using swift-doc 1.0.0-rc.1.
Types
- Account
- AccountAddress
- AccountAddressTag
- AccountResponse
- AnyTransactionArgument
- AptosError
- AptosRestClientError
- BoolTag
- ClientConfig
- Collection
- Ed25519Authenticator
- Ed25519BIP32
- EntryFunction
- HTTPMethod
- InfoResponse
- InvalidPropertyType
- Mnemonic
- Mnemonic.Error
- ModuleBundle
- ModuleId
- MultiAgentAuthenticator
- MultiAgentRawTransaction
- MultiEd25519Authenticator
- MultiPublicKey
- MultiSignature
- Object
- PrivateKey
- Property
- PropertyMap
- PublicKey
- RawTransaction
- RotatingProofChallenge
- Royalty
- Script
- ScriptArgument
- SeedMode
- Serializer
- Signature
- SignedTransaction
- StructTag
- StructTagValue
- Token
- TransactionArgument
- U128Tag
- U16Tag
- U256Tag
- U32Tag
- U64Tag
- U8Tag
- UInt128
- UInt128Errors
- Wallet
- Wordlists
Protocols
Global Variables
Global Functions
- _struct(_:)
- account(_:ledgerVersion:)
- accountBalance(_:_:)
- accountResource(_:_:_:)
- accountResources(_:_:)
- accountSequenceNumber(_:_:)
- addTokenProperty(_:_:_:)
- aggregatorValue(_:_:_:)
- asyncData(with:method:headers:body:)
- bcsTransfer(_:_:_:)
- bool()
- burnToken(_:_:)
- claimToken(_:_:_:_:_:_:)
- createBcsSignedTransaction(_:_:)
- createBcsSignedTransaction(_:_:_:)
- createBcsTransaction(_:_:)
- createBcsTransaction(_:_:_:)
- createCollection(_:_:_:_:)
- createCollection(_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:)
- createCollectionPayload(_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:)
- createMultiAgentBcsTransaction(_:_:_:)
- createToken(_:_:_:_:_:_:_:)
- decodeData(_:with:keyDecodingStrategy:dataDecodingStrategy:dateDecodingStrategy:)
- decodeUrl(_:with:)
- decodeUrl(with:_:)
- decodeUrl(with:_:_:)
- deserialize(from:)
- directTransferToken(_:_:_:_:_:_:_:)
- fixedBytes(length:)
- freezeToken(_:_:)
- fundAccount(_:_:)
- getCollection(_:_:)
- getTableItem(_:_:_:_:_:_:)
- getToken(_:_:_:_:_:)
- getTokenBalance(_:_:_:_:_:)
- getTokenData(_:_:_:_:)
- info()
- map(keyDecoder:valueDecoder:)
- mintSoulBoundToken(_:_:_:_:_:_:_:)
- mintToken(_:_:_:_:_:_:)
- mintTokenPayload(_:_:_:_:_:)
- offerToken(_:_:_:_:_:_:_:)
- publishPackage(_:_:_:)
- readObject(address:)
- remaining()
- removeTokenProperty(_:_:_:)
- sequence(valueDecoder:)
- serialize(_:)
- simulateTransaction(_:_:)
- string(_:)
- submitBcsTransaction(_:)
- submitTransaction(_:_:)
- toBytes(_:)
- transactionPending(_:)
- transfer(_:_:_:)
- u128(_:)
- u16(_:)
- u256(_:)
- u32(_:)
- u64(_:)
- u8(_:)
- uleb128()
- unfreezeToken(_:_:)
- updateTokenProperty(_:_:_:)
- verify(_:)
- waitForTransaction(_:)