RPC
public class RPC<T> where T : Decodable
A generic class representing an RPC call to the Tezos network. A type must be passed in when creating an instance of this object, this will be used by the network layer to parse the response and detect errors.
-
The endpoint that will be added onto the
TezosNodeConfig.primaryNodeURL
to form a full URL for the requestDeclaration
Swift
public let endpoint: String
-
An optional payload for sending HTTP POST requests
Declaration
Swift
public let payload: Data?
-
The expected response type from the network
Declaration
Swift
public let responseType: T.Type
-
Computed property to indicate wheter or not this is a POST request
Declaration
Swift
public var isPost: Bool { get }
-
Init an
RPC
object, to be passed to the network layer to performa request to the node.Declaration
Swift
public init(endpoint: String, payload: Data?, responseType: T.Type)
Parameters
endpoint
The endpoint to send the request too.
payload
An optional payload for POST requests.
responseType
The expected response type from the network.
-
Helper function to wrap up
JSONEncoder().encode
and log any errors.Declaration
Swift
public static func encodableToData<E>(encodable: E) -> Data? where E : Encodable
-
Creates an RPC to fetch an XTZ balance for a given Address
Declaration
Swift
public static func xtzBalance(forAddress address: String) -> RPC<String>
-
Creates an RPC to fetch a deelgate for a given Address
Declaration
Swift
public static func getDelegate(forAddress address: String) -> RPC<String>
-
Creates an RPC to fetch the managerKey for a given Address
Declaration
Swift
public static func managerKey(forAddress address: String) -> RPC<String?>
-
Creates an RPC to fetch the current counter for a given Address
Declaration
Swift
public static func counter(forAddress address: String) -> RPC<String>
-
Creates an RPC to remotely forge an operation
Declaration
Swift
public static func forge(operationPayload: OperationPayload) -> RPC<String>?
-
Creates an RPC to inject an operation
Declaration
Swift
public static func inject(signedBytes: String) -> RPC<String>?
-
Creates an RPC to fetch the HEAD of the blockchain and parse it into an object to extract the pieces we are interested in.
Declaration
Swift
public static func blockchainHead() -> RPC<BlockchainHead>
-
Creates an RPC to fetch the HEAD of 3 blocks previous and parse it into an object to extract the pieces we are interested in.
Declaration
Swift
public static func blockchainHeadMinus3() -> RPC<BlockchainHead>
-
Creates an RPC to fetch the details about the version of the network running on the given server.
Declaration
Swift
public static func networkVersion() -> RPC<NetworkVersion>
-
Creates an RPC to fetch the network constants for the given server, such as how much mutez it costs per byte of storage, or the maximum allowed gas amount
Declaration
Swift
public static func networkConstants() -> RPC<NetworkConstants>
-
Creates an RPC to remotely parse an operation to verify its contents. Function takes in a hash, as it is returned from the forge call. This function will do all the necessary parsing and formatting
Declaration
Swift
public static func parse(hashToParse: String, metadata: OperationMetadata) -> RPC<[OperationPayload]>?
-
Creates an RPC to preapply an operation. This
OperationPayload
must have had its signature and protocol setDeclaration
Swift
public static func preapply(operationPayload: OperationPayload) -> RPC<[OperationResponse]>?
-
Creates an RPC to estimate an operation - deprecated
Declaration
Swift
public static func runOperation(runOperationPayload: RunOperationPayload) -> RPC<OperationResponse>?
-
Creates an RPC to estimate an operation
Declaration
Swift
public static func simulateOperation(runOperationPayload: RunOperationPayload) -> RPC<OperationResponse>?
-
Creates an RPC to fetch a contracts Michelson storage
Declaration
Swift
public static func contractStorage(contractAddress: String) -> RPC<Data>
-
Creates an RPC to fetch the contents of the given big map
Declaration
Swift
public static func bigMap(id: String) -> RPC<Data>