From 33a31c1c9e5f50a33ef650fa1ac19452ebb783f8 Mon Sep 17 00:00:00 2001 From: Danh Date: Wed, 26 Jul 2023 21:04:06 +0700 Subject: [PATCH 1/2] remove unused, upgrade sdk --- package.json | 2 +- src/services/baseQueryOauth.ts | 4 +- src/services/notification.ts | 76 ---------------------------------- yarn.lock | 8 ++-- 4 files changed, 7 insertions(+), 83 deletions(-) delete mode 100644 src/services/notification.ts diff --git a/package.json b/package.json index 7f4d3635e6..7ff6a103a5 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "@apollo/client": "^3.7.1", "@datadog/browser-rum": "^4.23.3", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", - "@kybernetwork/oauth2": "0.0.9", + "@kybernetwork/oauth2": "1.0.0", "@kyberswap/ks-sdk-classic": "^1.0.3", "@kyberswap/ks-sdk-core": "1.0.7-rc2", "@kyberswap/ks-sdk-elastic": "^1.1.2", diff --git a/src/services/baseQueryOauth.ts b/src/services/baseQueryOauth.ts index f1752abeb2..b39f83773c 100644 --- a/src/services/baseQueryOauth.ts +++ b/src/services/baseQueryOauth.ts @@ -1,4 +1,4 @@ -import KyberOauth2 from '@kybernetwork/oauth2' +import { KyberOauth2Api } from '@kybernetwork/oauth2' import { BaseQueryFn, fetchBaseQuery } from '@reduxjs/toolkit/query' import { checkIamDown } from 'utils/iamError' @@ -10,7 +10,7 @@ const queryWithToken = async (config: any, baseUrl: string) => { config.data = config.data || config.body } config.url = baseUrl + config.url - const result = await KyberOauth2.callHttp(config) + const result = await KyberOauth2Api.call(config) return { data: result.data } } catch (err) { checkIamDown(err) diff --git a/src/services/notification.ts b/src/services/notification.ts deleted file mode 100644 index bc02c0a0f9..0000000000 --- a/src/services/notification.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react' - -import { NOTIFICATION_API } from 'constants/env' -import { Topic } from 'hooks/useNotification' - -const NotificationApi = createApi({ - reducerPath: 'notificationApi', - baseQuery: fetchBaseQuery({ baseUrl: NOTIFICATION_API }), - endpoints: builder => ({ - getNotificationTopics: builder.query< - { topicGroups: Topic[]; user: { email: string; telegram: string } }, - string | null | undefined - >({ - query: walletAddress => ({ - url: `${'https://ks-setting.stg.kyberengineering.io/api'}/v1/topic-groups`, - params: walletAddress ? { walletAddress } : {}, - }), - transformResponse: (data: any) => data?.data, - }), - getConnectedWallet: builder.query({ - query: email => ({ - url: `/v1/users/connected`, - params: { email }, - }), - transformResponse: (data: any) => data?.data?.walletAddress, - }), - ackTelegramSubscriptionStatus: builder.mutation({ - query: wallet => ({ - url: `/v1/subscription-result/telegram`, - method: 'DELETE', - body: { wallet }, - }), - }), - unsubscribeTopic: builder.mutation({ - query: body => ({ - url: `/v1/topics/unsubscribe?userType=EMAIL`, - method: 'POST', - body, - }), - }), - subscribeTopic: builder.mutation({ - query: body => ({ - url: `/v1/topics/subscribe?userType=EMAIL`, - method: 'POST', - body, - }), - }), - buildTelegramVerification: builder.mutation< - string, - { - chainId: string - wallet: string - subscribe: number[] - unsubscribe: number[] - } - >({ - query: body => ({ - url: `/v1/topics/build-verification/telegram`, - method: 'POST', - body, - }), - transformResponse: (data: any) => data?.data?.verificationUrl, - }), - }), -}) - -export const { - useLazyGetConnectedWalletQuery, - useAckTelegramSubscriptionStatusMutation, - useSubscribeTopicMutation, - useUnsubscribeTopicMutation, - useBuildTelegramVerificationMutation, - useGetNotificationTopicsQuery, -} = NotificationApi - -export default NotificationApi diff --git a/yarn.lock b/yarn.lock index 51d0cecc1d..9349def944 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2042,10 +2042,10 @@ bs58 "^5.0.0" uuid "^8.3.2" -"@kybernetwork/oauth2@0.0.9": - version "0.0.9" - resolved "https://npm.pkg.github.com/download/@kybernetwork/oauth2/0.0.9/283841d908de226641396505390162fbe3be37c1#283841d908de226641396505390162fbe3be37c1" - integrity sha512-Hy8rot2NRQgHHQXaikuuI2VT183m9hgyXBT8ALxrrGigRDeglpVFFIZZqdsctGIZDQp4jZFXI1UiS0TLDhf+3A== +"@kybernetwork/oauth2@1.0.0": + version "1.0.0" + resolved "https://npm.pkg.github.com/download/@kybernetwork/oauth2/1.0.0/dbb42e967c8a6755bb801b2c528064764534d00e#dbb42e967c8a6755bb801b2c528064764534d00e" + integrity sha512-fIv7W+s+PIK8xxm+aic4GjtrKZsv8TRuqNfa6CeDGOW16oxhZlSARHVJy4rWfGxAVT2+0GRuXXR2uMSwAdfczw== dependencies: axios "1.2.1" client-oauth2 "^4.3.3" From 49b25ab3e4d73850ecd9cd3a4284c9e8abf142d1 Mon Sep 17 00:00:00 2001 From: Danh Date: Wed, 26 Jul 2023 21:07:07 +0700 Subject: [PATCH 2/2] rm unused --- src/assets/svg/desktop_mobile_icon.svg | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 src/assets/svg/desktop_mobile_icon.svg diff --git a/src/assets/svg/desktop_mobile_icon.svg b/src/assets/svg/desktop_mobile_icon.svg deleted file mode 100644 index d7f3963b11..0000000000 --- a/src/assets/svg/desktop_mobile_icon.svg +++ /dev/null @@ -1,3 +0,0 @@ - - -