Skip to content

Commit

Permalink
feat(index): next version (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsleydon authored Oct 9, 2023
1 parent 205824a commit 140bba6
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 270 deletions.
39 changes: 21 additions & 18 deletions apps/index/hooks/useDeposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const useDeposit = (): (({
chainInstance instanceof SubstrateChain &&
polkadotAccount?.wallet != null
) {
await chainInstance.isReady
const deposit = await chainInstance.getDeposit(
fromAsset.location,
amount,
Expand All @@ -82,24 +83,26 @@ const useDeposit = (): (({
)
const waitFinalized = async (): Promise<void> => {
await new Promise((resolve, reject) => {
void deposit.tx.signAndSend(
polkadotAccount.address,
{
signer: polkadotAccount.wallet?.signer,
},
({txHash, status}) => {
if (status.isReady) {
onSubmitted?.()
setCurrentTask({
id: deposit.id,
fromChainId: fromChain.name,
hash: txHash.toHex(),
})
} else if (status.isInBlock) {
resolve(undefined)
}
},
)
void deposit.tx
.signAndSend(
polkadotAccount.address,
{
signer: polkadotAccount.wallet?.signer,
},
({txHash, status}) => {
if (status.isReady) {
onSubmitted?.()
setCurrentTask({
id: deposit.id,
fromChainId: fromChain.name,
hash: txHash.toHex(),
})
} else if (status.isInBlock) {
resolve(undefined)
}
},
)
.catch(reject)
})
}

Expand Down
28 changes: 14 additions & 14 deletions apps/index/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@metamask/detect-provider": "^2.0.0",
"@mui/icons-material": "^5.14.9",
"@mui/lab": "5.0.0-alpha.145",
"@mui/material": "^5.14.10",
"@next/bundle-analyzer": "^13.5.3",
"@mui/icons-material": "^5.14.12",
"@mui/lab": "5.0.0-alpha.147",
"@mui/material": "^5.14.12",
"@next/bundle-analyzer": "^13.5.4",
"@phala/index": "^1.0.34",
"@phala/lib": "workspace:^",
"@phala/store": "workspace:^",
Expand All @@ -30,27 +30,27 @@
"@talismn/connect-wallets": "^1.2.3",
"decimal.js": "^10.4.3",
"ethers": "^6.7.1",
"jotai": "^2.4.2",
"jotai-devtools": "^0.6.2",
"jotai": "^2.4.3",
"jotai-devtools": "^0.6.3",
"lodash-es": "^4.17.21",
"next": "13.5.3",
"next": "^13.5.4",
"next-images": "^1.8.5",
"notistack": "^3.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"swr": "^2.2.2"
"swr": "2.2.2"
},
"devDependencies": {
"@phala/eslint-config": "workspace:^",
"@svgr/webpack": "^7.0.0",
"@swc-jotai/debug-label": "^0.1.0",
"@swc-jotai/react-refresh": "^0.1.0",
"@types/lodash-es": "^4.17.7",
"@types/node": "^18.16.0",
"@types/react": "^18.0.38",
"@types/react-dom": "^18.0.11",
"eslint": "^8.50.0",
"eslint-config-next": "^13.5.3",
"@types/lodash-es": "^4.17.9",
"@types/node": "^18.18.4",
"@types/react": "^18.2.25",
"@types/react-dom": "^18.2.11",
"eslint": "^8.51.0",
"eslint-config-next": "^13.5.4",
"typescript": "^5.2.2"
}
}
27 changes: 27 additions & 0 deletions apps/index/pages/next.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {clientAtom} from '@/store/core'
import {CircularProgress, Container, Stack} from '@mui/material'
import {useAtom} from 'jotai'
import type {NextPage} from 'next'
import dynamic from 'next/dynamic'

const PolkadotWalletDialog = dynamic(
async () => await import('@/components/PolkadotWalletDialog'),
{ssr: false},
)

const Home: NextPage = () => {
const [client] = useAtom(clientAtom)
return (
<Container sx={{pt: {sm: 9, md: 12}}}>
{client == null ? (
<Stack alignItems="center">
<CircularProgress />
</Stack>
) : null}

<PolkadotWalletDialog />
</Container>
)
}

export default Home
Loading

3 comments on commit 140bba6

@vercel
Copy link

@vercel vercel bot commented on 140bba6 Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

index – ./apps/index

phala-index.vercel.app
index-git-main-phala.vercel.app
index-phala.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 140bba6 Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

subbridge – ./apps/subbridge

subbridge-git-main-phala.vercel.app
subbridge-phala.vercel.app
subbridge.vercel.app
subbridge.io
www.subbridge.io

@vercel
Copy link

@vercel vercel bot commented on 140bba6 Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

analytics – ./apps/analytics

analytics-git-main-phala.vercel.app
analytics.phala.network
analytics-phala.vercel.app
analytics-plum.vercel.app

Please sign in to comment.