首页 > 解决方案 > 发布版本上的“未捕获的 TypeError:d.methods.nl 不是函数”

问题描述

我从 ClojureScript 调用以太坊上的交易。在开发版本上它工作正常,但在发布版本上我总是收到这种错误:

Uncaught TypeError: d.methods.nl is not a functionUncaught TypeError: b.methods.pl is not a function 等等。

我发现只有一个事务调用有效,我只看到与其他事务调用的一个区别:没有参数。

这是产生错误消息的代码示例(在 send 方法中):

(defn end-staking [vampire-address graph-stake-id rewards-token-decimals]
  (let [vampire (h/get-vampire-instance vampire-address)
        account @(rf/subscribe [::web3-subs/web3-account])
        stake-id (subs graph-stake-id 43)
        step (get-in @values [graph-stake-id :step])]
    (-> (.send
          (.endStaking (.-methods vampire)
            stake-id)
          #js {:from account
               :gasLimit "5000000"})
        (.then (fn [receipt]
                 (js/console.log "receipt end-staking" receipt)))
        (.catch (fn [error]
                  (h/hadle-transaction-error error))))))

这是有效的代码:

(defn close [vampire-address coffin-address]
  (let [coffin (h/get-coffin-instance coffin-address)
        account @(rf/subscribe [::web3-subs/web3-account])]
    (-> (.send
          (.close (.-methods coffin))
          #js {:from account})
        (.then (fn [receipt]
                 (js/console.log "receipt close" receipt)))
        (.catch (fn [error]
                  (h/hadle-transaction-error error))))))

标签: clojurescript

解决方案


推荐阅读