Skip to content

Commit

Permalink
Fix/tx status db (#1494)
Browse files Browse the repository at this point in the history
* feat: update db

* feat: version
  • Loading branch information
mosshqq authored Dec 26, 2024
1 parent fa92fb7 commit ae554ab
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .yarn/versions/2d40fc80.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
releases:
"@fluent-wallet/db": patch
"@fluent-wallet/spec": patch

declined:
- helios
7 changes: 7 additions & 0 deletions packages/db/src/main/cfxjs/db/queries.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,12 @@
{:db/id [:tx/hash hash]
:tx/status 2
:tx/pendingAt (or pending-at (.now js/Date))}]))))
(defn force-set-tx-status [{:keys [hash status error]}]
(let [txs [{:db/id [:tx/hash hash] :tx/status status}]]
(if error
(concat txs {:db/id [:tx/hash hash] :tx/err error})
(concat txs [:db.fn/retractAttribute [:tx/hash hash] :tx/err]))
(t txs)))
(defn set-tx-packaged [{:keys [hash blockHash]}]
(when-not (tx-end-state? hash)
(t [[:db.fn/retractAttribute [:tx/hash hash] :tx/skippedChecked]
Expand Down Expand Up @@ -2308,6 +2314,7 @@
:setTxConfirmed set-tx-confirmed
:setTxChainSwitched set-tx-chain-switched
:setTxUnsent set-tx-unsent
:forceSetTxStatus force-set-tx-status
:getTxsToEnrich get-txs-to-enrich
:cleanupTx cleanup-tx
:findApp get-apps
Expand Down
10 changes: 5 additions & 5 deletions packages/spec/src/main/cfxjs/spec/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -406,17 +406,17 @@

(def export-block-tag
(update-properties
[:enum "latest" "earliest" "pending" nil]
[:enum "latest" "earliest" "pending" "safe" "finalized" nil]
:type :epoch-tag
:error/message "invalid block tag, must be one of latest pending or earliest"
:doc "one of latest pending or earliest, default to latest"))
:error/message "invalid block tag, must be one of latest pending earliest safe or finalized"
:doc "one of latest pending earliest safe or finalized, default to latest"))

(def export-block-ref
(update-properties
[:or export-block-tag Uint]
:type :epoch-ref
:error/message "invalid block ref, must be one of latest, pending, earliest, block number or null"
:doc "one of latest, pending, earliest, block number or null"))
:error/message "invalid block ref, must be one of latest, pending, earliest, safe, finalized, block number or null"
:doc "one of latest, pending, earliest, safe, finalized, block number or null"))

(def export-address-type
(update-properties
Expand Down

0 comments on commit ae554ab

Please sign in to comment.