Memo
public enum Memo : Sendable
extension Memo: MemoProtocol
extension Memo:MemoHashProtocol
extension Memo: Equatable
The memo contains optional extra information. It is the responsibility of the client to interpret this value. See Stellar developer docs
Memos can be one of the following types:
- none: Empty memo.
- text: A string encoded using either ASCII or UTF-8, up to 28-bytes long.
- id: A 64 bit unsigned integer.
- hash: A 32 byte hash.
- returnHash: A 32 byte hash intended to be interpreted as the hash of the transaction the sender is refunding.
-
No memo attached to the transaction.
Declaration
Swift
case none -
Text memo containing up to 28 bytes of ASCII or UTF-8 encoded string data.
Declaration
Swift
case text(String) -
Numeric identifier memo containing a 64-bit unsigned integer.
Declaration
Swift
case id(UInt64) -
Hash memo containing 32 bytes of arbitrary binary data.
Declaration
Swift
case hash(Data) -
Return hash memo containing 32 bytes representing the hash of a transaction being refunded.
Declaration
Swift
case returnHash(Data) -
Declaration
Swift
public func toXDR() -> MemoXDR -
Creates a memo of type text. Validates if the String is up to 28-bytes long.
Throws
Throws an StellarSDKError.invalidArgument error if the given string is larger than 28 bytes.
Declaration
Swift
public init?(text: String) throwsParameters
textString representing the text for the memo. Must be not larger than 28 bytes.
-
Creates a memo of type hash. Validates if the hash is up to 32-bytes long.
Throws
Throws an StellarSDKError.invalidArgument error if the given data is larger than 32 bytes.
Declaration
Swift
public init?(hash: Data) throwsParameters
hashData representing the hash for the memo. Must be not larger than 32 bytes.
-
Creates a memo of type returnHash. Validates if the hash is up to 32-bytes long.
Throws
Throws an StellarSDKError.invalidArgument error if the given data is larger than 32 bytes.
Declaration
Swift
public init?(returnHash: Data) throwsParameters
hashData representing the hash for the memo. Must be not larger than 32 bytes.
-
Creates a memo from a MemoXDR instance
Declaration
Swift
public init?(memoXDR: MemoXDR)Parameters
memoXDRThe MemoXDR instance.
-
Declaration
Swift
public func type() -> String -
Declaration
Swift
public func hexValue() throws -> String -
Declaration
Swift
public func trimmedHexValue() throws -> String -
Declaration
Swift
public static func == (lhs: Memo, rhs: Memo) -> Bool
View on GitHub
Install in Dash