Liking cljdoc? Tell your friends :D

convex.client

Interacting with a peer via the binary protocol.

After creating a client with connect, main interactions are query and transact.

All IO functions return a future which ultimately resolves to a result received from the peer. Information from result can be extracted using:

Interacting with a peer via the binary protocol.

After creating a client with [[connect]], main interactions are [[query]] and [[transact]].

All IO functions return a future which ultimately resolves to a result received from the peer.
Information from result can be extracted using:

- [[error-code]]
- [[trace]]
- [[value]]
raw docstring

closeclj

(close connection)

Closes the given client.

See connect.

Closes the given `client`.

See [[connect]].
sourceraw docstring

connectclj

(connect)
(connect option+)

Opens a new client connection to a peer using the binary protocol.

An optional map may be provided:

KeyValueDefault
:convex.server/hostPeer IP address"localhost"
:convex.server/portPeer port18888
Opens a new client connection to a peer using the binary protocol.

An optional map may be provided:

| Key | Value | Default |
|---|---|---|
| `:convex.server/host` | Peer IP address | "localhost" |
| `:convex.server/port` | Peer port | 18888 |
sourceraw docstring

connected?clj

(connected? client)

Returns true if the given client is still connected.

Attention. Currently, does not detect severed connections (eg. server shutting down).

See close.

Returns true if the given `client` is still connected.

Attention. Currently, does not detect severed connections (eg. server shutting down).

See [[close]].
sourceraw docstring

error-codeclj

(error-code result)

Given a result dereferenced from a future, returns the error code (a cell, typically a CVM keyword).

Returns nil if no error occured.

Given a result dereferenced from a future, returns the error code (a cell, typically a CVM keyword).

Returns nil if no error occured.
sourceraw docstring

peer-statusclj

(peer-status client)

Advanced feature. The peer status is a vector of blobs which are hashes to data about the peer. For instance, blob 4 is the hash of the state. That is how state works, retrieving the hash from the peer status and then using resolve.

Advanced feature. The peer status is a vector of blobs which are hashes to data about the peer.
For instance, blob 4 is the hash of the state. That is how [[state]] works, retrieving the hash
from the peer status and then using [[resolve]].
sourceraw docstring

queryclj

(query client address cell)

Performs a query, cell representing code to execute.

Queries are a dry run: executed only by the peer, without consensus, and any state change is discarded. They do not incur fees.

Returns a future resolving to a result.

Performs a query, `cell` representing code to execute.

Queries are a dry run: executed only by the peer, without consensus, and any state change is discarded.
They do not incur fees.

Returns a future resolving to a result.
sourceraw docstring

resolveclj

(resolve client hash)
(resolve client hash store)

Given a hash (see convex.cell/hash in :project/cvm), peer looks into its database and returns the value it finds for that hash.

Returns a future resolving to a result.

Given a `hash` (see `convex.cell/hash` in `:project/cvm`), peer looks into its database and returns
the value it finds for that hash.

Returns a future resolving to a result.
sourceraw docstring

sequenceclj

(sequence client address)

Uses query to retrieve the next sequence number required for a transaction.

Eacht account has a sequence number which is incremented on each successful transaction to prevent replay attacks. Providing a transaction (eg. convex.cell/invoke from :project/cvm) with a wrong sequence number will fail.

Uses [[query]] to retrieve the next sequence number required for a transaction.

Eacht account has a sequence number which is incremented on each successful transaction to prevent replay
attacks. Providing a transaction (eg. `convex.cell/invoke` from `:project/cvm`) with a wrong sequence
number will fail.
sourceraw docstring

stateclj

(state client)

Requests the currrent network state from the peer.

Returns a future resolving to a result.

Requests the currrent network state from the peer.

Returns a future resolving to a result.
sourceraw docstring

traceclj

(trace result)

Given a result dereferenced rfom a future, returns the stacktrace (a CVM vector of CVM strings).

Returns nil if no error occured.

Given a result dereferenced rfom a future, returns the stacktrace (a CVM vector of CVM strings).

Returns nil if no error occured.
sourceraw docstring

transactclj

(transact client signed-transaction)
(transact client key-pair transaction)

Performs a transaction which is one of the following (from :project/cvm):

  • convex.cell/call for an actor call
  • convex.cell/invoke for executing code
  • convex.cell/transfer for executing a transfer of Convex Coins

Transaction must be either pre-signed or a key pair must be provided (see convex.sign namespace from :project/crypto).

It is important that transactions are created for the account matching the key pair and that the right sequence number is used. See sequence.

Performs a transaction which is one of the following (from `:project/cvm`):

- `convex.cell/call` for an actor call
- `convex.cell/invoke` for executing code
- `convex.cell/transfer` for executing a transfer of Convex Coins

Transaction must be either pre-signed or a key pair must be provided (see `convex.sign` namespace from
`:project/crypto`).

It is important that transactions are created for the account matching the key pair and that the right
sequence number is used. See [[sequence]].
sourceraw docstring

valueclj

(value result)

Given a result dereferenced from a future, returns its value (a cell).

In case of error, this will be the error message (typically a CVM string, although not necessarily).

Given a result dereferenced from a future, returns its value (a cell).

In case of error, this will be the error message (typically a CVM string, although not necessarily).
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close