Liking cljdoc? Tell your friends :D

cljs-web3-next.eth


accountscljs

(accounts provider & [callback])

block-numbercljs

(block-number provider)

This property is read only and returns the current block number.

Parameters: web3 - web3 instance callback-fn - callback with two parameters, error and result

Returns the number of the most recent block.

Example: (block-number web3-instance (fn [err res] (when-not err (println res)))) nil user> 1783426

This property is read only and returns the current block number.

Parameters:
web3        - web3 instance
callback-fn - callback with two parameters, error and result

Returns the number of the most recent block.

Example:
`(block-number web3-instance
               (fn [err res] (when-not err (println res))))`
nil
user> `1783426`
raw docstring

call!cljs

(call! web3 & [call-object default-block :as args])

Executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain.

Parameters: web3 - web3 instance call-object - A transaction object see web3.eth.sendTransaction, with the difference that for calls the from property is optional as well. default-block - If you pass this parameter it will not use the default block set with set-default-block. callback-fn - callback with two parameters, error and result

Returns the returned data of the call as string, e.g. a codes functions return value.

Example: user> (call! web3-instance {:to "0x" :data "0x"} (fn [err res] (when-not err (println res)))) nil user> 0x

Executes a message call transaction, which is directly executed in the VM of
the node, but never mined into the blockchain.

Parameters:
web3          - web3 instance
call-object   - A transaction object see web3.eth.sendTransaction, with the
                difference that for calls the from property is optional as
                well.
default-block - If you pass this parameter it will not use the default block
                set with set-default-block.
callback-fn   - callback with two parameters, error and result

Returns the returned data of the call as string, e.g. a codes functions return
value.

Example:
user> `(call! web3-instance {:to   "0x"
                             :data "0x"}
              (fn [err res] (when-not err (println res))))`
nil
user> 0x
raw docstring

clear-subscriptionscljs

(clear-subscriptions provider)

coinbasecljs

(coinbase provider)

This property is read only and returns the coinbase address where the mining rewards go to.

Parameters: web3 - web3 instance

Returns a string representing the coinbase address of the client.

Example: user> (coinbase web3-instance) "0x85d85715218895ae964a750d9a92f13a8951de3d"

This property is read only and returns the coinbase address where the mining
rewards go to.

Parameters:
web3 - web3 instance

Returns a string representing the coinbase address of the client.

Example:
user> `(coinbase web3-instance)`
"0x85d85715218895ae964a750d9a92f13a8951de3d"
raw docstring

compile-lllcljs

(compile-lll web3 & [source-string :as args])

Compiling features being deprecated https://github.com/ethereum/EIPs/issues/209

Compiling features being deprecated https://github.com/ethereum/EIPs/issues/209
raw docstring

compile-serpentcljs

(compile-serpent web3 & [source-string :as args])

Compiling features being deprecated https://github.com/ethereum/EIPs/issues/209

Compiling features being deprecated https://github.com/ethereum/EIPs/issues/209
raw docstring

compile-soliditycljs

(compile-solidity web3 & [source-string :as args])

Compiling features being deprecated https://github.com/ethereum/EIPs/issues/209

Compiling features being deprecated https://github.com/ethereum/EIPs/issues/209
raw docstring

contractcljs

(contract web3 & [abi :as args])

Important - callback has been deprecated Creates an abstract contract object for a solidity contract, which can be used to initiate contracts on an address.

Parameters: web3 - web3 instance abi - ABI array with descriptions of functions and events of the contract

Returns a contract object.

Important - callback has been deprecated
Creates an *abstract* contract object for a solidity contract, which can be used to
initiate contracts on an address.

Parameters:
web3          - web3 instance
abi           - ABI array with descriptions of functions and events of
                the contract

Returns a contract object.
raw docstring

contract-atcljs

(contract-at provider abi address)

contract-callcljs

(contract-call contract-instance method args opts)
(contract-call contract-instance method args opts callback)

contract-get-datacljs

(contract-get-data contract-instance method & args)

Gets binary data of a contract method call.

Use the kebab-cases version of the original method. E.g., function fooBar() can be addressed with :foo-bar.

Parameters: contract-instance - an instance of the contract (obtained via contract or contract-at) method - the kebab-cased version of the method args - arguments to the method

Example: user> (web3-eth/contract-call ContractInstance :multiply 5) 25

Gets binary data of a contract method call.

Use the kebab-cases version of the original method.
E.g., function fooBar() can be addressed with :foo-bar.

Parameters:
contract-instance - an instance of the contract (obtained via `contract` or
                    `contract-at`)
method            - the kebab-cased version of the method
args              - arguments to the method

Example:
user> `(web3-eth/contract-call ContractInstance :multiply 5)`
25
raw docstring

contract-newcljs

(contract-new web3 abi options tx-opts & [callback])

Deploy a contract asynchronous from a Solidity file.

Parameters: web3 - web3 instance abi - ABI array with descriptions of functions and events of the contract options - map that contains

  • :data the BIN of the contract
  • :arguments list of arguments for the contract constructor tx-opts - map that contains
  • :gas - max gas to use
  • :from account to use callback-fn - callback with two parameters, error and contract. Use (aget instance "options" "address") to obtain the address.

Example: (contract-new web3-instance abi {:data bin :arguments [1 2 3]} {:from "0x.." :gas 4000000} (fn [err contract] (if-not err (let [address (aget contract "options" "address")] (do-something-with-contract contract) (do-something-with-address address)) (println "error deploying contract" err)))) nil

Deploy a contract asynchronous from a Solidity file.

Parameters:
web3             - web3 instance
abi              - ABI array with descriptions of functions and events of
                   the contract
options          - map that contains
  - :data the BIN of the contract
  - :arguments list of arguments for the contract constructor
tx-opts - map that contains
  - :gas - max gas to use
  - :from account to use
callback-fn      - callback with two parameters, error and contract.
                   Use (aget instance "options" "address") to
                   obtain the address.

Example:
`(contract-new web3-instance
               abi
               {:data bin
                :arguments [1 2 3]}
               {:from "0x.."
                :gas  4000000}
               (fn [err contract]
                 (if-not err
                  (let [address (aget contract "options" "address")]
                    (do-something-with-contract contract)
                    (do-something-with-address address))
                  (println "error deploying contract" err))))`
 nil
raw docstring

contract-sendcljs

(contract-send contract-instance method args opts & [callback])

decode-logcljs

(decode-log provider abi data topics)

default-accountcljs

(default-account provider)

Gets the default address that is used for the following methods (optionally you can overwrite it by specifying the :from key in their options map):

  • send-transaction!
  • call!

Parameters: web3 - web3 instance

Returns the default address HEX string.

Example: user> (default-account web3-instance) "0x85d85715218895ae964a750d9a92f13a8951de3d"

Gets the default address that is used for the following methods (optionally
you can overwrite it by specifying the :from key in their options map):

- `send-transaction!`
- `call!`

Parameters:
web3 - web3 instance

Returns the default address HEX string.

Example:
user> `(default-account web3-instance)`
"0x85d85715218895ae964a750d9a92f13a8951de3d"
raw docstring

default-blockcljs

(default-block provider)

This default block is used for the following methods (optionally you can override it by passing the default-block parameter):

  • get-balance
  • get-code
  • get-transactionCount
  • get-storageAt
  • call
  • contract-call
  • estimate-gas

Parameters: web3 - web3 instance

Returns one of:

  • a block number
  • "earliest", the genisis block
  • "latest", the latest block (current head of the blockchain)
  • "pending", the currently mined block (including pending transactions)

Example: user> (default-block web3-instance) "latest"

This default block is used for the following methods (optionally you can
override it by passing the default-block parameter):

- `get-balance`
- `get-code`
- `get-transactionCount`
- `get-storageAt`
- `call`
- `contract-call`
- `estimate-gas`

Parameters:
web3 - web3 instance

Returns one of:
- a block number
- "earliest", the genisis block
- "latest", the latest block (current head of the blockchain)
- "pending", the currently mined block (including pending transactions)

Example:
user> `(default-block web3-instance)`
"latest"
raw docstring

encode-abicljs

(encode-abi contract-instance method args)

estimate-gascljs

(estimate-gas web3 & [call-object :as args])

Executes a message call or transaction, which is directly executed in the VM of the node, but never mined into the blockchain and returns the amount of the gas used.

Parameters: web3 - web3 instance call-object - See (send-transaction!), except that all properties are optional. callback-fn - callback with two parameters, error and result

Returns the used gas for the simulated call/transaction.

Example: user> (estimate-gas web3-instance {:to "0x135a7de83802408321b74c322f8558db1679ac20", :data "0x135a7de83802408321b74c322f8558db1679ac20"} (fn [err res] (when-not err (println res)))) nil user> 22361

Executes a message call or transaction, which is directly executed in the VM
of the node, but never mined into the blockchain and returns the amount of the
gas used.

Parameters:
web3          - web3 instance
call-object   - See `(send-transaction!)`, except that all properties are
                optional.
callback-fn   - callback with two parameters, error and result

Returns the used gas for the simulated call/transaction.

Example:
user> `(estimate-gas web3-instance
         {:to   "0x135a7de83802408321b74c322f8558db1679ac20",
          :data "0x135a7de83802408321b74c322f8558db1679ac20"}
         (fn [err res] (when-not err (println res))))`
nil
user> 22361
raw docstring

ethcljs

(eth provider)

Gets eth object from web3-instance.

Parameter: web3 - web3 instance

Gets eth object from web3-instance.

Parameter:
web3 - web3 instance
raw docstring

extendcljs

(extend web3 & args)

filtercljs

(filter web3 & args)

Parameters:

Important: filter functionality is deprecated

web3 - web3 instance block-or-transaction - The string "latest" or "pending" to watch for changes in the latest block or pending transactions respectively. Or a filter options object as follows:

from-block: Number|String - The number of the earliest block (latest may be given to mean the most recent and pending currently mining, block). By default latest. to-block: Number|String - The number of the latest block (latest may be given to mean the most recent and pending currently mining, block). By default latest.

address: String - An address or a list of addresses to only get logs from particular account(s).

:topics: Array of Strings - An array of values which must each appear in the log entries. The order is important, if you want to leave topics out use null, e.g. [null, '0x00...']. You can also pass another array for each topic with options for that topic e.g. [null, ['option1', 'option2']]

Watch callback return value

String - When using the "latest" parameter, it returns the block hash of the last incoming block.

String - When using the "pending" parameter, it returns a transaction hash of the most recent pending transaction. Object - When using manual filter options, it returns a log object as follows:

  logIndex: Number - integer of the log index position in the block. null
                     when its pending log.
  transactionIndex: Number - integer of the transactions index position log
                             was created from. null when its pending log.
  transactionHash: String, 32 Bytes - hash of the transactions this log was
                                      created from. null when its pending log.
  blockHash: String, 32 Bytes - hash of the block where this log was in. null
                                when its pending. null when its pending log.
  blockNumber: Number - the block number where this log was in. null when its
                        pending. null when its pending log.
  address: String, 32 Bytes - address from which this log originated.
  data: String - contains one or more 32 Bytes non-indexed arguments of the log.

  topics: Array of Strings - Array of 0 to 4 32 Bytes DATA of indexed log
                             arguments. (In solidity: The first topic is the hash
                             of the signature of the event, except if you declared the
                             event with the anonymous specifier.)

Note for event filter return values see Contract Events at https://github.com/ethereum/wiki/wiki/JavaScript-API#contract-events

Parameters:

Important: filter functionality is deprecated

web3          - web3 instance
block-or-transaction  - The string "latest" or "pending" to watch
                        for changes in the latest block or pending
                        transactions respectively. Or a filter options
                        object as follows:

  from-block: Number|String - The number of the earliest block (latest may be
                              given to mean the most recent and pending
                              currently mining, block). By default
                             latest.
  to-block: Number|String   - The number of the latest block (latest may be
                              given to mean the most recent and pending
                              currently mining, block). By default latest.

  address: String           - An address or a list of addresses to only get
                              logs from particular account(s).

  :topics: Array of Strings - An array of values which must each appear in the
                              log entries. The order is important, if you want
                              to leave topics out use null, e.g.
                              `[null, '0x00...']`. You can also pass another array
                              for each topic with options for that topic e.g.
                              `[null, ['option1', 'option2']]`

Watch callback return value

  String - When using the "latest" parameter, it returns the block hash of
           the last incoming block.

  String - When using the "pending" parameter, it returns a transaction hash
           of the most recent pending transaction.
  Object - When using manual filter options, it returns a log object as follows:

      logIndex: Number - integer of the log index position in the block. null
                         when its pending log.
      transactionIndex: Number - integer of the transactions index position log
                                 was created from. null when its pending log.
      transactionHash: String, 32 Bytes - hash of the transactions this log was
                                          created from. null when its pending log.
      blockHash: String, 32 Bytes - hash of the block where this log was in. null
                                    when its pending. null when its pending log.
      blockNumber: Number - the block number where this log was in. null when its
                            pending. null when its pending log.
      address: String, 32 Bytes - address from which this log originated.
      data: String - contains one or more 32 Bytes non-indexed arguments of the log.

      topics: Array of Strings - Array of 0 to 4 32 Bytes DATA of indexed log
                                 arguments. (In solidity: The first topic is the hash
                                 of the signature of the event, except if you declared the
                                 event with the anonymous specifier.)

Note for event filter return values see Contract Events at
https://github.com/ethereum/wiki/wiki/JavaScript-API#contract-events
raw docstring

gas-pricecljs

(gas-price provider)

This property is read only and returns the current gas price. The gas price is determined by the x latest blocks median gas price.

Parameters: web3 - web3 instance callback-fn - callback with two parameters, error and result

Returns a BigNumber instance of the current gas price in wei.

Example: user> (gas-price web3-instance (fn [err res] (when-not err (println res)))) nil user> #object[e 90000000000]

This property is read only and returns the current gas price. The gas price
is determined by the x latest blocks median gas price.

Parameters:
web3        - web3 instance
callback-fn - callback with two parameters, error and result

Returns a BigNumber instance of the current gas price in wei.

Example:
user> `(gas-price web3-instance (fn [err res] (when-not err (println res))))`
nil
user> #object[e 90000000000]
raw docstring

get-balancecljs

(get-balance provider & [address default-block :as args])

Get the balance of an address at a given block.

Parameters: web3 - web3 instance address - The address to get the balance of. default-block - If you pass this parameter it will not use the default block set with set-default-block. callback-fn - callback with two parameters, error and result

Returns a String of the current balance for the given address in wei.

Example: user> (get-balance web3-instance "0x85d85715218895ae964a750d9a92f13a8951de3d" "latest" (fn [err res] (when-not err (println res)))) nil user> "1729597111000000000"

Get the balance of an address at a given block.

Parameters:
web3          - web3 instance
address       - The address to get the balance of.
default-block - If you pass this parameter it will not use the default block
                set with set-default-block.
callback-fn   - callback with two parameters, error and result

Returns a String of the current balance for the given address in
wei.

Example:
user> `(get-balance web3-instance
                    "0x85d85715218895ae964a750d9a92f13a8951de3d"
                    "latest"
                    (fn [err res] (when-not err (println res))))`
nil
user> "1729597111000000000"
raw docstring

get-blockcljs

(get-block provider block-hash-or-number return-transactions? & [callback])

get-block-numbercljs

(get-block-number provider & [callback])

get-block-transaction-countcljs

(get-block-transaction-count web3 & [block-hash-or-number :as args])

Returns the number of transaction in a given block.

Parameters web3 - web3 instance block-hash-or-number - The block number or hash. Or the string "earliest", "latest" or "pending" as in the default block parameter. callback-fn - callback with two parameters, error and result

Example: user> (get-block-transaction-count web3-instance 0 (fn [err res] (when-not err (println res)))) nil user> 0

Returns the number of transaction in a given block.

Parameters
web3                 - web3 instance
block-hash-or-number - The block number or hash. Or the string "earliest",
                       "latest" or "pending" as in the default block
                       parameter.
callback-fn          - callback with two parameters, error and result

Example:
user> `(get-block-transaction-count
         web3-instance
         0
         (fn [err res] (when-not err (println res))))`
nil
user> 0
raw docstring

get-chain-idcljs

(get-chain-id provider & [callback])

get-codecljs

(get-code web3 & [address default-block :as args])

Get the code at a specific address.

Parameters: web3 - web3 instance address - The address to get the code from. default-block - If you pass this parameter it will not use the default block set with get-default-block!. callback-fn - callback with two parameters, error and result

Returns the data at given address HEX string.

Example: user> (get-code web3-instance "0x85d85715218895ae964a750d9a92f13a8951de3d 0 "latest" (fn [err res] (when-not err (println res)))) nil user> 0x

Get the code at a specific address.

Parameters:
web3          - web3 instance
address       - The address to get the code from.
default-block - If you pass this parameter it will not use the default block set
                with `get-default-block!`.
callback-fn   - callback with two parameters, error and result

Returns the data at given address HEX string.

Example:
user> (get-code web3-instance
                "0x85d85715218895ae964a750d9a92f13a8951de3d
                0
                "latest"
                (fn [err res] (when-not err (println res))))
nil
user> `0x`
raw docstring

get-compilecljs

(get-compile web3)

Gets compile object from web3-instance.

Parameter: web3 - web3 instance

Gets compile object from web3-instance.

Parameter:
web3 - web3 instance
raw docstring

get-compilerscljs

(get-compilers web3 & args)

Compiling features being deprecated https://github.com/ethereum/EIPs/issues/209

Compiling features being deprecated https://github.com/ethereum/EIPs/issues/209
raw docstring

get-past-eventscljs

(get-past-events contract-instance event opts & [callback])

get-past-logscljs

(get-past-logs provider opts & [callback])

get-storage-atcljs

(get-storage-at web3 & [address position default-block :as args])

Get the storage at a specific position of an address.

Parameters: web3 - web3 instance address - The address to get the storage from. position - The index position of the storage. default-block - If you pass this parameter it will not use the default block set with web3.eth.defaultBlock. callback-fn - callback with two parameters, error and result

Returns the value in storage at the given position.

Example: user> (get-storage-at web3-instance "0x85d85715218895ae964a750d9a92f13a8951de3d" 0 "latest" (fn [err res] (when-not err (println res)))) nil user> "0x0000000000000000000000000000000000000000000000000000000000000000"

Get the storage at a specific position of an address.

Parameters:
web3          - web3 instance
address       - The address to get the storage from.
position      - The index position of the storage.
default-block - If you pass this parameter it will not use the default block
                set with web3.eth.defaultBlock.
callback-fn   - callback with two parameters, error and result

Returns the value in storage at the given position.

Example:
user> `(get-storage-at web3-instance
                       "0x85d85715218895ae964a750d9a92f13a8951de3d"
                       0
                       "latest"
                       (fn [err res] (when-not err (println res))))`
nil
user> "0x0000000000000000000000000000000000000000000000000000000000000000" 
raw docstring

get-transactioncljs

(get-transaction web3 & [transaction-hash :as args])

Returns a transaction matching the given transaction hash.

Parameters: web3 - web3 instance transaction-hash - The transaction hash. callback-fn - callback with two parameters, error and result

Returns a transaction object its hash transaction-hash:

  • hash: String, 32 Bytes - hash of the transaction.
  • nonce: Number - the number of transactions made by the sender prior to this one.
  • block-hash: String, 32 Bytes - hash of the block where this transaction was in. null when its pending.
  • block-number: Number - block number where this transaction was in. null when its pending.
  • transaction-index: Number - integer of the transactions index position in the block. null when its pending.
  • from: String, 20 Bytes - address of the sender.
  • to: String, 20 Bytes - address of the receiver. null when its a contract creation transaction.
  • value: BigNumber - value transferred in Wei.
  • gas-price: BigNumber - gas price provided by the sender in Wei.
  • gas: Number - gas provided by the sender.
  • input: String - the data sent along with the transaction.

Example: user> (get-transaction web3-instance "0x..." (fn [err res] (when-not err (println res)))) nil user> {:r 0x... :v 0x2a :hash 0xf... :transaction-index 3 ... (...) :to 0x...}

Returns a transaction matching the given transaction hash.

Parameters:
web3             - web3 instance
transaction-hash - The transaction hash.
callback-fn      - callback with two parameters, error and result

Returns a transaction object its hash transaction-hash:

- hash: String, 32 Bytes - hash of the transaction.
- nonce: Number - the number of transactions made by the sender prior to this
  one.
- block-hash: String, 32 Bytes - hash of the block where this transaction was
                                 in. null when its pending.
- block-number: Number - block number where this transaction was in. null when
                         its pending.
- transaction-index: Number - integer of the transactions index position in the
                              block. null when its pending.
- from: String, 20 Bytes - address of the sender.
- to: String, 20 Bytes - address of the receiver. null when its a contract
                         creation transaction.
- value: BigNumber - value transferred in Wei.
- gas-price: BigNumber - gas price provided by the sender in Wei.
- gas: Number - gas provided by the sender.
- input: String - the data sent along with the transaction.

Example:
user> `(get-transaction
         web3-instance
         "0x..."
         (fn [err res] (when-not err (println res))))`
nil
user> {:r 0x...
       :v 0x2a
       :hash 0xf...
       :transaction-index 3 ...
       (...)
       :to 0x...}
raw docstring

get-transaction-countcljs

(get-transaction-count web3 & [address default-block :as args])

Get the numbers of transactions sent from this address.

Parameters: web3 - web3 instance address - The address to get the numbers of transactions from. default-block - If you pass this parameter it will not use the default block set with set-default-block. callback-fn - callback with two parameters, error and result

Returns the number of transactions sent from the given address.

Example: user> (get-transaction-count web3-instance "0x8" (fn [err res] (when-not err (println res)))) nil user> 16

Get the numbers of transactions sent from this address.

Parameters:
web3          - web3 instance
address       - The address to get the numbers of transactions from.
default-block - If you pass this parameter it will not use the default block
                set with set-default-block.
callback-fn   - callback with two parameters, error and result

Returns the number of transactions sent from the given address.

Example:
user> `(get-transaction-count web3-instance "0x8"
         (fn [err res] (when-not err (println res))))`
nil
user> 16
raw docstring

get-transaction-from-blockcljs

(get-transaction-from-block web3 & [block-hash-or-number index :as args])

Returns a transaction based on a block hash or number and the transactions index position.

Parameters: web3 - web3 instance block-hash-or-number - A block number or hash. Or the string "earliest", "latest" or "pending" as in the default block parameter. index - The transactions index position. callback-fn - callback with two parameters, error and result Number - The transactions index position.

Returns a transaction object, see (get-transaction)

Example: user> (get-transaction-from-block web3-instance 1799402 0 (fn [err res] (when-not err (println res)))) nil user> {:r 0x... :v 0x2a :hash 0xf... :transaction-index 0 ... (...) :to 0x...}

Returns a transaction based on a block hash or number and the transactions
index position.

Parameters:
web3                 - web3 instance
block-hash-or-number - A block number or hash. Or the string "earliest",
                       "latest" or "pending" as in the default block
                       parameter.
index                - The transactions index position.
callback-fn          - callback with two parameters, error and result
Number               - The transactions index position.

Returns a transaction object, see `(get-transaction)`

Example:
user> `(get-transaction-from-block
         web3-instance
         1799402
         0
         (fn [err res] (when-not err (println res))))`
nil
user> {:r 0x...
       :v 0x2a
       :hash 0xf...
       :transaction-index 0 ...
       (...)
       :to 0x...}
raw docstring

get-transaction-receiptcljs

(get-transaction-receipt provider tx-hash & [callback])

get-unclecljs

(get-uncle web3
           &
           [block-hash-or-number uncle-number return-transaction-objects? :as
            args])

Returns a blocks uncle by a given uncle index position. Parameters

Parameters: web3 - web3 instance block-hash-or-number - The block number or hash. Or the string "earliest", "latest" or "pending" as in the default block parameter uncle-number - The index position of the uncle return-transaction-objects? - If true, the returned block will contain all transactions as objects, if false it will only contains the transaction hashes default-block - If you pass this parameter it will not use the default block set with (set-default-block) callback-fn - callback with two parameters, error and result

Returns the returned uncle. For a return value see (get-block).

Note: An uncle doesn't contain individual transactions.

Returns a blocks uncle by a given uncle index position.
Parameters

Parameters:
web3                        - web3 instance
block-hash-or-number        - The block number or hash. Or the string
                              "earliest", "latest" or "pending" as in
                              the default block parameter
uncle-number                - The index position of the uncle
return-transaction-objects? - If true, the returned block will contain all
                              transactions as objects, if false it will only
                              contains the transaction hashes
default-block               - If you pass this parameter it will not use the
                              default block set with (set-default-block)
callback-fn                 - callback with two parameters, error and result

Returns the returned uncle. For a return value see `(get-block)`.

Note: An uncle doesn't contain individual transactions.
raw docstring

hashratecljs

(hashrate provider)

This property is read only and returns the number of hashes per second that the node is mining with.

Parameters: web3 - web3 instance

Returns a number representing the hashes per second.

user> (hashrate web3-instance (fn [err res] (when-not err (println res)))) nil user> 0

This property is read only and returns the number of hashes per second that
the node is mining with.

Parameters:
web3 - web3 instance

Returns a number representing the hashes per second.

user> `(hashrate web3-instance (fn [err res] (when-not err (println res))))`
nil
user> 0
raw docstring

ibancljs

(iban provider)

Gets iban object from web3-instance.

Parameter: web3 - web3 instance

Gets iban object from web3-instance.

Parameter:
web3 - web3 instance
raw docstring

is-listening?cljs

(is-listening? provider & [callback])

mining?cljs

(mining? provider)

This property is read only and says whether the node is mining or not.

Parameters: web3 - web3 instance

Returns a boolean: true if the client is mining, otherwise false.

Example: (mining? web3-instance (fn [err res] (when-not err (println res)))) nil user> false

This property is read only and says whether the node is mining or not.

Parameters:
web3 - web3 instance

Returns a boolean: true if the client is mining, otherwise false.

Example:
`(mining? web3-instance (fn [err res] (when-not err (println res))))`
nil
user> `false`
raw docstring

nameregcljs

(namereg web3)

Returns GlobalRegistrar object.

See https://github.com/ethereum/web3.js/blob/master/example/namereg.html for an example in JavaScript.

Returns GlobalRegistrar object.

See https://github.com/ethereum/web3.js/blob/master/example/namereg.html
for an example in JavaScript.
raw docstring

oncljs

(on event-emitter event callback)

registercljs

(register web3 address)

(Not Implemented yet) Registers the given address to be included in accounts. This allows non-private-key owned accounts to be associated as an owned account (e.g., contract wallets).

Parameters: web3 - web3 instance address - string representing the address callback-fn - callback with two parameters, error and result.

(Not Implemented yet) Registers the given address to be included in
`accounts`. This allows non-private-key owned accounts to be associated
as an owned account (e.g., contract wallets).

Parameters:
web3        - web3 instance
address     - string representing the address
callback-fn - callback with two parameters, error and result.
raw docstring

send-iban-transaction!cljs

(send-iban-transaction! web3 & [from iban-address value cb :as args])

Sends IBAN transaction from user account to destination IBAN address.

note: IBAN protocol seems to be soft-deprecated

Parameters: web3 - web3 instance from - address from which we want to send transaction iban-address - IBAN address to which we want to send transaction value - value that we want to send in IBAN transaction callback-fn - callback with two parameters, error and result

Note: uses smart contract to transfer money to IBAN account.

Example: user> (send-iban-transaction! '0xx' 'NL88YADYA02' 0x100 (fn [err res] (prn res)))

Sends IBAN transaction from user account to destination IBAN address.

note: IBAN protocol seems to be soft-deprecated

Parameters:
web3          - web3 instance
from          - address from which we want to send transaction
iban-address  - IBAN address to which we want to send transaction
value         - value that we want to send in IBAN transaction
callback-fn   - callback with two parameters, error and result

Note: uses smart contract to transfer money to IBAN account.

Example:
user> `(send-iban-transaction! '0xx'
                               'NL88YADYA02'
                                0x100
                                (fn [err res] (prn res)))`
raw docstring

send-raw-transaction!cljs

(send-raw-transaction! web3 & [signed-transaction-data :as args])

Sends an already signed transaction. For example can be signed using: https://github.com/SilentCicero/ethereumjs-accounts

Parameters: web3 - web3 instance signed-transaction-data - Signed transaction data in HEX format

callback-fn - callback with two parameters, error and result

Returns the 32 Bytes transaction hash as HEX string.

If the transaction was a contract creation use (get-transaction-receipt) to get the contract address, after the transaction was mined.

See https://github.com/ethereum/wiki/wiki/JavaScript-API#example-46 for a JavaScript example.

Sends an already signed transaction. For example can be signed using:
https://github.com/SilentCicero/ethereumjs-accounts

Parameters:
web3                    - web3 instance
signed-transaction-data - Signed transaction data in HEX format

callback-fn             - callback with two parameters, error and result

Returns the 32 Bytes transaction hash as HEX string.

If the transaction was a contract creation use `(get-transaction-receipt)`
to get the contract address, after the transaction was mined.

See https://github.com/ethereum/wiki/wiki/JavaScript-API#example-46 for a
JavaScript example.
raw docstring

send-signed-transactioncljs


send-transaction!cljs

(send-transaction! web3 transaction-object & [callback])

Sends a transaction to the network.

Parameters: web3 - web3 instance transaction-object - The transaction object to send:

:from: String - The address for the sending account. Uses the default-account property, if not specified.

:to: String - (optional) The destination address of the message, left undefined for a contract-creation transaction.

:value - (optional) The value transferred for the transaction in Wei, also the endowment if it's a contract-creation transaction.

:gas: - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded). :gas-price: - (optional, default: To-Be-Determined) The price of gas for this transaction in wei, defaults to the mean network gas price. :data: - (optional) Either a byte string containing the associated data of the message, or in the case of a contract-creation transaction, the initialisation code. :nonce: - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. callback-fn - callback with two parameters, error and result, where result is the transaction hash

Returns the 32 Bytes transaction hash as HEX string.

If the transaction was a contract creation use (get-transaction-receipt) to get the contract address, after the transaction was mined.

Example: user> (send-transaction! web3-instance {:to "0x.."} (fn [err res] (when-not err (println res)))) nil user> 0x...

Sends a transaction to the network.

Parameters:
web3               - web3 instance
transaction-object - The transaction object to send:

  :from: String - The address for the sending account. Uses the
                  `default-account` property, if not specified.

  :to: String   - (optional) The destination address of the message, left
                             undefined for a contract-creation
                             transaction.

  :value        - (optional) The value transferred for the transaction in
                             Wei, also the endowment if it's a
                             contract-creation transaction.

  :gas:         - (optional, default: To-Be-Determined) The amount of gas
                  to use for the transaction (unused gas is refunded).
  :gas-price:   - (optional, default: To-Be-Determined) The price of gas
                  for this transaction in wei, defaults to the mean network
                  gas price.
  :data:        - (optional) Either a byte string containing the associated
                  data of the message, or in the case of a contract-creation
                  transaction, the initialisation code.
  :nonce:       - (optional) Integer of a nonce. This allows to overwrite your
                             own pending transactions that use the same nonce.
callback-fn   - callback with two parameters, error and result, where result
                is the transaction hash

Returns the 32 Bytes transaction hash as HEX string.

If the transaction was a contract creation use `(get-transaction-receipt)` to
get the contract address, after the transaction was mined.

Example:
user> (send-transaction! web3-instance {:to "0x.."}
        (fn [err res] (when-not err (println res))))
nil
user> 0x...
raw docstring

set-default-account!cljs

(set-default-account! provider hex-str)

Sets the default address that is used for the following methods (optionally you can overwrite it by specifying the :from key in their options map):

  • send-transaction!
  • call!

Parameters: web3 - web3 instance hex-str - Any 20 bytes address you own, or where you have the private key for

Returns a 20 bytes HEX string representing the currently set address.

Example: user> (set-default-account! web3-instance "0x85d85715218895ae964a750d9a92f13a8951de3d") "0x85d85715218895ae964a750d9a92f13a8951de3d"

Sets the default address that is used for the following methods (optionally
you can overwrite it by specifying the :from key in their options map):

- `send-transaction!`
- `call!`

Parameters:
web3    - web3 instance
hex-str - Any 20 bytes address you own, or where you have the private key for


Returns a 20 bytes HEX string representing the currently set address.

Example:
user> (set-default-account! web3-instance
                            "0x85d85715218895ae964a750d9a92f13a8951de3d")
"0x85d85715218895ae964a750d9a92f13a8951de3d"
raw docstring

set-default-block!cljs

(set-default-block! provider block)

Sets default block that is used for the following methods (optionally you can override it by passing the default-block parameter):

  • get-balance
  • get-code
  • get-transactionCount
  • get-storageAt
  • call
  • contract-call
  • estimate-gas

Parameters: web3 - web3 instance block - one of: - a block number - "earliest", the genisis block - "latest", the latest block (current head of the blockchain) - "pending", the currently mined block (including pending transactions)

Example: user> (set-default-block! web3-instance "earliest") "earliest"

Sets default block that is used for the following methods (optionally you can
override it by passing the default-block parameter):

- `get-balance`
- `get-code`
- `get-transactionCount`
- `get-storageAt`
- `call`
- `contract-call`
- `estimate-gas`

Parameters:
web3  - web3 instance
block - one of:
          - a block number
          - "earliest", the genisis block
          - "latest", the latest block (current head of the blockchain)
          - "pending", the currently mined block (including pending
            transactions)

Example:
user> `(set-default-block! web3-instance "earliest")`
"earliest"
raw docstring

signcljs

(sign web3 & [address data-to-sign :as args])

Signs data from a specific account. This account needs to be unlocked.

Parameters: web3 - web3 instance address - The address to sign with data-to-sign - Data to sign callback-fn - callback with two parameters, error and result

Returns the signed data.

After the hex prefix, characters correspond to ECDSA values like this:

r = signature[0:64] s = signature[64:128] v = signature[128:130]

Note that if you are using ecrecover, v will be either "00" or "01". As a result, in order to use this value, you will have to parse it to an integer and then add 27. This will result in either a 27 or a 28.

Example: user> (sign web3-instance "0x135a7de83802408321b74c322f8558db1679ac20" "0x9dd2c369a187b4e6b9c402f030e50743e619301ea62aa4c0737d4ef7e10a3d49" (fn [err res] (when-not err (println res))))

user> 0x3...

Signs data from a specific account. This account needs to be unlocked.

Parameters:
web3          - web3 instance
address       - The address to sign with
data-to-sign  - Data to sign
callback-fn   - callback with two parameters, error and result

Returns the signed data.

After the hex prefix, characters correspond to ECDSA values like this:

r = signature[0:64]
s = signature[64:128]
v = signature[128:130]

Note that if you are using ecrecover, v will be either "00" or "01". As a
result, in order to use this value, you will have to parse it to an integer
and then add 27. This will result in either a 27 or a 28.

Example:
user> `(sign web3-instance
             "0x135a7de83802408321b74c322f8558db1679ac20"
             "0x9dd2c369a187b4e6b9c402f030e50743e619301ea62aa4c0737d4ef7e10a3d49"
             (fn [err res] (when-not err (println res))))`

user> 0x3...
raw docstring

sign-transactioncljs

(sign-transaction web3 & [sign-tx-params private-key signed-tx :as args])

Sign a transaction. Method is not documented in the web3.js docs. Not sure if it is safe.

Parameters: web3 - web3 instance sign-tx-params - Parameters of transaction See (send-transaction!) private-key - Private key to sign the transaction with callback-fn - callback with two parameters, error and result

Returns signed transaction data.

Sign a transaction. Method is not documented in the web3.js docs. Not sure if it is safe.

Parameters:
web3           - web3 instance
sign-tx-params - Parameters of transaction
                 See `(send-transaction!)`
private-key    - Private key to sign the transaction with
callback-fn    - callback with two parameters, error and result

Returns signed transaction data.
raw docstring

stop-watching!cljs

(stop-watching! filter & args)

Stops and uninstalls the filter.

Arguments: filter - the filter to stop

Stops and uninstalls the filter.

Arguments:
filter - the filter to stop
raw docstring

subscribe-blockscljs

(subscribe-blocks provider & [callback])

subscribe-eventscljs

(subscribe-events contract-instance event opts & [callback])

subscribe-logscljs

(subscribe-logs provider opts & [callback])

syncingcljs

(syncing provider)

This property is read only and returns the either a sync object, when the node is syncing or false.

Parameters: web3 - web3 instance callback-fn - callback with two parameters, error and result

Returns a sync object as follows, when the node is currently syncing or false:

  • startingBlock: The block number where the sync started.
  • currentBlock: The block number where at which block the node currently synced to already.
  • highestBlock: The estimated block number to sync to.

Example: user> (syncing web3-instance (fn [err res] (when-not err (println res)))) nil user> false

This property is read only and returns the either a sync object, when the
node is syncing or false.

Parameters:
web3        - web3 instance
callback-fn - callback with two parameters, error and result

Returns a sync object as follows, when the node is currently syncing or false:
- startingBlock: The block number where the sync started.
- currentBlock:  The block number where at which block the node currently
                 synced to already.
- highestBlock:  The estimated block number to sync to.

Example:
user> `(syncing web3-instance (fn [err res] (when-not err (println res))))`
nil
user> `false`
raw docstring

syncing?cljs


unregistercljs

(unregister web3 address)

(Not Implemented yet) Unregisters a given address.

Parameters: web3 - web3 instance address - string representing the address callback-fn - callback with two parameters, error and result.

(Not Implemented yet) Unregisters a given address.

Parameters:
web3        - web3 instance
address     - string representing the address
callback-fn - callback with two parameters, error and result.
raw docstring

unsubscribecljs

(unsubscribe subscription & [callback])

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

× close