Skip to main content

GasStation

GasStation​

class GasStation

The IOTA gas station, sponsoring transactions over its HTTP API.

Build one and pass it to a transaction builder's execute_with_gas_station.

init(url:reservationDuration:headers:httpOptions:)​

convenience init(url: String, reservationDuration: TimeInterval? = nil, headers: [String : [String]]? = nil, httpOptions: HttpClientOptions? = nil) throws

Create a gas station reachable at url.

reservation_duration is how long the station holds the gas it reserves, defaulting to 60 seconds. headers are sent with every request, typically to carry an authorization token. http_options describes the HTTP client the requests go out on.

Request paths are appended to the path of url, so a station served under a path prefix is reached through that prefix. The query of url is sent with every request.

debugDescription​

var debugDescription: String { get }

A textual representation of this instance, suitable for debugging.

Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the String(reflecting:) initializer. This initializer works with any type, and uses the custom debugDescription property for types that conform to CustomDebugStringConvertible:

struct Point: CustomDebugStringConvertible {
let x: Int, y: Int

var debugDescription: String {
return "(\(x), \(y))"
}
}

let p = Point(x: 21, y: 30)
let s = String(reflecting: p)
print(s)
// Prints "(21, 30)"

The conversion of p to a string in the assignment to s uses the Point type's debugDescription property.

url()​

func url() -> String

The URL this station is reached at.