Liking cljdoc? Tell your friends :D

district.server.smart-contracts


all-chunkscljs

(all-chunks from-block to-block step)

(all-chunks 100 125 10) => ([100 109] [110 119] [120 125])

(all-chunks 100 125 10) => ([100 109] [110 119] [120 125])
raw docstring

chunk->logscljs

(chunk->logs transform-fn
             from-block
             skip-log-indexes
             events
             ignore-forward?
             re-try-attempts
             [from to]
             ch-output)

contractcljs

(contract contract-key)

contract-abicljs

(contract-abi contract-key)

contract-addresscljs

(contract-address contract-key)

contract-bincljs

(contract-bin contract-key)

contract-by-addresscljs

(contract-by-address contract-address)

contract-callcljs

(contract-call contract method)
(contract-call contract method args)
(contract-call contract method args {:keys [:ignore-forward?] :as opts})

Will call a method and execute its smart contract method in the EVM without sending any transaction.

arguments:

contract parameter can be one of:

  • keyword :some-contract
  • tuple of keyword and address [:some-contract 0x1234...]
  • instance SomeContract

method is a :camel_case keyword corresponding to the smart-contract function

args is a vector of arguments for the method

opts is a map of options passed as message data

returns:

function returns a Promise resolving to the result of method call.

Will call a method and execute its smart contract method in the EVM without sending any transaction.
# arguments:
## `contract` parameter can be one of:
* keyword :some-contract
* tuple of keyword and address [:some-contract 0x1234...]
* instance SomeContract
## `method` is a :camel_case keyword corresponding to the smart-contract function
## `args` is a vector of arguments for the `method`
## `opts` is a map of options passed as message data
# returns:
function returns a Promise resolving to the result of `method` call.
raw docstring

contract-event-in-txcljs

(contract-event-in-tx contract event tx-receipt)

contract-events-in-txcljs

(contract-events-in-tx contract event tx-receipt)

contract-namecljs

(contract-name contract-key)

contract-sendcljs

(contract-send contract method)
(contract-send contract method args)
(contract-send contract
               method
               args
               {:keys [:from :gas :ignore-forward?] :as opts})

Will send a transaction to the smart contract and execute its method.

arguments:

contract parameter can be one of:

  • keyword :some-contract
  • tuple of keyword and address [:some-contract 0x1234...]
  • instance SomeContract

method is a :camel_case keyword corresponding to the smart-contract function

args is a vector of arguments for the method

opts is a map of options passed as message data

Returns:

default: returns a Promise resolving to a tx receipt

This can be configured with :output keyword of opts values: :receipt-or-nil - will return Tx receipt on success, nil in case of revert :receipt-error-pair - returns vector consisting of [tx-receipt error-object] :receipt-or-error - returns single object, Tx receipt in case of success, error-object (js/Error) in case of revert

Will send a transaction to the smart contract and execute its method.
# arguments:
## `contract` parameter can be one of:
* keyword :some-contract
* tuple of keyword and address [:some-contract 0x1234...]
* instance SomeContract
## `method` is a :camel_case keyword corresponding to the smart-contract function
## `args` is a vector of arguments for the `method`
## `opts` is a map of options passed as message data
# Returns:
  default: returns a Promise resolving to a tx receipt

  This can be configured with :output keyword of `opts` values:
    :receipt-or-nil - will return Tx receipt on success, nil in case of revert
    :receipt-error-pair - returns vector consisting of [tx-receipt error-object]
    :receipt-or-error - returns single object, Tx receipt in case of success, error-object (js/Error) in case of revert
raw docstring

contracts-pathcljs

(contracts-path provided)

fscljs


get-events-with-retrycljs

(get-events-with-retry contract-instance
                       contract
                       event
                       from
                       to
                       ch-logs
                       re-try-attempts
                       retry-count)

instancecljs

(instance contract-key)
(instance contract-key contract-key-or-addr)

instance-from-argcljs

(instance-from-arg contract & [{:keys [:ignore-forward?]}])

load-contract-filescljs

(load-contract-files contract {:keys [:contracts-build-path]})

processcljs


replay-past-events-in-ordercljs

(replay-past-events-in-order
  events
  callback
  {:keys [from-block skip-log-indexes to-block block-step chunks-parallelism
          ignore-forward? crash-on-event-fail? transform-fn on-chunk on-finish
          re-try-attempts]
   :or {chunks-parallelism 1
        re-try-attempts 3
        transform-fn identity
        on-chunk :do-nothing
        on-finish :do-nothing}
   :as opts})

Replay all past events in order. :from-block specifies the first block number events should be dispatched. :skip-log-indexes, a set of tuples like [tx log-index] for the :from-block block that should be skipped.

Replay all past events in order.
:from-block specifies the first block number events should be dispatched.
:skip-log-indexes, a set of tuples like [tx log-index] for the :from-block block that should be skipped.
raw docstring

smart-contractscljs


sort-and-skip-logscljs

(sort-and-skip-logs transform-fn from-block skip-log-indexes logs)

startcljs

(start {:keys [:contracts-var] :as opts})

subscribe-event-logscljs

(subscribe-event-logs contract
                      event
                      {:keys [:from-block :address :topics :ignore-forward?]
                       :as opts}
                      &
                      [callback])

subscribe-eventscljs

(subscribe-events contract
                  event
                  {:keys [:from-block :address :topics :ignore-forward?
                          :latest-event?]
                   :as opts}
                  callbacks)

update-contract!cljs

(update-contract! contract-key contract)

wait-for-blockcljs

(wait-for-block block-number callback)

Blocks until block with block-number arrives. callback is a nodejs style callback i.e. (fn [error data] ...)

Blocks until block with block-number arrives.
callback is a nodejs style callback i.e. (fn [error data] ...)
raw docstring

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

× close