Skip to content

Commit

Permalink
Merge pull request #71 from InjectiveLabs/feat/nuxt-3.13.2
Browse files Browse the repository at this point in the history
Feat: nuxt 3.13.2
  • Loading branch information
ThomasRalee authored Oct 16, 2024
2 parents 1a84170 + 802171e commit b13d565
Show file tree
Hide file tree
Showing 16 changed files with 1,836 additions and 1,578 deletions.
6 changes: 5 additions & 1 deletion layer/composables/hooks/onWalletConnected.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { EventBus } from './../../types'

export default function onWalletConnected(callback: Function) {
export const onWalletConnected = (callback: Function) => {
onMounted(() => {
callback()

useEventBus(EventBus.WalletConnected).on(() => callback())
})
}

export const onWalletInitialConnected = (callback: Function) => {
useEventBus(EventBus.WalletConnected).on(() => callback())
}
34 changes: 34 additions & 0 deletions layer/icons/google-color.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<template>
<svg
width="18"
height="18"
viewBox="0 0 18 18"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M17.64 9.20419C17.64 8.56601 17.5827 7.95237 17.4764 7.36328H9V10.8446H13.8436C13.635 11.9696 13.0009 12.9228 12.0477 13.561V15.8192H14.9564C16.6582 14.2524 17.64 11.9451 17.64 9.20419Z"
fill="#4285F4"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M9 18C11.43 18 13.4673 17.1941 14.9564 15.8195L12.0477 13.5613C11.2418 14.1013 10.2109 14.4204 9 14.4204C6.65591 14.4204 4.67182 12.8372 3.96409 10.71H0.957275V13.0418C2.43818 15.9831 5.48182 18 9 18Z"
fill="#34A853"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M3.96409 10.7098C3.78409 10.1698 3.68182 9.59301 3.68182 8.99983C3.68182 8.40664 3.78409 7.82983 3.96409 7.28983V4.95801H0.957273C0.347727 6.17301 0 7.54755 0 8.99983C0 10.4521 0.347727 11.8266 0.957273 13.0416L3.96409 10.7098Z"
fill="#FBBC05"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M9 3.57955C10.3214 3.57955 11.5077 4.03364 12.4405 4.92545L15.0218 2.34409C13.4632 0.891818 11.4259 0 9 0C5.48182 0 2.43818 2.01682 0.957275 4.95818L3.96409 7.29C4.67182 5.16273 6.65591 3.57955 9 3.57955Z"
fill="#EA4335"
/>
</svg>
</template>
10 changes: 10 additions & 0 deletions layer/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type {
ComponentCustomOptions as _ComponentCustomOptions,
ComponentCustomProperties as _ComponentCustomProperties
} from 'vue'

declare module '@vue/runtime-core' {
interface ComponentCustomProperties extends _ComponentCustomProperties {
$t: (key: string, ...params: any[]) => string
}
}
24 changes: 24 additions & 0 deletions layer/nuxt-config/bugsnag.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const shouldInstantiateBugsnag = !!(
process.env.GIT_TAG &&
process.env.VITE_ENV &&
process.env.VITE_BASE_URL &&
process.env.VITE_BUGSNAG_KEY
)

const bugsnagConfig = {
baseUrl: process.env.VITE_BASE_URL,
config: {
appVersion: process.env.GIT_TAG,
releaseStage: process.env.VITE_ENV,
apiKey: process.env.VITE_BUGSNAG_KEY,
notifyReleaseStages: ['staging', 'mainnet']
}
}

console.log(
`Instantiating bugsnag: ${shouldInstantiateBugsnag}`,
'\n',
bugsnagConfig
)

export default shouldInstantiateBugsnag ? bugsnagConfig : undefined
7 changes: 0 additions & 7 deletions layer/nuxt-config/hooks/index.ts

This file was deleted.

3 changes: 1 addition & 2 deletions layer/nuxt-config/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import hooks from './hooks'
import vite from './vite'

export { hooks, vite }
export { vite }
7 changes: 4 additions & 3 deletions layer/nuxt-config/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ export default defineConfig({
include: isProduction
? []
: [
'tailwind-merge',
'class-variance-authority',
'mixpanel-browser',
'date-fns',
'vue-imask',
'vue-hotjar',
Expand All @@ -88,10 +85,14 @@ export default defineConfig({
'js-confetti',
'date-fns-tz',
'floating-vue',
'tailwind-merge',
'canvas-confetti',
'mixpanel-browser',
'lightweight-charts',
'@injectivelabs/utils',
'@injectivelabs/sdk-ts',
'qr-code-generator-vue3',
'class-variance-authority',
'@injectivelabs/wallet-ts',
...(isLocalLayer ? [] : additionalDeps)
],
Expand Down
30 changes: 7 additions & 23 deletions layer/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineNuxtConfig } from 'nuxt/config'
import { vite, hooks } from './nuxt-config'
import { vite } from './nuxt-config'
import { createResolver } from '@nuxt/kit'
import bugsnag from './nuxt-config/bugsnag'
import { vitePlugins } from './nuxt-config/vite'

const isProduction = process.env.NODE_ENV === 'production'
Expand All @@ -9,15 +10,10 @@ const { resolve } = createResolver(import.meta.url)

export default defineNuxtConfig({
vite,
hooks,
plugins: vitePlugins,
devtools: { enabled: true },
alias: { '@shared': resolve('./') },

build: {
transpile: ['@nuxtjs/i18n']
},

imports: {
dirs: ['composables/**', 'store/**', 'store/**/index.ts']
},
Expand All @@ -32,31 +28,19 @@ export default defineNuxtConfig({
'@vueuse/nuxt',
'@nuxt/devtools',
'@nuxtjs/tailwindcss',
'nuxt-lcp-speedup',
'nuxt-vitalizer',
...(process.env.VITE_BUGSNAG_KEY ? ['@injectivelabs/nuxt-bugsnag'] : [])
],

typescript: {
typeCheck: 'build'
},

// @ts-ignore
bugsnag: process.env.VITE_BUGSNAG_KEY
? {
disabled: false,
publishRelease: true,
baseUrl: process.env.VITE_BASE_URL,
config: {
releaseStage: process.env.VITE_ENV,
notifyReleaseStages: ['staging', 'mainnet'],
appVersion: process.env.npm_package_version,
apiKey: process.env.VITE_BUGSNAG_KEY
}
}
: undefined,

sourcemap: {
server: false,
client: true
}
},

//@ts-ignore
bugsnag
})
16 changes: 3 additions & 13 deletions layer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,16 @@
"postinstall": "yarn add https://github.com/InjectiveLabs/shared-packages#master --ignore-scripts"
},
"dependencies": {
"qrcode-vue3": "^1.6.8",
"shared-packages": "https://github.com/InjectiveLabs/shared-packages#master"
},
"devDependencies": {
"@bangjelkoski/vite-plugin-node-polyfills": "^0.0.2",
"@nuxt/eslint-config": "^0.1.1",
"@pinia/nuxt": "^0.4.11",
"@types/fs-extra": "^11.0.1",
"eslint": "^8.28.0",
"git-clone": "^0.2.0",
"nuxt": "3.11.2",
"typescript": "^4.9.3",
"eslint": "8.37.0",
"nuxt": "3.13.2",
"typescript": "5.5.4",
"vite-tsconfig-paths": "^4.2.0"
},
"resolutions": {
"@nuxt/kit": "3.11.2",
"@nuxt/schema": "3.11.2"
},
"overrides": {
"@nuxt/kit": "3.11.2",
"@nuxt/schema": "3.11.2"
}
}
35 changes: 0 additions & 35 deletions layer/scripts/bugsnag.ts

This file was deleted.

3 changes: 2 additions & 1 deletion layer/store/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ export const useSharedWalletStore = defineStore('sharedWallet', {
})

await walletStore.onConnect()
} catch {
} catch (e: any) {
walletStore.wallet = initialStateFactory().wallet
walletStore.walletConnectStatus = WalletConnectStatus.idle
}
},
Expand Down
4 changes: 2 additions & 2 deletions layer/transformer/market/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
} from '@injectivelabs/sdk-ts'
import {
sharedToBalanceInWei,
sharedToBalanceInToken,
sharedGetTensMultiplier,
sharedGetExactDecimalsFromNumber,
sharedToBalanceInToken
sharedGetExactDecimalsFromNumber
} from '../../utils/formatter'
import { injToken } from '../../data/token'
import { spotMarketIdMap, spotDenomMap } from '../../data/spot'
Expand Down
16 changes: 5 additions & 11 deletions layer/utils/constant/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ export const env = {
VITE_SENTRY_HTTP_ENDPOINT: import.meta.env
.VITE_SENTRY_HTTP_ENDPOINT as string,
VITE_CACHE_REST_API_ENDPOINT: import.meta.env
.VITE_CACHE_REST_API_ENDPOINT as string,
VITE_WALLET_CONNECT_PROJECT_ID:
import.meta.env.VITE_WALLET_CONNECT_PROJECT_ID || ''
.VITE_CACHE_REST_API_ENDPOINT as string
}

export const IS_MAINNET_STAGING: boolean = env.VITE_ENV === 'staging'
Expand Down Expand Up @@ -112,10 +110,6 @@ export const MITO_API_ENDPOINT =
export const ALCHEMY_KEY = (import.meta.env.VITE_ALCHEMY_KEY || '') as string
export const COINGECKO_KEY = (import.meta.env.VITE_COINGECKO_KEY ||
'') as string
export const ALCHEMY_KOVAN_KEY = (import.meta.env.VITE_ALCHEMY_KOVAN_KEY ||
'') as string
export const ALCHEMY_GOERLI_KEY = (import.meta.env.VITE_ALCHEMY_GOERLI_KEY ||
'') as string
export const ALCHEMY_SEPOLIA_KEY = (import.meta.env.VITE_ALCHEMY_SEPOLIA_KEY ||
'') as string
export const SOL_ALCHEMY_KEY = (import.meta.env.VITE_SOL_ALCHEMY_KEY ||
Expand All @@ -125,8 +119,6 @@ export const FEE_PAYER_PUB_KEY = (import.meta.env.VITE_FEE_PAYER_PUB_KEY ||
'') as string

// plugins/tracking.ts
export const AMPLITUDE_KEY_PROD = import.meta.env
.VITE_AMPLITUDE_KEY_PROD as string
export const GOOGLE_ANALYTICS_KEY = import.meta.env
.VITE_GOOGLE_ANALYTICS_KEY as string
export const PROXY_DETECTION_API_KEY =
Expand All @@ -138,14 +130,16 @@ export const GOOGLE_MAPS_KEY = import.meta.env.VITE_GOOGLE_MAPS_KEY || ''

export const VPN_CHECKS_ENABLED: boolean =
import.meta.env.VITE_VPN_CHECKS_ENABLED === 'true'
export const MAINTENANCE_ENABLED =
import.meta.env.VITE_MAINTENANCE_ENABLED === 'true'
export const GEO_IP_RESTRICTIONS_ENABLED: boolean =
import.meta.env.VITE_GEO_IP_RESTRICTIONS_ENABLED === 'true'

export const CW20_ADAPTER_CONTRACT = getCw20AdapterContractForNetwork(NETWORK)
export const APP_NAME = env.VITE_NAME as string
export const APP_BASE_URL = env.VITE_BASE_URL as string
export const WALLET_CONNECT_PROJECT_ID =
env.VITE_WALLET_CONNECT_PROJECT_ID as string
export const WALLET_CONNECT_PROJECT_ID = import.meta.env
.VITE_WALLET_CONNECT_PROJECT_ID as string

if (VPN_CHECKS_ENABLED && !GOOGLE_MAPS_KEY) {
throw new Error('GOOGLE_MAPS_KEY is required when VPN_CHECKS_ENABLED')
Expand Down
8 changes: 4 additions & 4 deletions layer/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export * from './ci'
export * from './async'
export * from './formatter'
export * from './ibc'
export * from './input'
export * from './logs'
export * from './time'
export * from './async'
export * from './input'
export * from './market'
export * from './network'
export * from './scripts'
export * from './time'
export * from './formatter'
8 changes: 3 additions & 5 deletions layer/wallet/alchemy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ import {
IS_DEVNET,
IS_TESTNET,
ALCHEMY_KEY,
ALCHEMY_KOVAN_KEY,
ALCHEMY_SEPOLIA_KEY,
ALCHEMY_GOERLI_KEY
ALCHEMY_SEPOLIA_KEY
} from './../utils/constant'

export const getRpcUrlsForChainIds = (): Record<EthereumChainId, string> => {
return {
[EthereumChainId.Ganache]: 'http://localhost:8545',
[EthereumChainId.HardHat]: 'http://localhost:8545',
[EthereumChainId.Goerli]: `https://eth-goerli.alchemyapi.io/v2/${ALCHEMY_GOERLI_KEY}`,
[EthereumChainId.Goerli]: '',
[EthereumChainId.Sepolia]: `https://eth-sepolia.alchemyapi.io/v2/${ALCHEMY_SEPOLIA_KEY}`,
[EthereumChainId.Kovan]: `https://eth-kovan.alchemyapi.io/v2/${ALCHEMY_KOVAN_KEY}`,
[EthereumChainId.Kovan]: '',
[EthereumChainId.Mainnet]: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}`,
[EthereumChainId.Injective]: '',
[EthereumChainId.Rinkeby]: '',
Expand Down
Loading

0 comments on commit b13d565

Please sign in to comment.