parent
ffdbedd049
commit
52b7bcd291
|
@ -556,6 +556,81 @@
|
||||||
{:permissions [:read]
|
{:permissions [:read]
|
||||||
:value :extensions/ethereum-cancel-filter
|
:value :extensions/ethereum-cancel-filter
|
||||||
:arguments {:id :string}}
|
:arguments {:id :string}}
|
||||||
|
'ethereum.erc20/total-supply
|
||||||
|
{:permissions [:read]
|
||||||
|
:value :extensions/ethereum-erc20-total-supply
|
||||||
|
:arguments {:contract :string
|
||||||
|
:on-result :event}}
|
||||||
|
'ethereum.erc20/balance-of
|
||||||
|
{:permissions [:read]
|
||||||
|
:value :extensions/ethereum-erc20-balance-of
|
||||||
|
:arguments {:contract :string
|
||||||
|
:token-owner :string
|
||||||
|
:on-result :event}}
|
||||||
|
'ethereum.erc20/transfer
|
||||||
|
{:permissions [:read]
|
||||||
|
:value :extensions/ethereum-erc20-transfer
|
||||||
|
:arguments {:contract :string
|
||||||
|
:to :string
|
||||||
|
:value :number
|
||||||
|
:on-result :event}}
|
||||||
|
'ethereum.erc20/transfer-from
|
||||||
|
{:permissions [:read]
|
||||||
|
:value :extensions/ethereum-erc20-transfer-from
|
||||||
|
:arguments {:contract :string
|
||||||
|
:from :string
|
||||||
|
:to :string
|
||||||
|
:value :number
|
||||||
|
:on-result :event}}
|
||||||
|
'ethereum.erc20/approve
|
||||||
|
{:permissions [:read]
|
||||||
|
:value :extensions/ethereum-erc20-approve
|
||||||
|
:arguments {:contract :string
|
||||||
|
:spender :string
|
||||||
|
:value :number
|
||||||
|
:on-result :event}}
|
||||||
|
'ethereum.erc20/allowance
|
||||||
|
{:permissions [:read]
|
||||||
|
:value :extensions/ethereum-erc20-allowance
|
||||||
|
:arguments {:contract :string
|
||||||
|
:token-owner :string
|
||||||
|
:spender :string
|
||||||
|
:on-result :event}}
|
||||||
|
'ethereum.erc721/owner-of
|
||||||
|
{:permissions [:read]
|
||||||
|
:value :extensions/ethereum-erc721-owner-of
|
||||||
|
:arguments {:contract :string
|
||||||
|
:token-id :string
|
||||||
|
:on-result :event}}
|
||||||
|
'ethereum.erc721/is-approved-for-all
|
||||||
|
{:permissions [:read]
|
||||||
|
:value :extensions/ethereum-erc721-is-approved-for-all
|
||||||
|
:arguments {:contract :string
|
||||||
|
:owner :string
|
||||||
|
:operator :string
|
||||||
|
:on-result :event}}
|
||||||
|
'ethereum.erc721/get-approved
|
||||||
|
{:permissions [:read]
|
||||||
|
:value :extensions/ethereum-erc721-get-approved
|
||||||
|
:arguments {:contract :string
|
||||||
|
:token-id :string
|
||||||
|
:on-result :event}}
|
||||||
|
'ethereum.erc721/set-approval-for-all
|
||||||
|
{:permissions [:read]
|
||||||
|
:value :extensions/ethereum-erc721-set-approval-for-all
|
||||||
|
:arguments {:contract :string
|
||||||
|
:operator :string
|
||||||
|
:approved :boolean
|
||||||
|
:on-result :event}}
|
||||||
|
'ethereum.erc721/safe-transfer-from
|
||||||
|
{:permissions [:read]
|
||||||
|
:value :extensions/ethereum-erc721-safe-transfer-from
|
||||||
|
:arguments {:contract :string
|
||||||
|
:from :string
|
||||||
|
:to :string
|
||||||
|
:token-id :string
|
||||||
|
:data? :string
|
||||||
|
:on-result :event}}
|
||||||
'ethereum/call
|
'ethereum/call
|
||||||
{:permissions [:read]
|
{:permissions [:read]
|
||||||
:value :extensions/ethereum-call
|
:value :extensions/ethereum-call
|
||||||
|
|
|
@ -101,6 +101,114 @@
|
||||||
(fn [{db :db} [_ _ {:keys [to] :as arguments}]]
|
(fn [{db :db} [_ _ {:keys [to] :as arguments}]]
|
||||||
(wrap-with-resolution db arguments :to execute-ethcall)))
|
(wrap-with-resolution db arguments :to execute-ethcall)))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:extensions/ethereum-erc20-total-supply
|
||||||
|
(fn [{db :db} [_ _ {:keys [contract on-result]}]]
|
||||||
|
(let [json-rpc-args {:to contract
|
||||||
|
:method "totalSupply()"
|
||||||
|
:outputs ["uint256"]
|
||||||
|
:on-result on-result}]
|
||||||
|
(wrap-with-resolution db json-rpc-args :to execute-ethcall))))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:extensions/ethereum-erc20-balance-of
|
||||||
|
(fn [{db :db} [_ _ {:keys [contract token-owner on-result]}]]
|
||||||
|
(let [json-rpc-args {:to contract
|
||||||
|
:method "balanceOf(address)"
|
||||||
|
:params [token-owner]
|
||||||
|
:outputs ["uint256"]
|
||||||
|
:on-result on-result}]
|
||||||
|
(wrap-with-resolution db json-rpc-args :to execute-ethcall))))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:extensions/ethereum-erc20-allowance
|
||||||
|
(fn [{db :db} [_ _ {:keys [contract token-owner spender on-result]}]]
|
||||||
|
(let [json-rpc-args {:to contract
|
||||||
|
:method "allowance(address,address)"
|
||||||
|
:params [token-owner spender]
|
||||||
|
:outputs ["uint256"]
|
||||||
|
:on-result on-result}]
|
||||||
|
(wrap-with-resolution db json-rpc-args :to execute-ethcall))))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:extensions/ethereum-erc20-transfer
|
||||||
|
(fn [{db :db} [_ _ {:keys [contract to value on-result]}]]
|
||||||
|
(let [json-rpc-args {:to contract
|
||||||
|
:method "transfer(address,uint256)"
|
||||||
|
:params [to value]
|
||||||
|
:on-result on-result}]
|
||||||
|
(wrap-with-resolution db json-rpc-args :to execute-send-transaction))))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:extensions/ethereum-erc20-transfer-from
|
||||||
|
(fn [{db :db} [_ _ {:keys [contract from to value on-result]}]]
|
||||||
|
(let [json-rpc-args {:to contract
|
||||||
|
:method "transferFrom(address,address,uint256)"
|
||||||
|
:params [from to value]
|
||||||
|
:on-result on-result}]
|
||||||
|
(wrap-with-resolution db json-rpc-args :to execute-send-transaction))))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:extensions/ethereum-erc20-approve
|
||||||
|
(fn [{db :db} [_ _ {:keys [contract spender value on-result]}]]
|
||||||
|
(let [json-rpc-args {:to contract
|
||||||
|
:method "approve(address,uint256)"
|
||||||
|
:params [spender value]
|
||||||
|
:on-result on-result}]
|
||||||
|
(wrap-with-resolution db json-rpc-args :to execute-send-transaction))))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:extensions/ethereum-erc721-owner-of
|
||||||
|
(fn [{db :db} [_ _ {:keys [contract token-id on-result]}]]
|
||||||
|
(let [json-rpc-args {:to contract
|
||||||
|
:method "ownerOf(uint256)"
|
||||||
|
:params [token-id]
|
||||||
|
:outputs ["address"]
|
||||||
|
:on-result on-result}]
|
||||||
|
(wrap-with-resolution db json-rpc-args :to execute-ethcall))))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:extensions/ethereum-erc721-is-approved-for-all
|
||||||
|
(fn [{db :db} [_ _ {:keys [contract owner operator on-result]}]]
|
||||||
|
(let [json-rpc-args {:to contract
|
||||||
|
:method "isApprovedForAll(address,address)"
|
||||||
|
:params [owner operator]
|
||||||
|
:outputs ["bool"]
|
||||||
|
:on-result on-result}]
|
||||||
|
(wrap-with-resolution db json-rpc-args :to execute-ethcall))))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:extensions/ethereum-erc721-get-approved
|
||||||
|
(fn [{db :db} [_ _ {:keys [contract token-id on-result]}]]
|
||||||
|
(let [json-rpc-args {:to contract
|
||||||
|
:method "getApproved(uint256)"
|
||||||
|
:params [token-id]
|
||||||
|
:outputs ["address"]
|
||||||
|
:on-result on-result}]
|
||||||
|
(wrap-with-resolution db json-rpc-args :to execute-ethcall))))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:extensions/ethereum-erc721-set-approval-for-all
|
||||||
|
(fn [{db :db} [_ _ {:keys [contract to approved on-result]}]]
|
||||||
|
(let [json-rpc-args {:to contract
|
||||||
|
:method "setApprovalForAll(address,bool)"
|
||||||
|
:params [to approved]
|
||||||
|
:on-result on-result}]
|
||||||
|
(wrap-with-resolution db json-rpc-args :to execute-send-transaction))))
|
||||||
|
|
||||||
|
(handlers/register-handler-fx
|
||||||
|
:extensions/ethereum-erc721-safe-transfer-from
|
||||||
|
(fn [{db :db} [_ _ {:keys [contract from to token-id data on-result]}]]
|
||||||
|
(let [json-rpc-args {:to contract
|
||||||
|
:method (if data
|
||||||
|
"safeTransferFrom(address,address,uint256,bytes)"
|
||||||
|
"safeTransferFrom(address,address,uint256)")
|
||||||
|
:params (if data
|
||||||
|
[from to token-id data]
|
||||||
|
[from to token-id])
|
||||||
|
:on-result on-result}]
|
||||||
|
(wrap-with-resolution db json-rpc-args :to execute-send-transaction))))
|
||||||
|
|
||||||
(defn- parse-log [{:keys [address transactionHash blockHash transactionIndex topics blockNumber logIndex removed data]}]
|
(defn- parse-log [{:keys [address transactionHash blockHash transactionIndex topics blockNumber logIndex removed data]}]
|
||||||
{:address address
|
{:address address
|
||||||
:transaction-hash transactionHash
|
:transaction-hash transactionHash
|
||||||
|
|
Loading…
Reference in New Issue