@orbs-network/twap 1.7.2 → 1.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/src/lib.js +3 -2
  2. package/package.json +1 -1
package/dist/src/lib.js CHANGED
@@ -120,7 +120,8 @@ class TWAPLib {
120
120
  return TokensValidation.valid;
121
121
  }
122
122
  validateOrderInputs(srcToken, dstToken, srcAmount, srcChunkAmount, dstMinChunkAmountOut, deadline, fillDelaySeconds, srcUsd) {
123
- if (this.validateTokens(srcToken, dstToken) !== TokensValidation.valid)
123
+ if ((this.validateTokens(srcToken, dstToken) === TokensValidation.dstTokenZero && dstToken.address !== web3_candies_1.zeroAddress) ||
124
+ this.validateTokens(srcToken, dstToken) !== TokensValidation.valid)
124
125
  return OrderInputValidation.invalidTokens;
125
126
  if ((0, bignumber_js_1.default)(srcAmount).lte(0))
126
127
  return OrderInputValidation.invalidSrcAmount;
@@ -137,7 +138,7 @@ class TWAPLib {
137
138
  const smallestChunkSize = (0, bignumber_js_1.default)(srcAmount).mod(srcChunkAmount).gt(0)
138
139
  ? (0, bignumber_js_1.default)(srcAmount).mod(srcChunkAmount)
139
140
  : (0, bignumber_js_1.default)(srcChunkAmount);
140
- if (smallestChunkSize.times(srcUsd).lt(this.config.minChunkSizeUsd))
141
+ if (smallestChunkSize.times(srcUsd).lt((0, bignumber_js_1.default)(this.config.minChunkSizeUsd).times((0, bignumber_js_1.default)(10).pow(srcToken.decimals))))
141
142
  return OrderInputValidation.invalidSmallestSrcChunkUsd;
142
143
  return OrderInputValidation.valid;
143
144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbs-network/twap",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/orbs-network/twap.git"