Skip to content

Commit

Permalink
Merge pull request #272 from skalenetwork/develop
Browse files Browse the repository at this point in the history
Metaport 2.3 Beta
  • Loading branch information
dmytrotkk authored Aug 14, 2024
2 parents b36d6fa + afc1564 commit dccbe24
Show file tree
Hide file tree
Showing 27 changed files with 381 additions and 162 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: '18.x'
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Prepare metadata
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [18]
node: [20]
env:
TEST: true
steps:
Expand Down
Binary file modified bun.lockb
Binary file not shown.
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@skalenetwork/metaport",
"version": "2.1.1",
"version": "3.0.0",
"description": "SKALE Metaport Widget",
"keywords": [
"skale",
Expand All @@ -21,7 +21,7 @@
"./dist/style.css": "./dist/style.css"
},
"engines": {
"node": "18"
"node": "20"
},
"scripts": {
"dev": "storybook dev -p 6006",
Expand Down Expand Up @@ -75,17 +75,18 @@
"vitest": "0.34.1"
},
"dependencies": {
"@mui/material": "^5.15.6",
"@mui/lab": "^5.0.0-alpha.162",
"@mui/icons-material": "^5.15.6",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@rainbow-me/rainbowkit": "^1.3.6",
"@mui/icons-material": "^5.15.6",
"@mui/lab": "^5.0.0-alpha.162",
"@mui/material": "^5.15.6",
"@rainbow-me/rainbowkit": "^2.1.4",
"@skalenetwork/ima-js": "2.0.2-develop.0",
"@tanstack/react-query": "^5.51.23",
"coingecko-api-v3": "^0.0.29",
"react-jazzicon": "^1.0.4",
"viem": "^1.21.4",
"wagmi": "^1.4.13",
"viem": "2.x",
"wagmi": "^2.12.5",
"zustand": "^4.5.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion skale-network
Submodule skale-network updated 86 files
+105 −0 .github/ISSUE_TEMPLATE/app_submission.yml
+ assets/app-template.png
+45 −45 metadata/legacy/chains.json
+ metadata/legacy/logos/adorable-quaint-bellatrix-cardex.png
+ metadata/legacy/logos/adorable-quaint-bellatrix-lumberworld.png
+ metadata/legacy/logos/adorable-quaint-bellatrix-otter-heaven.png
+ metadata/legacy/logos/adorable-quaint-bellatrix-zombie-x.png
+ metadata/legacy/logos/spanish-smug-auva-swamp-collection.png
+ metadata/legacy/logos/these-long-sadalsuud-swapchange.png
+851 −44 metadata/mainnet/chains.json
+5 −0 metadata/mainnet/icons/elated-tan-skat-aquas-trade.svg
+24 −0 metadata/mainnet/icons/elated-tan-skat-coinsender.svg
+34 −0 metadata/mainnet/icons/elated-tan-skat-earnscape.svg
+0 −0 metadata/mainnet/icons/elated-tan-skat-ruby-exchange.svg
+56 −0 metadata/mainnet/icons/elated-tan-skat-sushiswap.svg
+35 −0 metadata/mainnet/icons/green-giddy-denebola-arena-games-platform.svg
+5 −0 metadata/mainnet/icons/green-giddy-denebola-ballers-city.svg
+13 −25 metadata/mainnet/icons/green-giddy-denebola.svg
+0 −0 metadata/mainnet/icons/honorable-steel-rasalhague-clet-name-service.svg
+14 −0 metadata/mainnet/icons/parallel-stormy-spica.svg
+ metadata/mainnet/logos/elated-tan-skat-aquas-trade.png
+ metadata/mainnet/logos/elated-tan-skat-coinsender.png
+ metadata/mainnet/logos/elated-tan-skat-earnscape.png
+ metadata/mainnet/logos/elated-tan-skat-ruby-exchange.png
+ metadata/mainnet/logos/elated-tan-skat-sushiswap.png
+ metadata/mainnet/logos/green-giddy-denebola-arena-games-platform.png
+ metadata/mainnet/logos/green-giddy-denebola-ballers-city.png
+ metadata/mainnet/logos/green-giddy-denebola-bit-hotel.png
+ metadata/mainnet/logos/green-giddy-denebola-booja-world.png
+ metadata/mainnet/logos/green-giddy-denebola-chainguardians.png
+ metadata/mainnet/logos/green-giddy-denebola-cryptocrusades.png
+ metadata/mainnet/logos/green-giddy-denebola-dexgo.png
+ metadata/mainnet/logos/green-giddy-denebola-earnscape.png
+ metadata/mainnet/logos/green-giddy-denebola-fivetars.png
+ metadata/mainnet/logos/green-giddy-denebola-floki-cyber-punk.png
+ metadata/mainnet/logos/green-giddy-denebola-gamifly.png
+ metadata/mainnet/logos/green-giddy-denebola-hangry-animals.png
+ metadata/mainnet/logos/green-giddy-denebola-hatchyverse.png
+16 −0 metadata/mainnet/logos/green-giddy-denebola-haven-s-compass.svg
+ metadata/mainnet/logos/green-giddy-denebola-heroes-battle-arena.png
+ metadata/mainnet/logos/green-giddy-denebola-hurley-super-surfer.png
+ metadata/mainnet/logos/green-giddy-denebola-interverse.png
+34 −0 metadata/mainnet/logos/green-giddy-denebola-jump-trade.svg
+ metadata/mainnet/logos/green-giddy-denebola-katana-inu.png
+ metadata/mainnet/logos/green-giddy-denebola-metasoccer.png
+ metadata/mainnet/logos/green-giddy-denebola-motodex.png
+41 −0 metadata/mainnet/logos/green-giddy-denebola-mystrios.svg
+9 −0 metadata/mainnet/logos/green-giddy-denebola-nftb.svg
+ metadata/mainnet/logos/green-giddy-denebola-nftmining.png
+ metadata/mainnet/logos/green-giddy-denebola-playbits-by-playground.png
+ metadata/mainnet/logos/green-giddy-denebola-rise-online-world.png
+ metadata/mainnet/logos/green-giddy-denebola-roco-finance.png
+ metadata/mainnet/logos/green-giddy-denebola-space-rush-odyssey.png
+ metadata/mainnet/logos/green-giddy-denebola-spells-of-genesis.png
+ metadata/mainnet/logos/green-giddy-denebola-sportzchain.png
+ metadata/mainnet/logos/green-giddy-denebola-starzplay-fantasy-sports.png
+ metadata/mainnet/logos/green-giddy-denebola-wareden.png
+ metadata/mainnet/logos/green-giddy-denebola-world-of-dypians.png
+ metadata/mainnet/logos/green-giddy-denebola-yomi-games.png
+ metadata/mainnet/logos/green-giddy-denebola-zeus.png
+ metadata/mainnet/logos/honorable-steel-rasalhague-clet-name-service.png
+ metadata/mainnet/logos/honorable-steel-rasalhague-dmail.png
+ metadata/mainnet/logos/honorable-steel-rasalhague-dripverse.png
+ metadata/mainnet/logos/honorable-steel-rasalhague-hitmakr.png
+ metadata/mainnet/logos/honorable-steel-rasalhague-hurley.png
+1 −0 metadata/mainnet/logos/honorable-steel-rasalhague-kredeum-nfts-factory.svg
+ metadata/mainnet/logos/honorable-steel-rasalhague-pixudi.png
+3 −0 metadata/mainnet/logos/honorable-steel-rasalhague-sirkl.svg
+ metadata/mainnet/logos/honorable-steel-rasalhague-solo.png
+ metadata/mainnet/logos/honorable-steel-rasalhague-tank-wars-zone.png
+ metadata/mainnet/logos/honorable-steel-rasalhague-virtualness.png
+ metadata/mainnet/logos/parallel-stormy-spica-chaingpt.png
+ metadata/mainnet/logos/parallel-stormy-spica-palm-ai.png
+1 −1 metadata/staging/chains.json
+125 −18 metadata/testnet/chains.json
+ metadata/testnet/logos/aware-fake-trim-testnet-chaingpt.png
+ metadata/testnet/logos/giant-half-dual-testnet-dmail.png
+ metadata/testnet/logos/giant-half-dual-testnet-dripverse.png
+ metadata/testnet/logos/lanky-ill-funny-testnet-cryptopia.png
+ metadata/testnet/logos/lanky-ill-funny-testnet-metasoccer.png
+ metadata/testnet/logos/lanky-ill-funny-testnet-playbits-by-playground.png
+ metadata/testnet/logos/lanky-ill-funny-testnet-wareden.png
+17,429 −0 releases/mainnet/skale-manager/1.11.0/skale-manager-1.11.0-mainnet-abi.json
+27 −0 releases/mainnet/skale-manager/1.11.0/skale-manager-1.11.0-mainnet-contracts.json
+14,090 −0 releases/staging/skale-manager/1.11.0/manifest.json
+15,525 −0 releases/staging/skale-manager/1.11.0/skale-manager-1.11.0-beta.0-custom-abi.json
6 changes: 3 additions & 3 deletions src/components/AddToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

import { useState } from 'react'
import { useWalletClient, useSwitchNetwork } from 'wagmi'
import { useWalletClient, useSwitchChain } from 'wagmi'
import { MainnetChain, SChain } from '@skalenetwork/ima-js'

import Button from '@mui/material/Button'
Expand All @@ -43,7 +43,7 @@ export default function AddToken(props: {
const [loading, setLoading] = useState<boolean>(false)

const { data: walletClient } = useWalletClient()
const { switchNetworkAsync } = useSwitchNetwork()
const { switchChainAsync } = useSwitchChain()

function getIconUrl(token: TokenData) {
return `${ICONS_BASE_URL}${token.meta.symbol}.png`
Expand Down Expand Up @@ -73,7 +73,7 @@ export default function AddToken(props: {
await enforceNetwork(
chainId,
walletClient,
switchNetworkAsync,
switchChainAsync,
props.mpc.config.skaleNetwork,
props.destChainName
)
Expand Down
98 changes: 98 additions & 0 deletions src/components/ChainAppBtn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/**
* @license
* SKALE Metaport
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

/**
* @file ChainAppBtn.ts
* @copyright SKALE Labs 2024-Present
*/

import { Button } from '@mui/material'
import KeyboardArrowRightRoundedIcon from '@mui/icons-material/KeyboardArrowRightRounded'

import { cls, cmn, styles } from '../core/css'
import { SkaleNetwork } from '../core/interfaces'
import { getChainAlias } from '../core/metadata'

import ChainIcon from './ChainIcon'

export default function ChainAppBtn(props: {
skaleNetwork: SkaleNetwork
appName: string
chainName: string
handle?: (schainName: string, app?: string) => void
size?: 'sm' | 'md'
prim?: boolean
}) {
const size = props.size ?? 'sm'
const iconSize = props.size === 'sm' ? 'xs' : 'sm'
const prim = props.prim ?? size === 'md'

return (
<Button
key={props.appName}
onClick={() => props.handle(props.chainName, props.appName)}
size="small"
color="inherit"
className={cls([cmn.mleft10, size === 'sm'], [cmn.mleft20, size === 'md'], cmn.mbott5)}
>
<div
className={cls(
cmn.flex,
cmn.flexcv,
cmn.mri5,
[cmn.mleft5, size === 'sm'],
[cmn.mleft10, size === 'md'],
[cmn.mbott5, size === 'sm'],
[cmn.mtop5, size === 'sm'],
[cmn.mbott10, size === 'md'],
[cmn.mtop10, size === 'md']
)}
>
<ChainIcon
className={cls(cmn.mleft20d)}
skaleNetwork={props.skaleNetwork}
chainName={props.chainName}
app={props.appName}
size={iconSize}
/>
<p
className={cls(
cmn.p,
[cmn.p3, size === 'md'],
[cmn.p4, size === 'sm'],
[cmn.pSec, !prim],
[cmn.pPrim, prim],
cmn.p600,
cmn.mleft10
)}
>
{getChainAlias(props.skaleNetwork, props.chainName, props.appName)}
</p>
<div className={cls(cmn.flex, cmn.flexg)}></div>
<KeyboardArrowRightRoundedIcon
className={cls(
cmn.pSec,
[styles.chainIconxs, size === 'sm'],
[styles.chainIcons, size === 'md'],
[cmn.mleft5, size === 'md']
)}
/>
</div>
</Button>
)
}
103 changes: 73 additions & 30 deletions src/components/ChainApps.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
/**
* @license
* SKALE Metaport
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

/**
* @file ChainApps.ts
* @copyright SKALE Labs 2024-Present
*/

import { ReactElement, useState } from 'react'
import { Button } from '@mui/material'
import KeyboardArrowRightRoundedIcon from '@mui/icons-material/KeyboardArrowRightRounded'
import AddCircleRoundedIcon from '@mui/icons-material/AddCircleRounded'
import RemoveCircleRoundedIcon from '@mui/icons-material/RemoveCircleRounded'

import { cls, cmn, styles } from '../core/css'
import { SkaleNetwork } from '../core/interfaces'
import { getChainAppsMeta, getChainAlias } from '../core/metadata'
import { getChainAppsMeta } from '../core/metadata'

import ChainAppBtn from './ChainAppBtn'

import ChainIcon from './ChainIcon'
import { sortObjectByKeys } from '../core/helper'

export default function ChainApps(props: {
skaleNetwork: SkaleNetwork
Expand All @@ -14,30 +41,45 @@ export default function ChainApps(props: {
size?: 'sm' | 'md'
prim?: boolean
}) {
const [show, setShow] = useState<boolean>(false)

const apps = getChainAppsMeta(props.chainName, props.skaleNetwork)
if (!apps || !Object.keys(apps) || Object.keys(apps).length === 0) return <div></div>

const size = props.size ?? 'sm'
const iconSize = props.size === 'sm' ? 'xs' : 'sm'

const prim = props.prim ?? size === 'md'
const appButtons: ReactElement[] = []

for (const appName in sortObjectByKeys(apps)) {
appButtons.push(
<ChainAppBtn
skaleNetwork={props.skaleNetwork}
chainName={props.chainName}
appName={appName}
handle={props.handle}
size={size}
prim={props.prim}
/>
)
}

return (
<div className={cls(styles.sk__chainApps, cmn.mri10, cmn.flex, cmn.flexcv)}>
<div className={cls(cmn.mtop10, cmn.mbott10)}>
{Object.keys(apps).map((key, _) => (
{show ? appButtons : appButtons.length === 4 ? appButtons : appButtons.slice(0, 3)}
{appButtons.length > 4 && (
<Button
key={key}
onClick={() => props.handle(props.chainName, key)}
onClick={() => {
setShow(!show)
}}
size="small"
color="inherit"
className={cls([cmn.mleft10, size === 'sm'], [cmn.mleft20, size === 'md'], cmn.mbott5)}
>
<div
className={cls(
cmn.flex,
cmn.flexcv,
cmn.mri5,
cmn.mri10,
[cmn.mleft5, size === 'sm'],
[cmn.mleft10, size === 'md'],
[cmn.mbott5, size === 'sm'],
Expand All @@ -46,38 +88,39 @@ export default function ChainApps(props: {
[cmn.mtop10, size === 'md']
)}
>
<ChainIcon
className={cls(cmn.mleft20d)}
skaleNetwork={props.skaleNetwork}
chainName={props.chainName}
app={key}
size={iconSize}
/>
{show ? (
<RemoveCircleRoundedIcon
className={cls(
cmn.pPrim,
[styles.chainIconxs, size === 'sm'],
[styles.chainIconsm, size === 'md']
)}
/>
) : (
<AddCircleRoundedIcon
className={cls(
cmn.pPrim,
[styles.chainIconxs, size === 'sm'],
[styles.chainIconsm, size === 'md']
)}
/>
)}

<p
className={cls(
cmn.p,
[cmn.p3, size === 'md'],
[cmn.p4, size === 'sm'],
[cmn.pSec, !prim],
[cmn.pPrim, prim],
cmn.pPrim,
cmn.p600,
cmn.mleft10
)}
>
{getChainAlias(props.skaleNetwork, props.chainName, key)}
Show {show ? 'less' : 'more'} apps
</p>
<div className={cls(cmn.flex, cmn.flexg)}></div>
<KeyboardArrowRightRoundedIcon
className={cls(
[cmn.pSec, !prim],
[cmn.pPrim, prim],
[styles.chainIconxs, size === 'sm'],
[styles.chainIcons, size === 'md']
)}
/>
</div>
</Button>
))}
)}
</div>
</div>
)
Expand Down
8 changes: 4 additions & 4 deletions src/components/CommunityPool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import React, { useEffect } from 'react'

import { useAccount, useWalletClient, useSwitchNetwork } from 'wagmi'
import { useAccount, useWalletClient, useSwitchChain } from 'wagmi'

import Accordion from '@mui/material/Accordion'
import AccordionSummary from '@mui/material/AccordionSummary'
Expand Down Expand Up @@ -57,7 +57,7 @@ import { Collapse } from '@mui/material'

export default function CommunityPool() {
const { data: walletClient } = useWalletClient()
const { switchNetworkAsync } = useSwitchNetwork()
const { switchChainAsync } = useSwitchChain()

const cpData = useCPStore((state) => state.cpData)
const loading = useCPStore((state) => state.loading)
Expand Down Expand Up @@ -144,7 +144,7 @@ export default function CommunityPool() {
chainName,
cpData.balance,
address,
switchNetworkAsync,
switchChainAsync,
setLoading,
setErrorMessage,
async () => {
Expand All @@ -161,7 +161,7 @@ export default function CommunityPool() {
chainName,
amount,
address,
switchNetworkAsync,
switchChainAsync,
setLoading,
setErrorMessage,
async () => {
Expand Down
Loading

0 comments on commit dccbe24

Please sign in to comment.