@ape.swap/bonds-sdk 3.0.91 → 3.0.92

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/main.js +22 -21
  2. package/package.json +2 -2
package/dist/main.js CHANGED
@@ -22499,6 +22499,7 @@ const SoulZapTokenManager = {
22499
22499
  [types.ChainId.AVAX]: '0xC4dE46cBE21400dabE2E7c66E04F43acE4b5b910',
22500
22500
  [types.ChainId.BLAST]: '0xde9Eb844AD9e8B067309205707e2fFaA6a049cc0',
22501
22501
  [types.ChainId.BERACHAIN]: '0xcFd581f15433899d093ca1ADfc3aC13c37DBfbe7',
22502
+ [types.ChainId.SONIC]: '0x70005da62e17041977f7f99f91098b125ccde1a7',
22502
22503
  };
22503
22504
  const ACF_TO_ABOND = '0xEce2b9C3704632Ce760271B0b84E3A4A698Ca962';
22504
22505
  const LENS_CONTRACT = {
@@ -58352,7 +58353,7 @@ const stagingUrls = {
58352
58353
  };
58353
58354
  const useSDKConfig = (config) => {
58354
58355
  const urls = process.env.NODE_ENV === 'production' ? defaultUrls : stagingUrls;
58355
- const initialData = Object.assign(Object.assign({ referenceId: '', chains: [], useHotBonds: true, useRainbowKit: false, useTiers: false, useTGEBonds: false, showLowValueBonds: false, bondPartner: undefined }, config), { urls: Object.assign(Object.assign({}, urls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.1.2' });
58356
+ const initialData = Object.assign(Object.assign({ referenceId: '', chains: [], useHotBonds: true, useRainbowKit: false, useTiers: false, useTGEBonds: false, showLowValueBonds: false, bondPartner: undefined }, config), { urls: Object.assign(Object.assign({}, urls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.1.3' });
58356
58357
  const { data } = useQuery({
58357
58358
  queryKey: [QUERY_KEYS.SDK_CONFIG],
58358
58359
  initialData,
@@ -78482,7 +78483,7 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
78482
78483
  };
78483
78484
 
78484
78485
  const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account, tierProofSig) => {
78485
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
78486
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
78486
78487
  const debouncedInput = useDebounce(typedValue, 400);
78487
78488
  const [slippage] = useSlippage();
78488
78489
  const principalToken = bond === null || bond === void 0 ? void 0 : bond.lpToken;
@@ -78493,12 +78494,12 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account, tierProof
78493
78494
  const principalContractAddress = principalToken === null || principalToken === void 0 ? void 0 : principalToken.address[chainId];
78494
78495
  const chainName = getChainParam(chainId);
78495
78496
  const isReserveBond = (bond === null || bond === void 0 ? void 0 : bond.billType) === 'reserve' || (bond === null || bond === void 0 ? void 0 : bond.billType) === 'staking';
78496
- const liquidityDex = (_a = principalToken === null || principalToken === void 0 ? void 0 : principalToken.liquidityDex) === null || _a === void 0 ? void 0 : _a[chainId];
78497
- const protocol = (_c = (_b = types.dexFactories[chainId]) === null || _b === void 0 ? void 0 : _b[liquidityDex]) === null || _c === void 0 ? void 0 : _c.protocol;
78497
+ const liquidityDex = (_b = (_a = principalToken === null || principalToken === void 0 ? void 0 : principalToken.liquiditySource) === null || _a === void 0 ? void 0 : _a[chainId]) !== null && _b !== void 0 ? _b : (_c = principalToken === null || principalToken === void 0 ? void 0 : principalToken.liquidityDex) === null || _c === void 0 ? void 0 : _c[chainId];
78498
+ const protocol = (_e = (_d = types.dexFactories[chainId]) === null || _d === void 0 ? void 0 : _d[liquidityDex]) === null || _e === void 0 ? void 0 : _e.protocol;
78498
78499
  const lpType = isReserveBond ? 'single' : getLpType(protocol);
78499
78500
  const ichiUnderlyingDex = principalToken === null || principalToken === void 0 ? void 0 : principalToken.ichiUnderlyingDex;
78500
- const vault = (_d = principalToken === null || principalToken === void 0 ? void 0 : principalToken.address) === null || _d === void 0 ? void 0 : _d[chainId];
78501
- const router = (_f = (_e = types.dexFactories[chainId]) === null || _e === void 0 ? void 0 : _e[liquidityDex]) === null || _f === void 0 ? void 0 : _f.router;
78501
+ const vault = (_f = principalToken === null || principalToken === void 0 ? void 0 : principalToken.address) === null || _f === void 0 ? void 0 : _f[chainId];
78502
+ const router = (_h = (_g = types.dexFactories[chainId]) === null || _g === void 0 ? void 0 : _g[liquidityDex]) === null || _h === void 0 ? void 0 : _h.router;
78502
78503
  // Validates that the user did not pass an amount with 19 decimals or more
78503
78504
  const validated18DecimalAmount = new BigNumber$1(debouncedInput !== null && debouncedInput !== void 0 ? debouncedInput : '0').toFixed(18, 5);
78504
78505
  const bigishInputAmount = new BigNumber$1(validated18DecimalAmount !== null && validated18DecimalAmount !== void 0 ? validated18DecimalAmount : '0')
@@ -78586,29 +78587,29 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account, tierProof
78586
78587
  const zapError = !!error;
78587
78588
  const tokenList = zapInputTokens[chainId] ? zapInputTokens[chainId] : [];
78588
78589
  // toToken0 data
78589
- const toToken0Estimate = (_h = (_g = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _g === void 0 ? void 0 : _g.token0) === null || _h === void 0 ? void 0 : _h.fromAmountEstimate;
78590
- const toToken0 = (_j = [...tokenList, principalToken]) === null || _j === void 0 ? void 0 : _j.find((token) => { var _a, _b, _c, _d, _e; return ((_b = (_a = token === null || token === void 0 ? void 0 : token.address) === null || _a === void 0 ? void 0 : _a[chainId]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === ((_e = (_d = (_c = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _c === void 0 ? void 0 : _c.token0) === null || _d === void 0 ? void 0 : _d.address) === null || _e === void 0 ? void 0 : _e.toLowerCase()); });
78590
+ const toToken0Estimate = (_k = (_j = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _j === void 0 ? void 0 : _j.token0) === null || _k === void 0 ? void 0 : _k.fromAmountEstimate;
78591
+ const toToken0 = (_l = [...tokenList, principalToken]) === null || _l === void 0 ? void 0 : _l.find((token) => { var _a, _b, _c, _d, _e; return ((_b = (_a = token === null || token === void 0 ? void 0 : token.address) === null || _a === void 0 ? void 0 : _a[chainId]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === ((_e = (_d = (_c = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _c === void 0 ? void 0 : _c.token0) === null || _d === void 0 ? void 0 : _d.address) === null || _e === void 0 ? void 0 : _e.toLowerCase()); });
78591
78592
  const toToken0Price = useCurrencyPrice(toToken0 !== null && toToken0 !== void 0 ? toToken0 : null, chainId);
78592
78593
  // toToken1 data
78593
- const toToken1Estimate = (_l = (_k = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _k === void 0 ? void 0 : _k.token1) === null || _l === void 0 ? void 0 : _l.fromAmountEstimate;
78594
- const toToken1 = (_m = zapInputTokens[chainId]) === null || _m === void 0 ? void 0 : _m.find((token) => { var _a, _b, _c, _d; return ((_a = token.address[chainId]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _b === void 0 ? void 0 : _b.token1) === null || _c === void 0 ? void 0 : _c.address) === null || _d === void 0 ? void 0 : _d.toLowerCase()); });
78594
+ const toToken1Estimate = (_o = (_m = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _m === void 0 ? void 0 : _m.token1) === null || _o === void 0 ? void 0 : _o.fromAmountEstimate;
78595
+ const toToken1 = (_p = zapInputTokens[chainId]) === null || _p === void 0 ? void 0 : _p.find((token) => { var _a, _b, _c, _d; return ((_a = token.address[chainId]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _b === void 0 ? void 0 : _b.token1) === null || _c === void 0 ? void 0 : _c.address) === null || _d === void 0 ? void 0 : _d.toLowerCase()); });
78595
78596
  const toToken1Price = useCurrencyPrice(toToken1 !== null && toToken1 !== void 0 ? toToken1 : null, chainId);
78596
- let toToken0USD = (_q = (_o = new BigNumber$1(toToken0Estimate !== null && toToken0Estimate !== void 0 ? toToken0Estimate : '0')) === null || _o === void 0 ? void 0 : _o.div(new BigNumber$1(10).pow((_p = toToken0 === null || toToken0 === void 0 ? void 0 : toToken0.decimals[chainId]) !== null && _p !== void 0 ? _p : 18)) // this is amount of swap output
78597
- ) === null || _q === void 0 ? void 0 : _q.times(new BigNumber$1((_r = toToken0Price === null || toToken0Price === void 0 ? void 0 : toToken0Price.price) !== null && _r !== void 0 ? _r : 0)); // convert it to usd price
78598
- if ((_t = (_s = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _s === void 0 ? void 0 : _s.token0) === null || _t === void 0 ? void 0 : _t.fromAmountUSD) {
78599
- toToken0USD = new BigNumber$1((_v = (_u = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _u === void 0 ? void 0 : _u.token0) === null || _v === void 0 ? void 0 : _v.fromAmountUSD);
78597
+ let toToken0USD = (_s = (_q = new BigNumber$1(toToken0Estimate !== null && toToken0Estimate !== void 0 ? toToken0Estimate : '0')) === null || _q === void 0 ? void 0 : _q.div(new BigNumber$1(10).pow((_r = toToken0 === null || toToken0 === void 0 ? void 0 : toToken0.decimals[chainId]) !== null && _r !== void 0 ? _r : 18)) // this is amount of swap output
78598
+ ) === null || _s === void 0 ? void 0 : _s.times(new BigNumber$1((_t = toToken0Price === null || toToken0Price === void 0 ? void 0 : toToken0Price.price) !== null && _t !== void 0 ? _t : 0)); // convert it to usd price
78599
+ if ((_v = (_u = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _u === void 0 ? void 0 : _u.token0) === null || _v === void 0 ? void 0 : _v.fromAmountUSD) {
78600
+ toToken0USD = new BigNumber$1((_x = (_w = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _w === void 0 ? void 0 : _w.token0) === null || _x === void 0 ? void 0 : _x.fromAmountUSD);
78600
78601
  }
78601
- let toToken1USD = (_y = (_w = new BigNumber$1(toToken1Estimate !== null && toToken1Estimate !== void 0 ? toToken1Estimate : '0')) === null || _w === void 0 ? void 0 : _w.div(new BigNumber$1(10).pow((_x = toToken1 === null || toToken1 === void 0 ? void 0 : toToken1.decimals[chainId]) !== null && _x !== void 0 ? _x : 18)) // this is amount of swap output
78602
- ) === null || _y === void 0 ? void 0 : _y.times(new BigNumber$1((_z = toToken1Price === null || toToken1Price === void 0 ? void 0 : toToken1Price.price) !== null && _z !== void 0 ? _z : 0)); // convert it to usd price
78603
- if ((_1 = (_0 = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _0 === void 0 ? void 0 : _0.token1) === null || _1 === void 0 ? void 0 : _1.fromAmountUSD) {
78604
- toToken1USD = new BigNumber$1((_3 = (_2 = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _2 === void 0 ? void 0 : _2.token1) === null || _3 === void 0 ? void 0 : _3.fromAmountUSD);
78602
+ let toToken1USD = (_0 = (_y = new BigNumber$1(toToken1Estimate !== null && toToken1Estimate !== void 0 ? toToken1Estimate : '0')) === null || _y === void 0 ? void 0 : _y.div(new BigNumber$1(10).pow((_z = toToken1 === null || toToken1 === void 0 ? void 0 : toToken1.decimals[chainId]) !== null && _z !== void 0 ? _z : 18)) // this is amount of swap output
78603
+ ) === null || _0 === void 0 ? void 0 : _0.times(new BigNumber$1((_1 = toToken1Price === null || toToken1Price === void 0 ? void 0 : toToken1Price.price) !== null && _1 !== void 0 ? _1 : 0)); // convert it to usd price
78604
+ if ((_3 = (_2 = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _2 === void 0 ? void 0 : _2.token1) === null || _3 === void 0 ? void 0 : _3.fromAmountUSD) {
78605
+ toToken1USD = new BigNumber$1((_5 = (_4 = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _4 === void 0 ? void 0 : _4.token1) === null || _5 === void 0 ? void 0 : _5.fromAmountUSD);
78605
78606
  }
78606
78607
  const youSpendUSD = toToken0USD.plus(toToken1USD); // youSpendUSD
78607
- const estimatedDepositAmount = youSpendUSD.div((_4 = bond === null || bond === void 0 ? void 0 : bond.principalTokenPrice) !== null && _4 !== void 0 ? _4 : '0');
78608
+ const estimatedDepositAmount = youSpendUSD.div((_6 = bond === null || bond === void 0 ? void 0 : bond.principalTokenPrice) !== null && _6 !== void 0 ? _6 : '0');
78608
78609
  const isWrap = inputCurrency === 'NATIVE' &&
78609
- ((_7 = (_6 = (_5 = bond === null || bond === void 0 ? void 0 : bond.lpToken) === null || _5 === void 0 ? void 0 : _5.address) === null || _6 === void 0 ? void 0 : _6[chainId]) === null || _7 === void 0 ? void 0 : _7.toLowerCase()) === ((_10 = (_9 = (_8 = WNATIVE[chainId]) === null || _8 === void 0 ? void 0 : _8.address) === null || _9 === void 0 ? void 0 : _9[chainId]) === null || _10 === void 0 ? void 0 : _10.toLowerCase());
78610
+ ((_9 = (_8 = (_7 = bond === null || bond === void 0 ? void 0 : bond.lpToken) === null || _7 === void 0 ? void 0 : _7.address) === null || _8 === void 0 ? void 0 : _8[chainId]) === null || _9 === void 0 ? void 0 : _9.toLowerCase()) === ((_12 = (_11 = (_10 = WNATIVE[chainId]) === null || _10 === void 0 ? void 0 : _10.address) === null || _11 === void 0 ? void 0 : _11[chainId]) === null || _12 === void 0 ? void 0 : _12.toLowerCase());
78610
78611
  const estimatedDepositAmountToReturn = isWrap ? typedValue : estimatedDepositAmount.toString();
78611
- const trueBondPrice = (_11 = response === null || response === void 0 ? void 0 : response.protocolQuote) === null || _11 === void 0 ? void 0 : _11.trueBondPrice;
78612
+ const trueBondPrice = (_13 = response === null || response === void 0 ? void 0 : response.protocolQuote) === null || _13 === void 0 ? void 0 : _13.trueBondPrice;
78612
78613
  const zapLoading = isLoading || isFetching;
78613
78614
  if (zapLoading)
78614
78615
  return [true, undefined, '', false, undefined];
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": "3.0.91",
6
+ "version": "3.0.92",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",
@@ -68,7 +68,7 @@
68
68
  "yalc": "^1.0.0-pre.53"
69
69
  },
70
70
  "dependencies": {
71
- "@ape.swap/apeswap-lists": "4.3.27",
71
+ "@ape.swap/apeswap-lists": "4.3.28",
72
72
  "@emotion/react": "11.11.4",
73
73
  "bignumber.js": "^9.1.2",
74
74
  "chart.js": "4.2.0",