From bd43c200c25a77a130c89c5b03ea0b57945e7c9a Mon Sep 17 00:00:00 2001 From: HFazelinia Date: Tue, 19 Nov 2024 10:24:27 +0000 Subject: [PATCH 1/3] patch bitcoin rpc floating error --- .changeset/chilled-pugs-provide.md | 5 +++++ .../@rosen-bridge+rosen-extractor+6.2.0.patch | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .changeset/chilled-pugs-provide.md create mode 100644 patches/@rosen-bridge+rosen-extractor+6.2.0.patch diff --git a/.changeset/chilled-pugs-provide.md b/.changeset/chilled-pugs-provide.md new file mode 100644 index 00000000..4b379e75 --- /dev/null +++ b/.changeset/chilled-pugs-provide.md @@ -0,0 +1,5 @@ +--- +'@rosen-bridge/watcher': patch +--- + +Patch JS floating error in BitcoinRpcRosenExtractor diff --git a/patches/@rosen-bridge+rosen-extractor+6.2.0.patch b/patches/@rosen-bridge+rosen-extractor+6.2.0.patch new file mode 100644 index 00000000..3213be82 --- /dev/null +++ b/patches/@rosen-bridge+rosen-extractor+6.2.0.patch @@ -0,0 +1,19 @@ +diff --git a/node_modules/@rosen-bridge/rosen-extractor/dist/lib/getRosenData/bitcoin/BitcoinRpcRosenExtractor.js b/node_modules/@rosen-bridge/rosen-extractor/dist/lib/getRosenData/bitcoin/BitcoinRpcRosenExtractor.js +index 776a528..a231bf4 100644 +--- a/node_modules/@rosen-bridge/rosen-extractor/dist/lib/getRosenData/bitcoin/BitcoinRpcRosenExtractor.js ++++ b/node_modules/@rosen-bridge/rosen-extractor/dist/lib/getRosenData/bitcoin/BitcoinRpcRosenExtractor.js +@@ -90,11 +90,12 @@ export class BitcoinRpcRosenExtractor extends AbstractRosenDataExtractor { + [this.tokens.getIdKey(BITCOIN_CHAIN)]: BITCOIN_NATIVE_TOKEN, + }); + if (wrappedBtc.length > 0 && Object.hasOwn(wrappedBtc[0], toChain)) { +- const satoshiAmount = Math.floor(box.value * 100_000_000); ++ const parts = box.value.toString().split('.'); ++ const part1 = ((parts[1] ?? '') + '0'.repeat(8)).substring(0, 8); + return { + from: BITCOIN_NATIVE_TOKEN, + to: this.tokens.getID(wrappedBtc[0], toChain), +- amount: satoshiAmount.toString(), ++ amount: parts[0] === '0' ? '' : parts[0] + part1, + }; + } + else { From 7d80701796ef86200a292edba8baa0b73c244fb7 Mon Sep 17 00:00:00 2001 From: HFazelinia Date: Tue, 19 Nov 2024 10:25:13 +0000 Subject: [PATCH 2/3] increase version for release --- .changeset/chilled-pugs-provide.md | 5 ----- .changeset/{shy-otters-hang.md => heavy-bottles-cheat.md} | 0 CHANGELOG.md | 6 ++++++ package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 .changeset/chilled-pugs-provide.md rename .changeset/{shy-otters-hang.md => heavy-bottles-cheat.md} (100%) diff --git a/.changeset/chilled-pugs-provide.md b/.changeset/chilled-pugs-provide.md deleted file mode 100644 index 4b379e75..00000000 --- a/.changeset/chilled-pugs-provide.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@rosen-bridge/watcher': patch ---- - -Patch JS floating error in BitcoinRpcRosenExtractor diff --git a/.changeset/shy-otters-hang.md b/.changeset/heavy-bottles-cheat.md similarity index 100% rename from .changeset/shy-otters-hang.md rename to .changeset/heavy-bottles-cheat.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 55b02689..932dfe3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @rosen-bridge/watcher +## 4.0.3 + +### Patch Changes + +- Patch JS floating error in BitcoinRpcRosenExtractor + ## 4.0.2 ### Patch Changes diff --git a/package-lock.json b/package-lock.json index b32d4f9b..b16af874 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@rosen-bridge/watcher", - "version": "4.0.2", + "version": "4.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@rosen-bridge/watcher", - "version": "4.0.2", + "version": "4.0.3", "hasInstallScript": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 8ad2a68d..de88edf3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rosen-bridge/watcher", - "version": "4.0.2", + "version": "4.0.3", "description": "Rosen bridge Watcher service", "main": "index.js", "type": "module", From 12efae730d96a4277b98a7d096c7ed695d58df5c Mon Sep 17 00:00:00 2001 From: HFazelinia Date: Tue, 19 Nov 2024 12:45:44 +0000 Subject: [PATCH 3/3] fix rosen-extractor patch --- patches/@rosen-bridge+rosen-extractor+6.2.0.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/@rosen-bridge+rosen-extractor+6.2.0.patch b/patches/@rosen-bridge+rosen-extractor+6.2.0.patch index 3213be82..c5437f04 100644 --- a/patches/@rosen-bridge+rosen-extractor+6.2.0.patch +++ b/patches/@rosen-bridge+rosen-extractor+6.2.0.patch @@ -13,7 +13,7 @@ index 776a528..a231bf4 100644 from: BITCOIN_NATIVE_TOKEN, to: this.tokens.getID(wrappedBtc[0], toChain), - amount: satoshiAmount.toString(), -+ amount: parts[0] === '0' ? '' : parts[0] + part1, ++ amount: (parts[0] === '0' ? '' : parts[0]) + part1, }; } else {