Skip to content

Commit

Permalink
Merge branch 'master' into refactor/wallet-ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasRalee committed Feb 18, 2025
2 parents 9e9f503 + 29a937d commit 2f677d8
Show file tree
Hide file tree
Showing 15 changed files with 1,310 additions and 1,181 deletions.
25 changes: 25 additions & 0 deletions layer/components/Logo/White.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script lang="ts" setup>
const uuid = `${Math.random()}`
</script>

<template>
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask
:id="`mask-logo-white-${uuid}`"
style="mask-type: luminance"
maskUnits="userSpaceOnUse"
x="0"
y="0"
width="16"
height="16"
>
<path d="M16 0H0V16H16V0Z" fill="white" />
</mask>
<g :mask="`url(#mask-logo-white-${uuid})`">
<path
d="M9.68 0.192017L9.632 0.288016C11.296 1.00802 12.24 2.49602 12.24 4.12802C12.24 5.88802 11.088 7.48802 8.848 8.84802L8.48 9.07202C6.8 10.096 5.952 11.248 5.952 12.64C5.952 14.432 7.36 15.744 9.296 15.744C12.4 15.744 16 12.432 16 8.01602C16 7.29602 15.904 6.59202 15.728 5.92002L15.616 5.95202C15.664 6.32002 15.68 6.59202 15.68 6.84802C15.68 9.45602 14.208 11.696 11.744 13.184L11.504 13.328C10.976 13.632 10.528 13.808 10.08 13.808C9.488 13.808 9.04 13.424 9.04 12.864C9.04 12.384 9.36 11.904 10.4 11.296L10.704 11.12C13.008 9.77602 14.288 7.88802 14.288 5.79202C14.288 3.13602 12.304 0.944017 9.68 0.192017ZM6.32 15.824L6.368 15.728C4.704 15.008 3.76 13.52 3.76 11.888C3.76 10.128 4.912 8.52802 7.152 7.16802L7.52 6.94402C9.2 5.92002 10.048 4.76802 10.048 3.37602C10.048 1.58402 8.64 0.272016 6.704 0.272016C3.6 0.272016 0 3.58402 0 8.00002C0 8.72002 0.0960004 9.42402 0.272 10.096L0.384 10.064C0.336 9.69602 0.32 9.42402 0.32 9.16802C0.32 6.56002 1.792 4.32002 4.256 2.83202L4.496 2.68802C5.024 2.38402 5.472 2.20802 5.92 2.20802C6.512 2.20802 6.96 2.59202 6.96 3.15202C6.96 3.63202 6.64 4.11202 5.6 4.72002L5.296 4.89602C2.992 6.24002 1.712 8.12802 1.712 10.224C1.712 12.88 3.696 15.072 6.32 15.824Z"
fill="#fff"
/>
</g>
</svg>
</template>
4 changes: 0 additions & 4 deletions layer/components/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ watch(
(value) => {
if (value) {
emit('on:open')
return
}
emit('on:close')
}
)
</script>
Expand Down
34 changes: 17 additions & 17 deletions layer/components/Notification.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script lang="ts" setup>
import type { PropType } from "vue";
import { type Notification, NotificationType } from "./../types";
import type { PropType } from 'vue'
import { type Notification, NotificationType } from './../types'
const notificationStore = useSharedNotificationStore();
const { copy } = useClipboard();
const notificationStore = useSharedNotificationStore()
const { copy } = useClipboard()
const props = defineProps({
notification: {
Expand All @@ -13,38 +13,38 @@ const props = defineProps({
wrapperClass: {
type: String,
default: "bg-gray-800"
default: 'bg-gray-800'
},
contentClass: {
type: String,
default: "text-white"
default: 'text-white'
}
});
})
const timeout = ref();
const remainingTimeout = ref(6000);
const timeout = ref()
const remainingTimeout = ref(6000)
onMounted(
() => (timeout.value = setTimeout(onClose, props.notification.timeout))
);
)
function onCopy() {
copy(props.notification.context);
copy(props.notification.context)
}
function onClose() {
notificationStore.clear(props.notification.id);
clearTimeout(timeout.value);
notificationStore.clear(props.notification.id)
clearTimeout(timeout.value)
}
function onPause() {
clearTimeout(timeout.value);
remainingTimeout.value -= Date.now() - props.notification.id;
clearTimeout(timeout.value)
remainingTimeout.value -= Date.now() - props.notification.id
}
function onResume() {
timeout.value = setTimeout(onClose, remainingTimeout.value);
timeout.value = setTimeout(onClose, remainingTimeout.value)
}
</script>

Expand Down Expand Up @@ -109,8 +109,8 @@ function onResume() {
<UPopover v-if="notification.context" mode="hover">
<template #default>
<button
@click="onCopy"
class="text-xs text-gray-400 flex items-center ui-notification-context"
@click="onCopy"
>
Show more context
</button>
Expand Down
2 changes: 1 addition & 1 deletion layer/components/QRCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ withDefaults(
type: 'radial',
rotation: 0,
colorStops: [
{ offset: 0.5, color: '#007CF6' },
{ offset: 0.5, color: '#7C70FF' },
{ offset: 1, color: '#5208c7' }
]
}
Expand Down
6 changes: 1 addition & 5 deletions layer/data/derivative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@ export const derivativeMarketIdMap: Record<
string,
{ slug: string; ticker: string }
> = {
'0x2236b4cd97300c79fca5c2fff4b647ab24a6d48c1554255ff8ec7cf29429ba74': {
// SPY/USDT
slug: 'tradfi-usdt-perp',
ticker: 'TRADFI/USDT PERP'
}
//
}
3 changes: 2 additions & 1 deletion layer/data/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,6 @@ export const msgTypeMap = {
[MsgType.MsgExecuteContractCompat]: 'Execute Contract',
[MsgType.MsgRelayProviderPrices]: 'Relay Provider Prices',
[MsgType.MsgMultiSend]: 'Multi Send',
[MsgType.MsgPrivilegedExecuteContract]: 'Execute Contract'
[MsgType.MsgPrivilegedExecuteContract]: 'Execute Contract',
'injective.oracle.v1beta1.MsgRelayStorkPrices': 'Relay Stork Prices'
} as Record<string | MsgType, string>
2 changes: 1 addition & 1 deletion layer/data/token.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion layer/nuxt-config/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ export default defineConfig({
'@injectivelabs/sdk-ts',
'qr-code-generator-vue3',
'class-variance-authority',
'@injectivelabs/wallet-ts',
'@injectivelabs/wallet-evm',
'@injectivelabs/wallet-base',
'@injectivelabs/wallet-core',
'@injectivelabs/wallet-ledger',
'@injectivelabs/wallet-cosmos',
'@injectivelabs/wallet-strategy',
'@injectivelabs/wallet-cosmostation',
'@injectivelabs/wallet-cosmos-strategy',
...(isLocalLayer ? [] : additionalDeps)
],
Expand Down
4 changes: 4 additions & 0 deletions layer/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export default defineNuxtConfig({

components: [{ path: resolve('./components'), prefix: 'Shared' }],

pinia: {
autoImports: ['defineStore']
},

modules: [
'@pinia/nuxt',
'@vueuse/nuxt',
Expand Down
4 changes: 0 additions & 4 deletions layer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@
},
"dependencies": {
"@nuxt/ui": "^2.18.7",
"@nuxtjs/i18n": "8.5.5",
"@vueuse/nuxt": "12.3.0",
"shared-packages": "https://github.com/InjectiveLabs/shared-packages#refactor/wallet-ts"
},
"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",
"@types/node": "^20.4.9",
"eslint": "8.37.0",
"lint-staged": "13.2.3",
"nuxt": "3.13.2",
"typescript": "5.5.4",
"vite-tsconfig-paths": "^4.2.0"
},
Expand Down
31 changes: 31 additions & 0 deletions layer/store/json.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { defineStore } from 'pinia'
import { HttpClient } from '@injectivelabs/utils'
import { IS_MAINNET } from '../utils/constant'

const CLOUD_FRONT_URL = 'https://d36789lqgasyke.cloudfront.net'

const client = new HttpClient(CLOUD_FRONT_URL, {
headers: {}
})

export type JsonStoreState = { tokens: any[] }

export const useSharedJsonStore = defineStore('sharedJson', {
state: (): JsonStoreState => ({
tokens: []
}),

actions: {
async fetchTokenJson() {
const sharedJsonStore = useSharedJsonStore()

if (!IS_MAINNET) {
return
}

sharedJsonStore.$patch({
tokens: await client.get('json/tokens/mainnet.json')
})
}
}
})
21 changes: 17 additions & 4 deletions layer/transformer/explorer/messageSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,27 @@ const exchangeMsgSummaryMap: Partial<
spot_orders_to_cancel: spotOrdersToCancel,
spot_orders_to_create: spotOrdersToCreate,
derivative_orders_to_cancel: derivativeOrdersToCancel,
derivative_orders_to_create: derivativeOrdersToCreate
derivative_orders_to_create: derivativeOrdersToCreate,
spot_market_ids_to_cancel_all: spotMarketIdsToCancelAll,
derivative_market_ids_to_cancel_all: derivativeMarketIdsToCancelAll
} = value.message as Record<string, any>

// Not Used:
// binary_options_orders_to_cancel
// binary_options_market_ids_to_cancel_all
// binary_options_orders_to_create

// derivative_market_ids_to_cancel_all
// spot_market_ids_to_cancel_all
const cancelAllSpotMarketIds = spotMarketIdsToCancelAll.map(
(marketId: string) => {
return `{{account:${sender}}} cancelled all orders in {{market:${marketId}}}`
}
)

const cancelAllDerivativeMarketIds = derivativeMarketIdsToCancelAll.map(
(marketId: string) => {
return `{{account:${sender}}} cancelled all orders in {{market:${marketId}}}`
}
)

const derivativeOrders = derivativeOrdersToCreate.map((order: any) => {
const { quantity, price } = order.order_info
Expand Down Expand Up @@ -279,7 +290,9 @@ const exchangeMsgSummaryMap: Partial<
...derivativeOrders,
...spotOrders,
...spotCancelOrders,
...derivativeCancelOrders
...derivativeCancelOrders,
...cancelAllSpotMarketIds,
...cancelAllDerivativeMarketIds
]
},

Expand Down
3 changes: 2 additions & 1 deletion layer/types/enum/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ export enum NuxtUiIcons {
Wallet2 = 'bxs:wallet',
WarningOutline = 'fluent:warning-32-regular',
WaterDrop = 'bi:droplet',
TwitterX = 'ri:twitter-x-line'
TwitterX = 'ri:twitter-x-line',
FullScreen = 'tdesign:fullscreen'
}

export enum UIBreakpoints {
Expand Down
2 changes: 1 addition & 1 deletion layer/utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const getHubUrl = (): string => {
return 'https://testnet.hub.injective.network'
}

return 'https://hub.injective.network'
return 'https://injhub.com'
}

export const getMitoUrl = (): string => {
Expand Down
Loading

0 comments on commit 2f677d8

Please sign in to comment.