Skip to content

Commit

Permalink
Merge branch 'commitment_confirmed' into 'main'
Browse files Browse the repository at this point in the history
Commitment confirmed

See merge request nosana-ci/apps/platform/nosana-node!39
  • Loading branch information
jeisses committed Feb 16, 2023
2 parents 8804077 + c1d78be commit f1436d4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
11 changes: 11 additions & 0 deletions scripts/podman.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sudo docker run -d \
--name podman \
--device /dev/fuse \
--security-opt seccomp=unconfined \
--security-opt apparmor=unconfined \
--security-opt label=disable \
--cap-add sys_admin \
--cap-add mknod \
-p 8080:8080 \
quay.io/podman/stable podman system service \
--time 0 tcp:0.0.0.0:8080
14 changes: 8 additions & 6 deletions src/nosana_node/solana.clj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

(defn rpc-call
"Make a solana RPC call.
This uses clj-http instead of solanaj's client."
This uses clj-http instead of solanaj's client.
For all JSON RPC HTTP methods:https://docs.solana.com/api/http"
[method params network]
(->
(http/post (get rpc network)
Expand All @@ -40,19 +41,19 @@

(defn get-balance [addr network]
(->
(rpc-call "getBalance" [(.toString addr)] network)
(rpc-call "getBalance" [(.toString addr) {:commitment "confirmed"}] network)
:body (json/decode true) :result :value))

(defn get-token-balance [addr network]
(->
(rpc-call "getTokenAccountBalance" [(.toString addr)] network)
(rpc-call "getTokenAccountBalance" [(.toString addr) {:commitment "confirmed"}] network)
:body (json/decode true) :result :value :amount))

(defn get-account-data
"Get the data of a Solana account as ByteArray."
[addr network]
(if-let [data (->
(rpc-call "getAccountInfo" [(.toString addr) {:encoding "base64"}] network)
(rpc-call "getAccountInfo" [(.toString addr) {:encoding "base64" :commitment "confirmed"}] network)
:body
(json/decode true)
:result :value :data
Expand Down Expand Up @@ -374,7 +375,8 @@
(rpc-call "getProgramAccounts"
[(.toString account)
{:encoding "jsonParsed"
:filters filters}]
:filters filters
:commitment "confirmed"}]
network)
:body
(json/decode true)
Expand Down Expand Up @@ -414,7 +416,7 @@
(defn get-tx
"Get transaction `sig` as keywordized map"
[sig network]
(-> (rpc-call "getTransaction" [sig "json"] network)
(-> (rpc-call "getTransaction" [sig "json" {:commitment "confirmed"}] network)
:body
(json/decode true)
:result))
Expand Down

0 comments on commit f1436d4

Please sign in to comment.