By default, the requests are performed with Alamofire, and the response is given to the callback function as [String: Any].
The functions that are responsible for this can be found in Utils.swift.
You can easily override this default functionality by defining your own handleApiGet and handleApiPost functions and passing them to the endpoint object (e.g. Blocks.
An example of how this is done can be found by looking at the tests, e.g. those of Blocks, as a mocked api handler is used for them.

Each API client is instantiated roughly the same. It requires a fully qualified URL pointing to the node used in the requests and allows for optional parameters providing more custom configurations.

Each SDK attempts to return a response in an idiomatic way (i.e., using structs if appropriate) and a way to access the underlying HTTP response. You can use a public node in your API requests, such as the official explorer, but for security reasons, we recommend running your node.

Before making a request, you should create a Connection.
A Connection expects a host, which is an URL on which the API can be reached,
and a network version, which specifies whether we are using v1 or v2.
An example Connection that connects to a v2 API of a node, would be created as follows:

Before making a request, you should create a Connection.
A Connection expects a host, which is an URL on which the API can be reached,
An example Connection that connects to a node, would be created as follows:

// Mind the '/api' after the URL, no trailing '/'!let conn =Connection(host:"http://0.0.0.0:4003/api")

let blocks =Blocks(connection: conn)// Perform an API call, note that requests are async and returned in a closure
blocks.all {(response)in// Do something with the response// Note that response is of type [String: Any]}

// Getting the transactions of a specific block can for example be done as follows:
blocks.transactions(ofBlock:"297551546576616827"){(response)inprint(response)}

A delegate is a regular wallet that has broadcasted a registration transaction, acquired a sufficient number of votes, and has a Relay Node configured to forge new blocks through a forger module. At any time only 51 delegates are active. They are cost-efficient miners running the Ark Network.

Voters are wallets which have broadcasted a vote transaction on a delegate. A vote remains active until an un-vote transaction is sent (it does not have to be recast unless a wallet wishes to change from delegate). Voting for a delegate does not give the delegate access to the wallet nor does it lock the coins in it.

The Ark Network consists of different anonymous nodes (servers), maintaining the public ledger, validating transactions and blocks and providing APIs. The node resource allows for querying the health and configurations of the node used by the instantiated client.

Each node is connected to a set of peers, which are Relay or Delegate Nodes as well. The peers resource provides access to all peers connected to our node.

Peers have made their Public API available for use; however for mission-critical queries and transaction posting you should use a node which is under your control. We provide a guide to setting up a Relay Node here.