Skip to content

Commit 07fdae2

Browse files
committed
remove unnecessary helpers
1 parent 21b3ea7 commit 07fdae2

5 files changed

Lines changed: 7 additions & 31 deletions

File tree

src/Sample.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
} from '@mui/material'
44
import { assertEx } from '@xylabs/assert'
55
import { type Hash, isHash } from '@xylabs/hex'
6-
import { isDefined } from '@xylabs/typeof'
6+
import { isDefined, isUndefined } from '@xylabs/typeof'
77
import type { Id } from '@xyo-network/id-payload-plugin'
88
import { PayloadBuilder } from '@xyo-network/payload-builder'
99
import { type HashPayload } from '@xyo-network/xl1-protocol'
@@ -12,7 +12,6 @@ import { useState } from 'react'
1212
import {
1313
RunProducerAlerts, TxConfirmedAlert, WalletAlerts,
1414
} from './components/index.ts'
15-
import { hasXyoWalletInjectable } from './hasXyoWalletInjectable.ts'
1615
import { useDefaultGateway, useOnBoarding } from './hooks/index.ts'
1716
// eslint-disable-next-line import-x/no-internal-modules
1817
import Xl13DLogo from './images/XL1_3D_Token_Mainnet.svg'
@@ -79,7 +78,7 @@ export const XL1BrowserSample = () => {
7978
{showSubmitTransaction === true && (
8079
<Stack alignItems="start">
8180
{/* {gatewayError ? <Alert severity="error">{gatewayError.message}</Alert> : null} */}
82-
<Button variant="contained" onClick={() => void submitTransaction()} disabled={!hasXyoWalletInjectable()}>Submit Transaction</Button>
81+
<Button variant="contained" onClick={() => void submitTransaction()} disabled={isUndefined(gateway)}>Submit Transaction</Button>
8382
</Stack>
8483
)}
8584
{isDefined(confirmed) && <TxConfirmedAlert hash={confirmed} />}

src/hasXyoWalletInjectable.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/hooks/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
export * from './useCheckWalletInstalled.ts'
21
export * from './useDefaultGateway.ts'
32
export * from './useOnBoarding.ts'

src/hooks/useCheckWalletInstalled.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/hooks/useOnBoarding.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { useCheckLocalRpc } from '@xyo-network/react-chain-provider'
22

3-
import { useCheckWalletInstalled } from './useCheckWalletInstalled.ts'
3+
import { useDefaultGateway } from './useDefaultGateway.ts'
4+
import { isDefined, isUndefined } from '@xylabs/typeof'
45

56
export const useOnBoarding = () => {
6-
const walletInstalled = useCheckWalletInstalled()
7+
const { gateway } = useDefaultGateway()
78
const { isLocalProducer } = useCheckLocalRpc()
89

910
const producerIsReachable = isLocalProducer
10-
const walletIsInstalled = producerIsReachable && walletInstalled
11-
const walletIsNotInstalled = producerIsReachable ? !walletInstalled : undefined
11+
const walletIsInstalled = producerIsReachable && isDefined(gateway)
12+
const walletIsNotInstalled = producerIsReachable ? isUndefined(gateway) : undefined
1213
const showSubmitTransaction = producerIsReachable && walletIsInstalled
1314

1415
return {

0 commit comments

Comments
 (0)