Skip to content

Commit

Permalink
Implement claim job function
Browse files Browse the repository at this point in the history
  • Loading branch information
jeisses committed Aug 15, 2023
1 parent 897bcf0 commit 1f4c78b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/nosana_node/nosana.clj
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,22 @@ Running Nosana Node %s
(logg/info "Quiting run " pub)
(quit-job conf (sol/public-key pub)))))

(defn claim-job
"Claim a stopped job."
[{:keys [network signer programs] :as conf} job-addr]
(let [job (get-job conf job-addr)
run (Account.)]
(-> (build-idl-tx
:job
"claim"
[]
conf
{"job" (sol/public-key job-addr)
"run" (.getPublicKey run)
"market" (:market job)
"payer" (.getPublicKey signer)})
(sol/send-tx [signer run] network))))

(defn create-market
"Create a Nosana market.
TODO: This function does not work yet because i64 support has to be
Expand Down
2 changes: 1 addition & 1 deletion src/nosana_node/solana.clj
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
(doseq [{:keys [name isMut isSigner]} (:accounts ins)]
(when (not (contains? accounts name))
(throw (ex-info "Missing required account for instruction" {:missing name})))
;; (prn name ": " (.toString(get accounts name)))
;; (prn name ": " (.toString (get accounts name)) " [ " isMut ", " isSigner "]")
(.add ins-keys (AccountMeta. (get accounts name) isSigner isMut)))

;; in anchor the instruction data always starts with 8 bytes id
Expand Down

0 comments on commit 1f4c78b

Please sign in to comment.