Skip to content

Commit

Permalink
fix: formating issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zoruka committed Nov 28, 2024
1 parent f101f79 commit 00eb58a
Show file tree
Hide file tree
Showing 4 changed files with 258 additions and 258 deletions.
134 changes: 67 additions & 67 deletions apps/laboratory/src/components/Bitcoin/BitcoinSendTransferTest.tsx
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
import { Box, Button, Input, InputGroup, InputLeftAddon, useToast } from '@chakra-ui/react'
import type { BitcoinConnector } from '@reown/appkit-adapter-bitcoin'
import { useAppKitAccount, useAppKitProvider } from '@reown/appkit/react'
import { useState } from 'react'

export function BitcoinSendTransferTest() {
const { walletProvider } = useAppKitProvider<BitcoinConnector>('bip122')
const { address } = useAppKitAccount()

const toast = useToast()
const [loading, setLoading] = useState(false)
const [recipient, setRecipient] = useState<string>(address || '')
const [amount, setAmount] = useState<string>('1500')

async function onSendTransfer() {
if (!walletProvider) {
toast({
title: 'No wallet provider',
status: 'error',
isClosable: true
})
}

try {
setLoading(true)
const signature = await walletProvider.sendTransfer({
recipient,
amount
})

toast({
title: `Transfer sent: ${signature}`,
status: 'success',
isClosable: true
})
} catch (error) {
toast({ title: 'Error', description: (error as Error).message, status: 'error' })
} finally {
setLoading(false)
}
}

return (
<>
<Box display="flex" width="100%" gap="2" mb="2">
<InputGroup>
<InputLeftAddon>Recipient</InputLeftAddon>
<Input value={recipient} onChange={e => setRecipient(e.currentTarget.value)} />
</InputGroup>

<InputGroup>
<InputLeftAddon>Amount</InputLeftAddon>
<Input value={amount} onChange={e => setAmount(e.currentTarget.value)} type="number" />
</InputGroup>
</Box>

<Button
data-testid="send-transfer-button"
onClick={onSendTransfer}
width="auto"
isLoading={loading}
>
Send Transfer
</Button>
</>
)
}
import { Box, Button, Input, InputGroup, InputLeftAddon, useToast } from '@chakra-ui/react'
import type { BitcoinConnector } from '@reown/appkit-adapter-bitcoin'
import { useAppKitAccount, useAppKitProvider } from '@reown/appkit/react'
import { useState } from 'react'

export function BitcoinSendTransferTest() {
const { walletProvider } = useAppKitProvider<BitcoinConnector>('bip122')
const { address } = useAppKitAccount()

const toast = useToast()
const [loading, setLoading] = useState(false)
const [recipient, setRecipient] = useState<string>(address || '')
const [amount, setAmount] = useState<string>('1500')

async function onSendTransfer() {
if (!walletProvider) {
toast({
title: 'No wallet provider',
status: 'error',
isClosable: true
})
}

try {
setLoading(true)
const signature = await walletProvider.sendTransfer({
recipient,
amount
})

toast({
title: `Transfer sent: ${signature}`,
status: 'success',
isClosable: true
})
} catch (error) {
toast({ title: 'Error', description: (error as Error).message, status: 'error' })
} finally {
setLoading(false)
}
}

return (
<>
<Box display="flex" width="100%" gap="2" mb="2">
<InputGroup>
<InputLeftAddon>Recipient</InputLeftAddon>
<Input value={recipient} onChange={e => setRecipient(e.currentTarget.value)} />
</InputGroup>

<InputGroup>
<InputLeftAddon>Amount</InputLeftAddon>
<Input value={amount} onChange={e => setAmount(e.currentTarget.value)} type="number" />
</InputGroup>
</Box>

<Button
data-testid="send-transfer-button"
onClick={onSendTransfer}
width="auto"
isLoading={loading}
>
Send Transfer
</Button>
</>
)
}
118 changes: 59 additions & 59 deletions apps/laboratory/src/components/Bitcoin/BitcoinSignMessageTest.tsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
import { Box, Button, Input, InputGroup, InputLeftAddon, useToast } from '@chakra-ui/react'
import type { BitcoinConnector } from '@reown/appkit-adapter-bitcoin'
import { useAppKitAccount, useAppKitProvider } from '@reown/appkit/react'
import { useState } from 'react'

export function BitcoinSignMessageTest() {
const { walletProvider } = useAppKitProvider<BitcoinConnector>('bip122')
const { address } = useAppKitAccount()

const toast = useToast()
const [loading, setLoading] = useState(false)
const [message, setMessage] = useState<string>('Hello, World!')

async function onSignMessage() {
if (!walletProvider || !address) {
toast({
title: 'No connection detected',
status: 'error',
isClosable: true
})

return
}

setLoading(true)

try {
const signature = await walletProvider.signMessage({
address,
message
})
toast({ title: 'Signature', description: signature, status: 'success' })
} catch (error) {
toast({ title: 'Error', description: (error as Error).message, status: 'error' })
} finally {
setLoading(false)
}
}

return (
<>
<Box display="flex" width="100%" gap="2" mb="2">
<InputGroup>
<InputLeftAddon>Message</InputLeftAddon>
<Input value={message} onChange={e => setMessage(e.currentTarget.value)} />
</InputGroup>
</Box>

<Button
data-testid="sign-message-button"
onClick={onSignMessage}
width="auto"
isLoading={loading}
>
Sign Message
</Button>
</>
)
}
import { Box, Button, Input, InputGroup, InputLeftAddon, useToast } from '@chakra-ui/react'
import type { BitcoinConnector } from '@reown/appkit-adapter-bitcoin'
import { useAppKitAccount, useAppKitProvider } from '@reown/appkit/react'
import { useState } from 'react'

export function BitcoinSignMessageTest() {
const { walletProvider } = useAppKitProvider<BitcoinConnector>('bip122')
const { address } = useAppKitAccount()

const toast = useToast()
const [loading, setLoading] = useState(false)
const [message, setMessage] = useState<string>('Hello, World!')

async function onSignMessage() {
if (!walletProvider || !address) {
toast({
title: 'No connection detected',
status: 'error',
isClosable: true
})

return
}

setLoading(true)

try {
const signature = await walletProvider.signMessage({
address,
message
})
toast({ title: 'Signature', description: signature, status: 'success' })
} catch (error) {
toast({ title: 'Error', description: (error as Error).message, status: 'error' })
} finally {
setLoading(false)
}
}

return (
<>
<Box display="flex" width="100%" gap="2" mb="2">
<InputGroup>
<InputLeftAddon>Message</InputLeftAddon>
<Input value={message} onChange={e => setMessage(e.currentTarget.value)} />
</InputGroup>
</Box>

<Button
data-testid="sign-message-button"
onClick={onSignMessage}
width="auto"
isLoading={loading}
>
Sign Message
</Button>
</>
)
}
Loading

0 comments on commit 00eb58a

Please sign in to comment.