Skip to content

Commit

Permalink
Merge branch 'patch-bitcoin-rpc-rosen-extractor' into 'master'
Browse files Browse the repository at this point in the history
Patch bitcoin rpc rosen extractor

See merge request ergo/rosen-bridge/watcher!318
  • Loading branch information
zargarzadehm committed Nov 19, 2024
2 parents e0e8dde + 12efae7 commit 5fa76f2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
File renamed without changes.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @rosen-bridge/watcher

## 4.0.3

### Patch Changes

- Patch JS floating error in BitcoinRpcRosenExtractor

## 4.0.2

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
19 changes: 19 additions & 0 deletions patches/@rosen-bridge+rosen-extractor+6.2.0.patch
Original file line number Diff line number Diff line change
@@ -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 {

0 comments on commit 5fa76f2

Please sign in to comment.