-
Spam address used for promote.
Declaration
Swift
public static let spamTransfer = IotaTransfer(address: "".rightPadded(count: 81, character: "9")) -
Spam Seed used for promote.
Declaration
Swift
public static let spamSeed = "".rightPadded(count: 81, character: "9") -
Address of the host.
Declaration
Swift
public fileprivate(set) var address: String = "" -
Debug variable, setting it to
true, will enable the debug logging. Defaultfalse.Declaration
Swift
public var debug = false -
Local PoW instance, setting it to
nilwill delegate the PoW to the node.Declaration
Swift
public var localPoW: IotaLocalPoW? = CPearlDiver() -
Initializer for Iota class with automatic node selection.
Declaration
Swift
public init(prefersHTTPS: Bool = false, _ onReady: @escaping (Iota?) -> Void)Parameters
prefersHTTPSSetting it to
true, HTTPS nodes will be preferred.onReadyOn ready block.
-
Initializer for Iota class.
Declaration
Swift
public init(node: String, port: UInt)Parameters
nodeNode address without port.
portPort for the specified node address
-
Initializer for Iota class
Declaration
Swift
public init(node: String)Parameters
nodeFull node address Ex:
http://localhost:14700 -
Returns information about the connected node.
Declaration
Swift
public func nodeInfo(_ success: @escaping ([String: Any]) -> Void, error: @escaping (Error) -> Void)Parameters
successSuccess block.
errorError block.
-
Returns the confirmed balance of the requested addresses.
Declaration
Swift
public func balances(addresses: [String], _ success: @escaping (_ balances: [String: Int64]) -> Void, error: @escaping (Error) -> Void)Parameters
addressesList of addresses.
successSuccess block.
errorError block.
-
Find the transactions which match the specified addresses.
Declaration
Swift
public func findTransactions(addresses: [String], _ success: @escaping (_ hashes: [String]) -> Void, error: @escaping (Error) -> Void)Parameters
addressesList of addresses.
successSuccess block.
errorError block.
-
Find the transactions which match the specified bundles.
Declaration
Swift
public func findTransactions(bundles: [String], _ success: @escaping (_ hashes: [String]) -> Void, error: @escaping (Error) -> Void)Parameters
bundlesList of bundles.
successSuccess block.
errorError block.
-
Returns the raw transaction data (trytes) of a specific transaction. These trytes can then be easily converted into the actual transaction object. See IotaTransaction.
Declaration
Swift
public func trytes(hashes: [String], _ success: @escaping (_ trytes: [IotaTransaction]) -> Void, error: @escaping (Error) -> Void)Parameters
hashesList of transaction hashes.
successSuccess block.
errorError block.
-
returns the addresses, transfers, inputs and balance that are associated and have been used with your account (seed). This function is useful in getting all the relevant information of your account.
Declaration
Swift
public func accountData(seed: String, minimumNumberOfAddresses: Int = 0, security: Int = 2, requestTransactions: Bool = false, _ success: @escaping (_ account: IotaAccount) -> Void, error: @escaping (Error) -> Void, log: ((_ log: IotaLog) -> Void)? = nil)Parameters
seedThe Seed.
minimumNumberOfAddressesThe minimum number of addresses associated to the seed, setting it to
truewill be useful in order to speed up the process, by requesting all the addresses balance and transactions in batch.securityThe security level (1-3).
requestTransactionsSetting it to
true, all the transactions associated to the addresses will be requested and returned. If you don’t need it, set it tofalse.successSuccess block.
errorError block.
logLog block.
-
Attaches the specified address to the Tangle by doing Proof of Work.
Declaration
Swift
public func attachToTangle(seed: String, index: Int, security: Int = 2, _ success: @escaping (_ transfer: IotaTransaction) -> Void, error: @escaping (Error) -> Void)Parameters
seedThe Seed.
indexThe index of the address.
securityThe security level.
successSuccess block.
errorError block.
-
sendTransfers(seed:security:depth:minWeightMagnitude:transfers:inputs:remainderAddress:reference:_:error:)Wrapper function that basically does prepareTransfers, as well as attachToTangle and finally, it broadcasts and stores the transactions locally.
Declaration
Swift
public func sendTransfers(seed: String, security: Int = 2, depth: Int = 10, minWeightMagnitude: Int = IotaConstants.mwm, transfers: [IotaTransfer], inputs: [IotaInput]?, remainderAddress: String?, reference: String? = nil, _ success: @escaping (_ transactions: [IotaTransaction]) -> Void, error: @escaping (Error) -> Void)Parameters
seedThe Seed.
securityThe security level.
depthNumber of bundles to go back to determine the transactions for approval, leave it as default.
minWeightMagnitudeMinimum weight magnitude, leave it as default.
transfersList of IotaTransfers.
inputsList of IotaInputs, by setting it to null, the proper inputs will be taken automatically.
remainderAddressThe remainder address, by setting it to
null, a new address will be generated and used as remainder.referenceHash of transaction to start random-walk from, used to make sure the tips returned reference a given transaction in their past, leave it as default.
successSuccess block.
errorError block.
-
Takes a tail transaction hash as input, gets the bundle associated with the transaction and then replays the bundle by attaching it to the tangle.
Declaration
Swift
public func replayBundle(tx: String, depth: Int = 10, minWeightMagnitude: Int = IotaConstants.mwm, _ success: @escaping (_ transactions: [IotaTransaction]) -> Void, error: @escaping (Error) -> Void)Parameters
txTransaction hash, has to be tail.
depthNumber of bundles to go back to determine the transactions for approval, leave it as default.
minWeightMagnitudeMinimum weight magnitude, leave it as default.
successSuccess block.
errorError block.
-
Returns the bundle with the specified where the specified tx hash belongs to.
Declaration
Swift
public func bundle(tx: String, _ success: @escaping (_ transactions: [IotaTransaction]) -> Void, error: @escaping (Error) -> Void)Parameters
txThe transaction hash, has to be the tail.
successSuccess block.
errorError block.
-
Returns all the transactions associated to the specified address.
Declaration
Swift
public func transactionsFromAddress(address: String, _ success: @escaping (_ transactions: [IotaTransaction]) -> Void, error: @escaping (Error) -> Void)Parameters
addressThe address hash.
successSuccess block.
errorError block.
-
Returns the tail transaction from a transaction.
Declaration
Swift
public func tailFromTransaction(tx: IotaTransaction, _ success: @escaping (_ tail: IotaTransaction) -> Void, error: @escaping (Error) -> Void)Parameters
txThe requested tail transaction.
successSuccess block.
errorError block.
-
Returns an IotaAddress instance, filled with all the transactions.
Declaration
Swift
public func addressFromHash(address: String, _ success: @escaping (_ transactions: IotaAddress) -> Void, error: @escaping (Error) -> Void)Parameters
addressThe address hash.
successSuccess block.
errorError block.
-
Get the inclusion states of a set of transactions. This is for determining if a transaction was accepted and confirmed by the network or not.
Declaration
Swift
public func latestInclusionStates(hashes: [String], _ success: @escaping (([Bool]) -> Void), _ error: @escaping (Error) -> Void)Parameters
hashesList of transactions hashes you want to get the inclusion state for.
successSuccess block.
errorError block.
-
Check if a list of addresses was ever spent from, in the current epoch, or in previous epochs.
Declaration
Swift
public func wereAddressesSpentFrom(addresses: [String], _ success: @escaping (([Bool]) -> Void), _ error: @escaping (Error) -> Void)Parameters
addressesList of addresses to check if they were ever spent from.
successSuccess block.
errorError block.
-
Checks if a bundle is promotable by checking the tx tail of the bundle.
Declaration
Swift
public func isPromotable(tail: String, _ success: @escaping ((Bool) -> Void), _ error: @escaping (Error) -> Void)Parameters
tailThe tail transaction hash.
successSuccess block.
errorError block.
-
promoteTransaction(hash:transactions:depth:minWeightMagnitude:delayInSeconds:numberOfPromotes:_:error:)Promotes a transaction by spamming the network (convenience method).
Declaration
Swift
public func promoteTransaction(hash: String, transactions: [IotaTransfer] = [Iota.spamTransfer], depth: Int = 10, minWeightMagnitude: Int = IotaConstants.mwm, delayInSeconds: UInt = 0, numberOfPromotes: Int = 4, _ success: @escaping (_ tail: String) -> Void, error: @escaping (Error) -> Void)Parameters
hashTransaction hash, has to be tail.
transactionsList of transfers.
depthNumber of bundles to go back to determine the transactions for approval, leave it as default.
minWeightMagnitudeMinimum weight magnitude, leave it as default.
delayInSecondsDelay in seconds between spams.
numberOfPromotesNumber of spams to add on top of the transaction (default 4).
successSuccess block.
errorError block.
-
promoteTransaction(_:transactions:depth:minWeightMagnitude:delayInSeconds:numberOfPromotes:_:error:)Promotes a transaction by spamming the network.
Declaration
Swift
public func promoteTransaction(_ tx: IotaTransaction, transactions: [IotaTransfer] = [Iota.spamTransfer], depth: Int = 10, minWeightMagnitude: Int = IotaConstants.mwm, delayInSeconds: UInt = 0, numberOfPromotes: Int = 4, _ success: @escaping (_ tail: String) -> Void, error: @escaping (Error) -> Void)Parameters
txThe transaction.
transactionsList of transfers.
depthNumber of bundles to go back to determine the transactions for approval, leave it as default.
minWeightMagnitudeMinimum weight magnitude, leave it as default.
delayInSecondsDelay in seconds between spams.
numberOfPromotesNumber of spams to add on top of the transaction (default 4).
successSuccess block.
errorError block.
-
Promotes a transaction by spamming the network (convenience method).
Declaration
Swift
public func promote(tail: String, transactions: [IotaTransfer] = [Iota.spamTransfer], depth: Int = 10, minWeightMagnitude: Int = IotaConstants.mwm, delayInSeconds: UInt = 0, numberOfPromotes: Int = 4, _ success: @escaping (_ tail: String) -> Void, error: @escaping (Error) -> Void)Parameters
tailThe tail transaction hash.
transactionsList of transfers.
depthNumber of bundles to go back to determine. the transactions for approval, leave it as default.
minWeightMagnitudeMinimum weight magnitude, leave it as default.
delayInSecondsDelay in seconds between spams.
numberOfPromotesNumber of spams to add on top of the transaction (default 4).
successSuccess block.
errorError block.
-
Wrapper function that does attachToTangle and finally, it broadcasts and stores the transactions.
Declaration
Swift
public func sendTrytes(trytes: [String], depth: Int = 10, minWeightMagnitude: Int = IotaConstants.mwm, reference: String? = nil, _ success: @escaping (_ transactions: [IotaTransaction]) -> Void, error: @escaping (Error) -> Void)Parameters
trytesList of trytes.
depthNumber of bundles to go back to determine the transactions for approval, leave it as default.
minWeightMagnitudeMinimum weight magnitude, leave it as default.
referenceHash of transaction to start random-walk from, used to make sure the tips returned reference a given transaction in their past, leave it as default.
successSuccess block.
errorError block.
-
Attaches the specified address to the Tangle by doing Proof of Work.
Declaration
Swift
public func attachToTangle(trunkTx: String, branchTx: String, minWeightMagnitude: Int, trytes: [String], _ success: @escaping (_ trytes: [String]) -> Void, error: @escaping (Error) -> Void)Parameters
trunkTxThe trunk transaction.
branchTxThe branch transaction.
minWeightMagnitudeThe Minimum Weight Magnitude.
trytesAn Array of Trytes.
successThe success block.
errorThe error block.
Iota Class Reference