Skip to content

Commit

Permalink
feat(telegram): update telegram-auth api; update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
shrpne committed Jul 4, 2023
1 parent 0914b3e commit ccd5758
Show file tree
Hide file tree
Showing 13 changed files with 4,474 additions and 2,933 deletions.
2 changes: 1 addition & 1 deletion .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion .env.master
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion .env.megachain
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion .env.megagamer
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion .env.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 2 additions & 0 deletions api/telegram.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}));
}

Expand Down
4 changes: 2 additions & 2 deletions api/web3-moralis.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
7 changes: 5 additions & 2 deletions assets/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 4 additions & 10 deletions components/TelegramAuth.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<script>
import {getAuthString} from '~/api/telegram.js';
import {IS_SUBAPP_MEGAGAMER, TELEGRAM_AUTH_HOST} from '~/assets/variables.js';
import {IS_SUBAPP_MEGAGAMER, TELEGRAM_AUTH_BOT_NAME, TELEGRAM_AUTH_HOST} from '~/assets/variables.js';
import useNow from '~/composables/use-now.js';
import BaseLoader from '~/components/base/BaseLoader.vue';
import Modal from '~/components/base/Modal.vue';
let timer;
export default {
TELEGRAM_AUTH_BOT_NAME,
components: {
BaseLoader,
Modal,
Expand Down Expand Up @@ -45,21 +46,14 @@ export default {
}
return getAuthString(this.timestamp, this.$store.getters.privateKey);
},
botName() {
if (this.$store.getters.isMegagamer) {
return 'MetagardenBot';
} else {
return 'HoneePremiumBot';
}
},
loginUrl() {
if (!this.$store.getters.privateKey) {
return '';
}
return `${TELEGRAM_AUTH_HOST}/login?timestamp=${this.timestamp}&auth=${this.authString}&reason=${this.reason}`;
},
loginUrlLegacy() {
return `https://t.me/${this.botName}?start=${base64UrlEncode(this.$store.state.telegram.legacySecretDeviceId)}`;
return `https://t.me/${TELEGRAM_AUTH_BOT_NAME}?start=${base64UrlEncode(this.$store.state.telegram.legacySecretDeviceId)}`;
// return `https://t.me/HoneeAuthBot?start=${this.$store.state.telegram.legacySecretDeviceId}`;
},
loginUrlFinal() {
Expand Down Expand Up @@ -131,7 +125,7 @@ function base64UrlEncode(str) {
<h2 class="u-h3 u-mb-10">{{ $td('Login with Telegram', 'battle.telegram-login-button') }}</h2>
<p class="u-mb-10">
{{ $td('Click Start in the', 'battle.telegram-login-description') }}
{{ botName }}
{{ $options.TELEGRAM_AUTH_BOT_NAME }}
</p>

<BaseLoader :is-loading="true"/>
Expand Down
Loading

0 comments on commit ccd5758

Please sign in to comment.