docstring have to be placed before arglist in defn
Signed-off-by: yenda <eric@status.im>
This commit is contained in:
parent
6eb806d2c1
commit
1de40487e8
|
@ -7,28 +7,32 @@
|
||||||
:testnet "0x39d16CdB56b5a6a89e1A397A13Fe48034694316E"
|
:testnet "0x39d16CdB56b5a6a89e1A397A13Fe48034694316E"
|
||||||
:rinkeby nil})
|
:rinkeby nil})
|
||||||
|
|
||||||
(defn pack-count [web3 contract cb]
|
(defn pack-count
|
||||||
"Returns number of packs rigestered in the contract"
|
"Returns number of packs rigestered in the contract"
|
||||||
|
[web3 contract cb]
|
||||||
(ethereum/call web3
|
(ethereum/call web3
|
||||||
(ethereum/call-params contract "packCount()")
|
(ethereum/call-params contract "packCount()")
|
||||||
(fn [_ count] (cb (ethereum/hex->int count)))))
|
(fn [_ count] (cb (ethereum/hex->int count)))))
|
||||||
|
|
||||||
(defn pack-data [web3 contract pack-id cb]
|
(defn pack-data
|
||||||
"Returns vector of pack data parameters by pack id: [category owner mintable timestamp price contenthash]"
|
"Returns vector of pack data parameters by pack id: [category owner mintable timestamp price contenthash]"
|
||||||
|
[web3 contract pack-id cb]
|
||||||
(ethereum/call web3
|
(ethereum/call web3
|
||||||
(ethereum/call-params contract "getPackData(uint256)" (ethereum/int->hex pack-id))
|
(ethereum/call-params contract "getPackData(uint256)" (ethereum/int->hex pack-id))
|
||||||
(fn [_ data]
|
(fn [_ data]
|
||||||
(cb (when data (abi-spec/decode (subs data 2) ["bytes4[]" "address" "bool" "uint256" "uint256" "bytes"]))))))
|
(cb (when data (abi-spec/decode (subs data 2) ["bytes4[]" "address" "bool" "uint256" "uint256" "bytes"]))))))
|
||||||
|
|
||||||
(defn owned-tokens [web3 contract address cb]
|
(defn owned-tokens
|
||||||
"Returns vector of owned tokens ids in the contract by address"
|
"Returns vector of owned tokens ids in the contract by address"
|
||||||
|
[web3 contract address cb]
|
||||||
(ethereum/call web3
|
(ethereum/call web3
|
||||||
(ethereum/call-params contract "tokensOwnedBy(address)" (ethereum/normalized-address address))
|
(ethereum/call-params contract "tokensOwnedBy(address)" (ethereum/normalized-address address))
|
||||||
(fn [_ data]
|
(fn [_ data]
|
||||||
(cb (when data (first (abi-spec/decode (subs data 2) ["uint256[]"])))))))
|
(cb (when data (first (abi-spec/decode (subs data 2) ["uint256[]"])))))))
|
||||||
|
|
||||||
(defn token-pack-id [web3 contract token cb]
|
(defn token-pack-id
|
||||||
"Returns pack id in the contract by token id"
|
"Returns pack id in the contract by token id"
|
||||||
|
[web3 contract token cb]
|
||||||
(ethereum/call web3
|
(ethereum/call web3
|
||||||
(ethereum/call-params contract "tokenPackId(uint256)" (ethereum/int->hex token))
|
(ethereum/call-params contract "tokenPackId(uint256)" (ethereum/int->hex token))
|
||||||
(fn [_ data] (cb (ethereum/hex->int data)))))
|
(fn [_ data] (cb (ethereum/hex->int data)))))
|
||||||
|
|
Loading…
Reference in New Issue