From ccd5758a3f39a2b3d260f79d943fc258888ea50a Mon Sep 17 00:00:00 2001 From: shrpne Date: Tue, 4 Jul 2023 16:19:13 +0100 Subject: [PATCH] feat(telegram): update telegram-auth api; update deps --- .env.dev | 2 +- .env.master | 2 +- .env.megachain | 2 +- .env.megagamer | 2 +- .env.testnet | 2 +- api/telegram.js | 2 + api/web3-moralis.js | 4 +- assets/variables.js | 7 +- components/TelegramAuth.vue | 14 +- package-lock.json | 7327 +++++++++++++++++++++-------------- package.json | 36 +- pages/auth/index.vue | 5 +- pages/meganet/index.vue | 2 +- 13 files changed, 4474 insertions(+), 2933 deletions(-) diff --git a/.env.dev b/.env.dev index 3f57738e..6bd36c35 100644 --- a/.env.dev +++ b/.env.dev @@ -7,7 +7,7 @@ APP_EXPLORER_API_URL=https://explorer-api.minter.network/api/v2/ APP_EXPLORER_RTM_URL=wss://explorer-rtm.minter.network/connection/websocket APP_EXPLORER_STATIC_HOST=https://explorer-static.minter.network APP_CARD_TO_MINTER_HOST=https://minter.trade -APP_TELEGRAM_AUTH_HOST=https://premium-bot.honee.app +#APP_TELEGRAM_AUTH_HOST=https://premium-bot.honee.app APP_STAKING_API_URL=https://msp-api.minter.network/v1/ APP_REFERRAL_API_URL=https://mrs-api.minter.network/v1/ APP_PORTFOLIO_API_URL=https://portfolio-api.honee.app/v1/ diff --git a/.env.master b/.env.master index 88112998..9bd17176 100644 --- a/.env.master +++ b/.env.master @@ -7,7 +7,7 @@ APP_EXPLORER_API_URL=https://explorer-api.minter.network/api/v2/ APP_EXPLORER_RTM_URL=wss://explorer-rtm.minter.network/connection/websocket APP_EXPLORER_STATIC_HOST=https://explorer-static.minter.network APP_CARD_TO_MINTER_HOST=https://minter.trade -APP_TELEGRAM_AUTH_HOST=https://premium-bot.honee.app +#APP_TELEGRAM_AUTH_HOST=https://premium-bot.honee.app APP_STAKING_API_URL=https://msp-api.minter.network/v1/ APP_REFERRAL_API_URL=https://mrs-api.minter.network/v1/ APP_PORTFOLIO_API_URL=https://portfolio-api.honee.app/v1/ diff --git a/.env.megachain b/.env.megachain index 8e16ff10..29e3e658 100644 --- a/.env.megachain +++ b/.env.megachain @@ -8,7 +8,7 @@ APP_EXPLORER_API_URL=https://explorer-api.minter.network/api/v2/ APP_EXPLORER_RTM_URL=wss://explorer-rtm.minter.network/connection/websocket APP_EXPLORER_STATIC_HOST=https://explorer-static.minter.network APP_CARD_TO_MINTER_HOST=https://minter.trade -APP_TELEGRAM_AUTH_HOST=https://premium-bot.honee.app +#APP_TELEGRAM_AUTH_HOST=https://premium-bot.honee.app APP_STAKING_API_URL=https://msp-api.minter.network/v1/ APP_REFERRAL_API_URL=https://mrs-api.minter.network/v1/ APP_PORTFOLIO_API_URL=https://portfolio-api.honee.app/v1/ diff --git a/.env.megagamer b/.env.megagamer index dae3dfc4..9d1f3739 100644 --- a/.env.megagamer +++ b/.env.megagamer @@ -8,7 +8,7 @@ APP_EXPLORER_API_URL=https://explorer-api.minter.network/api/v2/ APP_EXPLORER_RTM_URL=wss://explorer-rtm.minter.network/connection/websocket APP_EXPLORER_STATIC_HOST=https://explorer-static.minter.network APP_CARD_TO_MINTER_HOST=https://minter.trade -APP_TELEGRAM_AUTH_HOST=https://metagarden-bot.minter.network +#APP_TELEGRAM_AUTH_HOST=https://metagarden-bot.minter.network APP_STAKING_API_URL=https://msp-api.minter.network/v1/ APP_REFERRAL_API_URL=https://mrs-api.minter.network/v1/ APP_PORTFOLIO_API_URL=https://portfolio-api.honee.app/v1/ diff --git a/.env.testnet b/.env.testnet index eebcdee4..75e7ebc4 100644 --- a/.env.testnet +++ b/.env.testnet @@ -6,7 +6,7 @@ APP_EXPLORER_API_URL=https://explorer-api.testnet.minter.network/api/v2/ APP_EXPLORER_RTM_URL=wss://explorer-rtm.testnet.minter.network/connection/websocket APP_EXPLORER_STATIC_HOST=https://explorer-static.testnet.minter.network APP_CARD_TO_MINTER_HOST=https://minter.trade -APP_TELEGRAM_AUTH_HOST=https://premium-bot.honee.app +#APP_TELEGRAM_AUTH_HOST=https://premium-bot.honee.app APP_STAKING_API_URL=https://msp-api.testnet.minter.network/v1/ APP_REFERRAL_API_URL=https://mrs-api.minter.network/v1/ APP_PORTFOLIO_API_URL=https://portfolio-api.kubernetes.icu/v1/ diff --git a/api/telegram.js b/api/telegram.js index b1aa4130..8acf0411 100644 --- a/api/telegram.js +++ b/api/telegram.js @@ -110,6 +110,8 @@ export function sendAddress(telegramId, address, initData) { telegramId, address, initData, + // metagarden-bot.minter.network api requires token, so hardcode some everywhere https://t.me/c/1747718110/1533 + token: 'LAUNCHPAD', })); } diff --git a/api/web3-moralis.js b/api/web3-moralis.js index 38a7521c..aaffa4f5 100644 --- a/api/web3-moralis.js +++ b/api/web3-moralis.js @@ -1,7 +1,7 @@ -import MoralisCore, {CoreProvider} from '@moralisweb3/common-core'; +import {Core as MoralisCore, CoreProvider} from '@moralisweb3/common-core'; import {ApiUtils} from '@moralisweb3/api-utils'; import { CommonEvmUtils, EvmChain, Erc20Value, EvmChainResolver } from '@moralisweb3/common-evm-utils'; -import MoralisEvmApi from '@moralisweb3/evm-api'; +import {EvmApi as MoralisEvmApi} from '@moralisweb3/evm-api'; // import MoralisEvmApi from '~/api/web3-moralis-evm-api.js'; import {getProviderByChain} from 'minter-js-web3-sdk/src/web3.js'; import {NATIVE_COIN_ADDRESS, MORALIS_API_URL, MORALIS_API_KEY, HUB_CHAIN_BY_ID} from "~/assets/variables.js"; diff --git a/assets/variables.js b/assets/variables.js index 9a778ead..b6fd82e5 100644 --- a/assets/variables.js +++ b/assets/variables.js @@ -28,9 +28,12 @@ export const CHAINIK_API_URL = 'https://chainik.io/json/'; export const FARM_API_URL = 'https://yf.chainik.io/api/v1/'; export const CARD_TO_MINTER_HOST = process.env.APP_CARD_TO_MINTER_HOST; export const CARD_TO_MINTER_API_URL = 'https://card-api.minter.trade/v1/'; -export const TELEGRAM_AUTH_HOST = process.env.APP_TELEGRAM_AUTH_HOST; +export const TELEGRAM_AUTH_BOT_NAME = IS_SUBAPP_MEGACHAIN || IS_SUBAPP_MEGAGAMER ? 'MetagardenBot' : 'HoneePremiumBot'; +export const TELEGRAM_AUTH_HOST = IS_SUBAPP_MEGACHAIN || IS_SUBAPP_MEGAGAMER ? 'https://metagarden-bot.minter.network' : 'https://premium-bot.honee.app'; export const TELEGRAM_AUTH_API_URL = TELEGRAM_AUTH_HOST + '/api/v1/'; -export const TELEGRAM_LEGACY_AUTH_API_URL = IS_SUBAPP_MEGAGAMER ? TELEGRAM_AUTH_API_URL : 'https://telegram-auth.honee.app/api/v1/'; +// 'legacy' now means 'without ecdsaAuth', real legacy not used anymore +export const TELEGRAM_LEGACY_AUTH_API_URL = IS_SUBAPP_MEGAGAMER ? TELEGRAM_AUTH_API_URL : ''; +// export const TELEGRAM_LEGACY_AUTH_API_URL = 'https://telegram-auth.honee.app/api/v1/'; export const STAKING_API_URL = process.env.APP_STAKING_API_URL; export const REFERRAL_API_URL = process.env.APP_REFERRAL_API_URL; export const PORTFOLIO_API_URL = process.env.APP_PORTFOLIO_API_URL; diff --git a/components/TelegramAuth.vue b/components/TelegramAuth.vue index ae3463e0..a6fb5fbc 100644 --- a/components/TelegramAuth.vue +++ b/components/TelegramAuth.vue @@ -1,6 +1,6 @@