@ape.swap/bonds-sdk 2.6.8 → 2.6.10

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.
package/dist/main.js CHANGED
@@ -49151,7 +49151,7 @@ const PRICE_GETTER_ADDRESSES = {
49151
49151
  [types.ChainId.MATIC]: '0x6908356faC751dA36F4ec1B4ADBc56d0B3862155', // Price getter v2.1
49152
49152
  [types.ChainId.MAINNET]: '0x10ffd467e8701fc2887b3df9b9a31adfefd388ec', // Price getter V2.1
49153
49153
  [types.ChainId.TLOS]: '0x85d2C626E28a42E184cF8e32db1461013D23331D',
49154
- [types.ChainId.ARBITRUM]: '0xfa7598C50fbA17b64EBB8Ed2058564D9b5359b03', // Price getter V2.1
49154
+ [types.ChainId.ARBITRUM]: '0xf1e931A569d8B3Ff5cCd11d2F42422FCABA6DBa4', // Price getter V3 (V2 backwards compatible)
49155
49155
  [types.ChainId.LINEA]: '0x35b1eadAbaDD0Edd26076247f3dEdF9E15De8D5D',
49156
49156
  [types.ChainId.LIGHTLINK]: '0xC22Db8dDe3A3591fFB02be868Ce2901d30671FE4',
49157
49157
  [types.ChainId.IOTA]: '0xC22Db8dDe3A3591fFB02be868Ce2901d30671FE4',
@@ -71092,7 +71092,7 @@ function getTokenPricesV2FromPriceGetter(tokensToCall_1, chain_1) {
71092
71092
  function getPriceGetterCallData(tokensToCall, // replace 'any' with the actual type
71093
71093
  supportedChainId, lpTokens) {
71094
71094
  return Object.values(tokensToCall).map((token) => {
71095
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
71095
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
71096
71096
  const liquidityDex = (_a = token.liquidityDex) === null || _a === void 0 ? void 0 : _a[supportedChainId];
71097
71097
  let dexFactory;
71098
71098
  let protocol = 2;
@@ -71101,24 +71101,29 @@ supportedChainId, lpTokens) {
71101
71101
  let factoryAlgebra = (_g = (_f = types.defaultDexFactories === null || types.defaultDexFactories === void 0 ? void 0 : types.defaultDexFactories[supportedChainId]) === null || _f === void 0 ? void 0 : _f[4]) !== null && _g !== void 0 ? _g : ZERO_ADDRESS;
71102
71102
  let factorySolidly = (_j = (_h = types.defaultDexFactories === null || types.defaultDexFactories === void 0 ? void 0 : types.defaultDexFactories[supportedChainId]) === null || _h === void 0 ? void 0 : _h[7]) !== null && _j !== void 0 ? _j : ZERO_ADDRESS;
71103
71103
  let factoryXFAI = (_l = (_k = types.defaultDexFactories === null || types.defaultDexFactories === void 0 ? void 0 : types.defaultDexFactories[supportedChainId]) === null || _k === void 0 ? void 0 : _k[8]) !== null && _l !== void 0 ? _l : ZERO_ADDRESS;
71104
+ let factoryCurve = (_o = (_m = types.defaultDexFactories === null || types.defaultDexFactories === void 0 ? void 0 : types.defaultDexFactories[supportedChainId]) === null || _m === void 0 ? void 0 : _m[9]) !== null && _o !== void 0 ? _o : ZERO_ADDRESS;
71104
71105
  if (liquidityDex) {
71105
- dexFactory = (_m = types.dexFactories[supportedChainId]) === null || _m === void 0 ? void 0 : _m[liquidityDex];
71106
- protocol = (_o = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.protocol) !== null && _o !== void 0 ? _o : types.Protocols.V2;
71106
+ dexFactory = (_p = types.dexFactories[supportedChainId]) === null || _p === void 0 ? void 0 : _p[liquidityDex];
71107
+ protocol = (_q = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.protocol) !== null && _q !== void 0 ? _q : types.Protocols.V2;
71107
71108
  switch (protocol) {
71108
71109
  case types.Protocols.V2:
71109
- factoryV2 = (_p = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _p !== void 0 ? _p : factoryV2;
71110
+ factoryV2 = (_r = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _r !== void 0 ? _r : factoryV2;
71110
71111
  break;
71111
71112
  case types.Protocols.V3:
71112
- factoryV3 = (_q = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _q !== void 0 ? _q : factoryV3;
71113
+ factoryV3 = (_s = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _s !== void 0 ? _s : factoryV3;
71113
71114
  break;
71114
71115
  case types.Protocols.Algebra:
71115
- factoryAlgebra = (_r = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _r !== void 0 ? _r : factoryAlgebra;
71116
+ factoryAlgebra = (_t = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _t !== void 0 ? _t : factoryAlgebra;
71116
71117
  break;
71117
71118
  case types.Protocols.Solidly:
71118
- factorySolidly = (_s = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _s !== void 0 ? _s : factorySolidly;
71119
+ factorySolidly = (_u = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _u !== void 0 ? _u : factorySolidly;
71119
71120
  break;
71120
71121
  case types.Protocols.XFAI:
71121
- factoryXFAI = (_t = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _t !== void 0 ? _t : factoryXFAI;
71122
+ factoryXFAI = (_v = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _v !== void 0 ? _v : factoryXFAI;
71123
+ break;
71124
+ case types.Protocols.Curve:
71125
+ factoryCurve = (_w = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _w !== void 0 ? _w : factoryCurve;
71126
+ break;
71122
71127
  }
71123
71128
  }
71124
71129
  const errMsg = `No default dex factory found for retrieving price. For Protocol: ${protocol}.`;
@@ -71146,6 +71151,10 @@ supportedChainId, lpTokens) {
71146
71151
  if (lpTokens && protocol == types.Protocols.V3) {
71147
71152
  protocol = types.Protocols.Steer;
71148
71153
  }
71154
+ // This is a temporary fix for Curve. We should move to new Price getter interface. This is the way backwards compatibility is handled for now for Curve.
71155
+ if (protocol == types.Protocols.Curve) {
71156
+ factoryV2 = factoryCurve;
71157
+ }
71149
71158
  if ([types.ChainId.LINEA, types.ChainId.LIGHTLINK, types.ChainId.IOTA, types.ChainId.BASE, types.ChainId.ARBITRUM].includes(supportedChainId) &&
71150
71159
  !token.lpToken) {
71151
71160
  return [
@@ -72762,7 +72771,9 @@ const getLpType = (protocol) => {
72762
72771
  ? 'univ2'
72763
72772
  : protocol === types.Protocols.V3 // This might be a hot fix. Lets revisit this on the future
72764
72773
  ? 'ichi'
72765
- : null;
72774
+ : protocol === types.Protocols.Curve
72775
+ ? 'curve'
72776
+ : null;
72766
72777
  };
72767
72778
 
72768
72779
  const useSlippage = () => {
@@ -72834,7 +72845,7 @@ const useSoulZapTokenQuote = (typedValue, inputCurrency, outputToken, chainId, a
72834
72845
  underlyingDex: ichiUnderlyingDex,
72835
72846
  vault: isLP ? vault : undefined,
72836
72847
  slippage: slippage,
72837
- lpAddress: lpType === 'solidly' || lpType === 'univ2' ? vault : undefined,
72848
+ lpAddress: lpType === 'solidly' || lpType === 'univ2' || lpType === 'curve' ? vault : undefined,
72838
72849
  router: lpType === 'solidly' || lpType === 'univ2' ? router : undefined,
72839
72850
  toToken: isLP ? undefined : vault,
72840
72851
  },
@@ -74086,7 +74097,7 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
74086
74097
  underlyingDex: ichiUnderlyingDex,
74087
74098
  vault: isReserveBond ? undefined : vault,
74088
74099
  slippage: slippage,
74089
- lpAddress: lpType === 'solidly' || lpType === 'univ2' ? vault : undefined,
74100
+ lpAddress: lpType === 'solidly' || lpType === 'univ2' || lpType === 'curve' ? vault : undefined,
74090
74101
  router: lpType === 'solidly' || lpType === 'univ2' ? router : undefined,
74091
74102
  toToken: isReserveBond ? vault : undefined,
74092
74103
  },
@@ -10,5 +10,5 @@ declare enum NetworkNames {
10
10
  BLAST = "bls"
11
11
  }
12
12
  export declare const getChainParam: (chain?: ChainId) => NetworkNames | null;
13
- export declare const getLpType: (protocol?: Protocols) => "ichi" | "solidly" | "univ2" | null;
13
+ export declare const getLpType: (protocol?: Protocols) => "ichi" | "solidly" | "univ2" | "curve" | null;
14
14
  export {};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ape Bond SDK",
4
4
  "author": "Ape Bond",
5
5
  "license": "MIT",
6
- "version": "2.6.8",
6
+ "version": "2.6.10",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",