mirror of
https://github.com/status-im/open-bounty.git
synced 2025-01-11 18:14:25 +00:00
Confirm multisig transaction using web3
This commit is contained in:
parent
6d8ad78bfd
commit
49dcdc0515
@ -207,6 +207,7 @@ SELECT
|
||||
i.title AS issue_title,
|
||||
i.repo_id AS repo_id,
|
||||
i.balance AS balance,
|
||||
i.confirm_hash AS confirm_hash,
|
||||
p.pr_id AS pr_id,
|
||||
p.user_id AS user_id,
|
||||
p.pr_number AS pr_number,
|
||||
@ -214,7 +215,8 @@ SELECT
|
||||
u.login AS user_login,
|
||||
u.name AS user_name,
|
||||
r.login AS owner_name,
|
||||
r.repo AS repo_name
|
||||
r.repo AS repo_name,
|
||||
o.address AS owner_address
|
||||
FROM issues i
|
||||
INNER JOIN pull_requests p
|
||||
ON (p.commit_id = i.commit_id OR coalesce(p.issue_number, -1) = i.issue_number)
|
||||
@ -223,6 +225,8 @@ FROM issues i
|
||||
ON u.id = p.user_id
|
||||
INNER JOIN repositories r
|
||||
ON r.repo_id = i.repo_id
|
||||
INNER JOIN users o
|
||||
ON r.user_id = o.id
|
||||
WHERE r.user_id = :owner_id;
|
||||
|
||||
-- :name owner-issues-list :? :*
|
||||
|
@ -57,10 +57,12 @@
|
||||
(ok (repositories/get-enabled (:id user))))
|
||||
(GET "/bounties" []
|
||||
(ok (bounties/list-all-bounties)))
|
||||
(GET "/issues" []
|
||||
(GET "/user/bounties" []
|
||||
:auth-rules authenticated?
|
||||
:current-user user
|
||||
(ok (map #(conj % {:balance-eth (eth/hex->eth (:balance %) 6)})
|
||||
(ok (map #(conj % (let [balance (:balance %)]
|
||||
{:balance-eth (eth/hex->eth balance 6)
|
||||
:balance-wei (eth/hex->big-integer balance)}))
|
||||
(bounties/list-owner-bounties (:id user)))))
|
||||
(POST "/repository/toggle" {:keys [params]}
|
||||
:auth-rules authenticated?
|
||||
|
@ -33,7 +33,7 @@
|
||||
:dispatch-n [[:load-user-profile]
|
||||
[:load-user-repos]
|
||||
[:load-enabled-repos]
|
||||
[:load-issues]]}))
|
||||
[:load-owner-bounties]]}))
|
||||
|
||||
(reg-event-fx
|
||||
:load-bounties
|
||||
@ -49,11 +49,11 @@
|
||||
(assoc db :all-bounties bounties)))
|
||||
|
||||
(reg-event-fx
|
||||
:load-issues
|
||||
:load-owner-bounties
|
||||
(fn [{:keys [db]} [_]]
|
||||
{:db db
|
||||
:http {:method GET
|
||||
:url "/api/issues"
|
||||
:url "/api/user/bounties"
|
||||
:on-success #(dispatch [:set-owner-bounties %])}}))
|
||||
|
||||
(reg-event-db
|
||||
|
@ -27,12 +27,28 @@
|
||||
[:div
|
||||
(map repository-row @repos)])))
|
||||
|
||||
(defn send-transaction
|
||||
[issue]
|
||||
(fn []
|
||||
(let [{owner-address :owner_address
|
||||
contract-address :contract_address
|
||||
confirm-hash :confirm_hash} issue
|
||||
eth (.-eth js/web3)
|
||||
payload {:from owner-address
|
||||
:to contract-address
|
||||
:value 1
|
||||
:data (str "0x797af627" confirm-hash)}]
|
||||
(println "sending transaction" payload)
|
||||
(.sendTransaction eth (clj->js payload)
|
||||
#(println "send-transaction callback" %)))))
|
||||
|
||||
(defn issue-row [{title :issue_title
|
||||
issue-id :issue_id
|
||||
issue-number :issue_number
|
||||
owner :owner_name
|
||||
repo :repo_name
|
||||
balance :balance-eth}]
|
||||
balance :balance-eth
|
||||
:as issue}]
|
||||
^{:key issue-id}
|
||||
[:li.issue
|
||||
[:div.d-table.table-fixed.width-full
|
||||
@ -52,7 +68,8 @@
|
||||
{:type "submit"
|
||||
:style {:margin-top "7px"
|
||||
:margin-right "7px"}
|
||||
:on-click #(println %)}
|
||||
:disabled (not (exists? js/web3))
|
||||
:on-click (send-transaction issue)}
|
||||
(str "Sign and send " balance " ETH")]
|
||||
[:div.float-left.col-9.p-3.lh-condensed
|
||||
[:span.mr-2.float-right.text-gray.text-small
|
||||
|
Loading…
x
Reference in New Issue
Block a user