Extractor
public struct Extractor
Internal Struct to encapsulate helpers methods needed to extract critical information from an array of operations, needed for processing decisions like “do i display a send token screen, or a send NFt screen”, fetching total XTZ sent in 1 action etc
-
Extract rpc amount (without decimal info) a tokenId, and the destination from a michelson FA1.2 / FA2 transfer payload
Declaration
Swift
public static func tokenIdAndAmountFromSendMichelson(michelson: Any) -> (rpcAmount: String, tokenId: Decimal?, destination: String)?
-
Extract details from a payload in order to present to the user what it is they are trying to send
Declaration
Swift
public static func faTokenDetailsFrom(transaction: OperationTransaction) -> (tokenContract: String, rpcAmount: String, tokenId: Decimal?, destination: String)?
-
Helper to call
faTokenDetailsFrom(transaction: OperationTransaction)
on the firstOperationTransaction
in an array of operations. Allows to more easily parse an array of operations that may includeapproval
‘s orupdate_operator
callsDeclaration
Swift
public static func faTokenDetailsFrom(operations: [Operation]) -> (tokenContract: String, rpcAmount: String, tokenId: Decimal?, destination: String)?
-
Return true if
- contains 1 operation with a non-zero amount, with no parameters
Declaration
Swift
public static func isTezTransfer(operations: [Operation]) -> Bool
-
Easy way to extract the first non-
approval
orupdate_operator
transactionDeclaration
Swift
public static func firstTransferEntrypointOperation(operations: [Operation]) -> OperationTransaction?
-
Return the entrypoint and address of the first operation, that doesn’t equal
approve
,update_operator
ortransfer
Declaration
Swift
public static func isContractCall(operations: [Operation]) -> (entrypoint: String, address: String)?
-
Return the first operation where entrypoint doesn’t equal
approve
,update_operator
ortransfer
Declaration
Swift
public static func firstContractCallOperation(operations: [Operation]) -> OperationTransaction?