Skip to content

Commit

Permalink
Merge commit from fork
Browse files Browse the repository at this point in the history
* setting UTXO cache by default

* update docs

* add test case

* add changeset

* ci: add advisory fix to CI branches to be run

* Revert "ci: add advisory fix to CI branches to be run"

This reverts commit d81e7594ce0b648142534bd7caa989200ed1d9be.

* add test case for error

* remove unused helper

* fine ajustment

* caching UTXOs after TX submission

* fix some tests

* adjust cache tests

* made cache required at Provider class

* made launchNodeAndGetWallets support setting provider options

* update test suite

* made cache optional at Provider class

* adjusting tests

* improve docs

Co-authored-by: Chad Nehemiah <[email protected]>

---------

Co-authored-by: chad <[email protected]>
Co-authored-by: Peter Smith <[email protected]>
  • Loading branch information
3 people committed Jul 29, 2024
1 parent ece2376 commit 16ee1bf
Show file tree
Hide file tree
Showing 7 changed files with 242 additions and 303 deletions.
5 changes: 5 additions & 0 deletions .changeset/tricky-mangos-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuel-ts/account": patch
---

chore: cache UTXOs by default upon TX submission
2 changes: 1 addition & 1 deletion apps/docs/src/guide/provider/provider-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Transaction is not inserted. UTXO does not exist: 0xf5...

This error indicates that the UTXO(s) used by the second transaction no longer exist, as the first transaction already spent them.

To prevent this issue, you can use the `cacheUtxo` flag. This flag sets a TTL (Time-To-Live) for caching UTXO(s) used in a transaction, preventing them from being reused in subsequent transactions within the specified time.
To prevent this issue, the SDK sets a default cache for UTXO(s) to 20 seconds. This default caching mechanism ensures that UTXO(s) used in a submitted transaction are not reused in subsequent transactions within the specified time. You can control the duration of this cache using the `cacheUtxo` flag. If you would like to disable caching, you can pass a value of `-1` to the `cacheUtxo` parameter.

<<< @/../../docs-snippets/src/guide/provider/provider.test.ts#options-cache-utxo{ts:line-numbers}

Expand Down
Loading

0 comments on commit 16ee1bf

Please sign in to comment.