@psychedelic/sonic-js
Advanced tools
Comparing version 0.3.4 to 0.3.5
@@ -73,3 +73,3 @@ "use strict"; | ||
}); | ||
if (declarations_1.Default.ENV === 'development') { | ||
if (declarations_1.Default.ENV === 'development' && agent.fetchRootKey) { | ||
await agent.fetchRootKey(); | ||
@@ -76,0 +76,0 @@ } |
@@ -49,5 +49,2 @@ "use strict"; | ||
const denominator = reserveOut.minus(amountOut); | ||
if (denominator.lte(0)) { | ||
return (0, __1.toBigNumber)(0); | ||
} | ||
const amountIn = numerator | ||
@@ -54,0 +51,0 @@ .dividedBy(denominator) |
@@ -99,3 +99,3 @@ "use strict"; | ||
const newPath = new Set([...path, node.id]); | ||
if (newPathDistance.lt(node.amountOut) && newPathDistance.gt(0)) { | ||
if (newPathDistance.lt(node.amountOut)) { | ||
node.amountOut = newPathDistance; | ||
@@ -102,0 +102,0 @@ node.path = newPath; |
{ | ||
"name": "@psychedelic/sonic-js", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "Sonic-js is a library that holds an API for interacting with Swap Canister", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -69,13 +69,2 @@ import { Swap } from '@/math'; | ||
); | ||
test('should return 0 if the amountOut is bigger than reserveOut', () => { | ||
const result = Swap.getAmountIn({ | ||
amountOut: '100.1', | ||
decimalsIn: 1, | ||
decimalsOut: 1, | ||
reserveIn: 2000, | ||
reserveOut: 1000, | ||
}); | ||
expect(result).toEqual(new BigNumber(0)); | ||
}); | ||
}); | ||
@@ -82,0 +71,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
599428
5581