Node

public class Node

Node is a class that wraps a golang node object

Should not be used on its own

  • Class constructor using repo passed as parameter as node repo

    Throws

    NodeError: If the creation of the node failed

    Declaration

    Swift

    public init(_ repo: Repo) throws

    Parameters

    repo

    The repo of the node

  • Closes this node instance

    Throws

    NodeError: If the closing of the node failed

    Declaration

    Swift

    public func close() throws
  • Serves node API over UDS

    Throws

    NodeError: If the node failed to serve

    Declaration

    Swift

    public func serveAPI(onUDS: String) throws

    Parameters

    onUDS

    The UDS path to serve on

  • Serves node API over TCP

    Throws

    NodeError: If the node failed to serve

    Declaration

    Swift

    public func serveAPI(onTCPPort: String) throws -> String

    Parameters

    onTCPPort

    The TCP port to serve on

    Return Value

    The TCP/IP MultiAddr the node is serving on

  • Serves node Gateway over the given Multiaddr

    Throws

    NodeError: If the node failed to serve

    Declaration

    Swift

    public func serveGateway(onMultiaddr: String, writable: Bool = false) throws -> String

    Parameters

    onMultiaddr

    The multiaddr to serve on

    writable

    If true: will also support support POST, PUT, and DELETE methods.

  • Serves any multiaddr (api & gateway) inside Addresses.Api and Addresses.Gateway in the config (if any)

    Throws

    NodeError: If the node failed to serve

    Declaration

    Swift

    public func serve() throws

    Return Value

    The TCP/IP MultiAddr the node is serving on