addLiq.mjs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. export const addLiquidity = async (position, symbol, maxUsdValue) => {
  2. // https://discord.com/api/webhooks/1457714616636280978/YFMGaZEj2gJwUjINpFfJIkagG1I3SLZRwz9bGpc2OlGFWBVa88r73cMIkBpX3iGpSIjV discord 通知
  3. fetch('http://91.108.80.73/api/lp-copy', {
  4. method: 'POST',
  5. headers: {
  6. 'Content-Type': 'application/json',
  7. },
  8. body: JSON.stringify({
  9. positionAddress: position.positionAddress,
  10. maxUsdValue: maxUsdValue || 1,
  11. }),
  12. })
  13. .then((res) => res.json())
  14. .then((data) => {
  15. if (data.success) {
  16. message.success('快速复制成功')
  17. // discord 通知
  18. fetch('https://discord.com/api/webhooks/1457714616636280978/YFMGaZEj2gJwUjINpFfJIkagG1I3SLZRwz9bGpc2OlGFWBVa88r73cMIkBpX3iGpSIjV', {
  19. method: 'POST',
  20. headers: {
  21. 'Content-Type': 'application/json',
  22. },
  23. body: JSON.stringify({
  24. content: `${symbol} 复制流动性成功: https://www.byreal.io/en/portfolio?userAddress=${position.walletAddress}&tab=current&positionAddress=${position.positionAddress}`,
  25. }),
  26. })
  27. } else {
  28. // discord 通知
  29. fetch('https://discord.com/api/webhooks/1457714616636280978/YFMGaZEj2gJwUjINpFfJIkagG1I3SLZRwz9bGpc2OlGFWBVa88r73cMIkBpX3iGpSIjV', {
  30. method: 'POST',
  31. headers: {
  32. 'Content-Type': 'application/json',
  33. },
  34. body: JSON.stringify({
  35. content: `${symbol} 复制流动性失败: https://www.byreal.io/en/portfolio?userAddress=${position.walletAddress}&tab=current&positionAddress=${position.positionAddress}`,
  36. }),
  37. })
  38. }
  39. })
  40. .catch((err) => {
  41. console.error('Error quick copying:', err)
  42. // discord 通知
  43. fetch('https://discord.com/api/webhooks/1457714616636280978/YFMGaZEj2gJwUjINpFfJIkagG1I3SLZRwz9bGpc2OlGFWBVa88r73cMIkBpX3iGpSIjV', {
  44. method: 'POST',
  45. headers: {
  46. 'Content-Type': 'application/json',
  47. },
  48. body: JSON.stringify({
  49. content: `${symbol} 复制流动性失败: https://www.byreal.io/en/portfolio?userAddress=${position.walletAddress}&tab=current&positionAddress=${position.positionAddress}, ${err.message}`,
  50. }),
  51. })
  52. })
  53. }