From fec83e129356a57d81ec45d983e1925d6d34d36b Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Sun, 15 Dec 2024 16:04:19 -0800 Subject: [PATCH] PKG -- [fcl-core] Fix fcl.tx(...).onceSealed() not resolving --- .changeset/proud-planes-change.md | 5 +++++ packages/fcl-core/src/transaction/index.js | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/proud-planes-change.md diff --git a/.changeset/proud-planes-change.md b/.changeset/proud-planes-change.md new file mode 100644 index 000000000..791e5ba90 --- /dev/null +++ b/.changeset/proud-planes-change.md @@ -0,0 +1,5 @@ +--- +"@onflow/fcl-core": patch +--- + +Fix bug affecting `fcl.tx(...).onceSealed()` diff --git a/packages/fcl-core/src/transaction/index.js b/packages/fcl-core/src/transaction/index.js index bc4ca7b74..997a24a45 100644 --- a/packages/fcl-core/src/transaction/index.js +++ b/packages/fcl-core/src/transaction/index.js @@ -150,20 +150,20 @@ export function transaction( const suppress = opts.suppress || false return new Promise((resolve, reject) => { const unsub = subscribe((txStatus, error) => { - if (!suppress) { + if ((error || txStatus.statusCode) && !suppress) { if (error != null) { reject(error) unsub() - return } else if (txStatus.statusCode === 1) { const transactionError = TransactionError.fromErrorMessage( txStatus.errorMessage ) reject(transactionError) unsub() - return } - } else if (predicate(txStatus)) { + } + + if (predicate(txStatus)) { resolve(txStatus) unsub() }