TzKTTransaction
public struct TzKTTransaction : Codable, CustomStringConvertible, Hashable, Identifiable
A model matching the response that comes back from TzKT’s API: v1/accounts/<address>/operations
-
Declaration
Swift
public static let dateFormatter: DateFormatter
-
Declaration
Swift
public enum TransactionStatus : String, Codable
-
Declaration
Swift
public enum TransactionType : String, Codable
-
Declaration
Swift
public enum TransactionSubType : String, Codable
-
Declaration
Swift
public struct TransactionError : Codable
-
Declaration
Swift
public let type: TransactionType
-
Declaration
Swift
public let id: Decimal
-
Declaration
Swift
public let level: Decimal
-
Declaration
Swift
public let timestamp: String
-
Declaration
Swift
public let hash: String
-
Declaration
Swift
public let counter: Decimal
-
Declaration
Swift
public let initiater: TzKTAddress?
-
Declaration
Swift
public let sender: TzKTAddress
-
Declaration
Swift
public var bakerFee: XTZAmount
-
Declaration
Swift
public var storageFee: XTZAmount
-
Declaration
Swift
public var allocationFee: XTZAmount
-
Declaration
Swift
public var target: TzKTAddress?
-
Declaration
Swift
public let prevDelegate: TzKTAddress?
-
Declaration
Swift
public let newDelegate: TzKTAddress?
-
Declaration
Swift
public let baker: TzKTAddress?
-
Declaration
Swift
public var amount: TokenAmount
-
Declaration
Swift
public let parameter: [String : String]?
-
Declaration
Swift
public let status: TransactionStatus
-
Declaration
Swift
public let hasInternals: Bool
-
Declaration
Swift
public let tokenTransfersCount: Decimal?
-
Declaration
Swift
public let errors: [TransactionError]?
-
Declaration
Swift
public let kind: String?
-
Declaration
Swift
public let date: Date?
-
Declaration
Swift
public var tzktTokenTransfer: TzKTTokenTransfer? { get set }
-
Declaration
Swift
public var subType: TransactionSubType?
-
Declaration
Swift
public var entrypointCalled: String?
-
Declaration
Swift
public var primaryToken: Token?
-
Declaration
Swift
public var description: String { get }
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
-
Declaration
Swift
public static func == (lhs: TzKTTransaction, rhs: TzKTTransaction) -> Bool
-
Declaration
Swift
public enum CodingKeys : String, CodingKey
-
init(type:
id: level: timestamp: hash: counter: initiater: sender: bakerFee: storageFee: allocationFee: target: prevDelegate: newDelegate: baker: amount: parameter: status: hasInternals: tokenTransfersCount: errors: kind: ) Manually init a
TzKTTransaction
Declaration
Swift
public init(type: TransactionType, id: Decimal, level: Decimal, timestamp: String, hash: String, counter: Decimal, initiater: TzKTAddress?, sender: TzKTAddress, bakerFee: XTZAmount, storageFee: XTZAmount, allocationFee: XTZAmount, target: TzKTAddress?, prevDelegate: TzKTAddress?, newDelegate: TzKTAddress?, baker: TzKTAddress?, amount: TokenAmount, parameter: [String : String]?, status: TransactionStatus, hasInternals: Bool, tokenTransfersCount: Decimal?, errors: [TransactionError]?, kind: String?)
-
Convert a
TzKTTokenTransfer
into aTzKTTransaction
Declaration
Swift
public init(from: TzKTTokenTransfer)
-
Declaration
Swift
public init(from decoder: Decoder) throws
-
Declaration
Swift
public func encode(to encoder: Encoder) throws
-
placeholder(withStatus:
id: opHash: type: counter: fromWallet: destination: xtzAmount: parameters: primaryToken: baker: kind: ) Used for creating “Pending” transactions
Declaration
Swift
public static func placeholder(withStatus status: TransactionStatus, id: Decimal, opHash: String, type: TransactionType, counter: Decimal, fromWallet: WalletMetadata, destination: TzKTAddress, xtzAmount: TokenAmount, parameters: [String : String]?, primaryToken: Token?, baker: TzKTAddress?, kind: String?) -> TzKTTransaction
-
Used for createing a “Pending” delegation transaction
Declaration
Swift
public static func placeholder(withStatus status: TransactionStatus, id: Decimal, opHash: String, type: TransactionType, counter: Decimal, fromWallet: WalletMetadata, newDelegate: TzKTAddress?) -> TzKTTransaction
-
Declaration
Swift
public func parameterValueAsArray() -> [Any]?
-
Declaration
Swift
public func parameterValueAsDict() -> [String : Any]?
-
Declaration
Swift
public func parameterValueAsArrayOfDictionary() -> [[String : Any]]?
-
Declaration
Swift
public func parameterValueAsType<T>(type: T.Type) -> T?
-
Declaration
Swift
public func getEntrypoint() -> String?
-
Declaration
Swift
public mutating func processAdditionalData(withCurrentWalletAddress currentWalletAddress: String)
-
Declaration
Swift
public func createPrimaryToken() -> Token?
-
The TzKT transaction API doesn’t provide all the info needed to normalise Token amounts. It only gives address and rpc amount. Burried inside the michelson, the dex contract needs to be told the token id, and the
target
will contain the address. This function will try to extract address, token id and rpc amount and return them in the standard objects, so that they can be used in conjuction with other functions to fetch the decimal data. e.g. DipDup client can fetch all tokens from dexes, containing all token info. Using the address and id, the rest could be found via that, assuming zero for anything else (such as NFTs)Declaration
Swift
public func getFaTokenTransferData() -> Token?
-
Declaration
Swift
public func getTokenTransferDestination() -> String?
-
Declaration
Swift
public func errorString() -> String?