@orbs-network/twap 1.7.1 → 1.7.3

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.
@@ -14,7 +14,7 @@ export interface Config {
14
14
  wToken: TokenData;
15
15
  partner: string;
16
16
  exchangeAddress: string;
17
- exchangeContract: "UniswapV2Exchange" | "ParaswapExchange";
17
+ exchangeType: "UniswapV2Exchange" | "ParaswapExchange";
18
18
  pathfinderKey: Paraswap.OnlyDex;
19
19
  }
20
20
  export declare const ChainConfigs: {
@@ -72,40 +72,8 @@ export declare const ChainConfigs: {
72
72
  };
73
73
  };
74
74
  export declare const Configs: {
75
- SpiritSwap: {
76
- partner: string;
77
- exchangeAddress: string;
78
- exchangeContract: string;
79
- pathfinderKey: Paraswap.OnlyDex;
80
- chainId: number;
81
- twapAddress: string;
82
- lensAddress: string;
83
- bidDelaySeconds: number;
84
- minChunkSizeUsd: number;
85
- wToken: {
86
- address: string;
87
- decimals: number;
88
- symbol: string;
89
- logoUrl: string;
90
- };
91
- };
92
- SpookySwap: {
93
- partner: string;
94
- exchangeAddress: string;
95
- exchangeContract: string;
96
- pathfinderKey: Paraswap.OnlyDex;
97
- chainId: number;
98
- twapAddress: string;
99
- lensAddress: string;
100
- bidDelaySeconds: number;
101
- minChunkSizeUsd: number;
102
- wToken: {
103
- address: string;
104
- decimals: number;
105
- symbol: string;
106
- logoUrl: string;
107
- };
108
- };
75
+ SpiritSwap: Config;
76
+ SpookySwap: Config;
109
77
  };
110
78
  export declare const nativeTokenAddresses: string[];
111
79
  export declare const isNativeAddress: (address: string) => boolean;
@@ -62,8 +62,8 @@ exports.ChainConfigs = {
62
62
  },
63
63
  };
64
64
  exports.Configs = {
65
- SpiritSwap: Object.assign(Object.assign({}, exports.ChainConfigs.ftm), { partner: "SpiritSwap", exchangeAddress: "0xAd19179201be5A51D1cBd3bB2fC651BB05822404", exchangeContract: "ParaswapExchange", pathfinderKey: paraswap_1.Paraswap.OnlyDex.SpiritSwap }),
66
- SpookySwap: Object.assign(Object.assign({}, exports.ChainConfigs.ftm), { partner: "SpookySwap", exchangeAddress: "0x37F427DA0D12Fe2C80aCa09EE08e7e92A1B2B114", exchangeContract: "UniswapV2Exchange", pathfinderKey: paraswap_1.Paraswap.OnlyDex.SpookySwap }),
65
+ SpiritSwap: Object.assign(Object.assign({}, exports.ChainConfigs.ftm), { partner: "SpiritSwap", exchangeAddress: "0xAd19179201be5A51D1cBd3bB2fC651BB05822404", exchangeType: "ParaswapExchange", pathfinderKey: paraswap_1.Paraswap.OnlyDex.SpiritSwap }),
66
+ SpookySwap: Object.assign(Object.assign({}, exports.ChainConfigs.ftm), { partner: "SpookySwap", exchangeAddress: "0x37F427DA0D12Fe2C80aCa09EE08e7e92A1B2B114", exchangeType: "UniswapV2Exchange", pathfinderKey: paraswap_1.Paraswap.OnlyDex.SpookySwap }),
67
67
  };
68
68
  // export const UniswapV2Config: Config = {
69
69
  // ...ChainConfigs.eth,
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbs-network/twap",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/orbs-network/twap.git"