Skip to content

Commit

Permalink
feat: add tx.pendingAt
Browse files Browse the repository at this point in the history
PORTAL-3423
  • Loading branch information
yqrashawn committed Aug 1, 2022
1 parent c9257d0 commit ced5b52
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .yarn/versions/a580b314.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
releases:
"@fluent-wallet/db": patch

declined:
- helios-background
1 change: 1 addition & 0 deletions packages/background/src/db-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const schema = {
blockHash: {doc: 'block this tx packaged in'},
chainSwitched: {doc: 'chain switched'},
created: {doc: 'created timestamp get with new Date().getTime()'},
pendingAt: {doc: 'first time pending timestamp'},
err: {doc: 'basic error type/info'},
txExtra: {doc: 'enriched tx info', ref: true, component: true},
fromFluent: {doc: 'tx submitted from fluent'},
Expand Down
7 changes: 5 additions & 2 deletions packages/db/src/main/cfxjs/db/queries.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1556,8 +1556,11 @@
(t [tx]))))
(defn set-tx-pending [{:keys [hash]}]
(when-not (tx-end-state? hash)
(t [;; [:db.fn/retractAttribute [:tx/hash hash] :tx/raw]
{:db/id [:tx/hash hash] :tx/status 2}])))
(let [pending-at (:tx/pendingAt (p [:tx/pendingAt] [:tx/hash hash]))]
(t [;; [:db.fn/retractAttribute [:tx/hash hash] :tx/raw]
{:db/id [:tx/hash hash]
:tx/status 2
:tx/pendingAt (or pending-at (.now js/Date))}]))))
(defn set-tx-packaged [{:keys [hash blockHash]}]
(when-not (tx-end-state? hash)
(t [[:db.fn/retractAttribute [:tx/hash hash] :tx/skippedChecked]
Expand Down

0 comments on commit ced5b52

Please sign in to comment.