From 1de40487e8ab1a8e8a9d8d50aada6079ec544794 Mon Sep 17 00:00:00 2001 From: yenda Date: Thu, 28 Mar 2019 12:13:57 +0100 Subject: [PATCH] docstring have to be placed before arglist in defn Signed-off-by: yenda --- src/status_im/utils/ethereum/stickers.cljs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/status_im/utils/ethereum/stickers.cljs b/src/status_im/utils/ethereum/stickers.cljs index 4a42fcb920..e22ebf2685 100644 --- a/src/status_im/utils/ethereum/stickers.cljs +++ b/src/status_im/utils/ethereum/stickers.cljs @@ -7,28 +7,32 @@ :testnet "0x39d16CdB56b5a6a89e1A397A13Fe48034694316E" :rinkeby nil}) -(defn pack-count [web3 contract cb] +(defn pack-count "Returns number of packs rigestered in the contract" + [web3 contract cb] (ethereum/call web3 (ethereum/call-params contract "packCount()") (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]" + [web3 contract pack-id cb] (ethereum/call web3 (ethereum/call-params contract "getPackData(uint256)" (ethereum/int->hex pack-id)) (fn [_ data] (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" + [web3 contract address cb] (ethereum/call web3 (ethereum/call-params contract "tokensOwnedBy(address)" (ethereum/normalized-address address)) (fn [_ data] (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" + [web3 contract token cb] (ethereum/call web3 (ethereum/call-params contract "tokenPackId(uint256)" (ethereum/int->hex token)) - (fn [_ data] (cb (ethereum/hex->int data))))) \ No newline at end of file + (fn [_ data] (cb (ethereum/hex->int data)))))