WIP on sign handling
This commit is contained in:
parent
eb063aca3a
commit
4a95f9edbd
@ -10,12 +10,12 @@ export default function SessionProposalModal() {
|
|||||||
const proposal = ModalStore.state.data?.proposal
|
const proposal = ModalStore.state.data?.proposal
|
||||||
const address = WalletStore.state.wallet?.address
|
const address = WalletStore.state.wallet?.address
|
||||||
|
|
||||||
// Ensure proposal and client are defined
|
// Ensure proposal is defined
|
||||||
if (!proposal || !client) {
|
if (!proposal) {
|
||||||
return <Text>Missing proposal data</Text>
|
return <Text>Missing proposal data</Text>
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get data to display
|
// Get required proposal data
|
||||||
const { proposer, permissions, relay } = proposal
|
const { proposer, permissions, relay } = proposal
|
||||||
const { icons, name, url } = proposer.metadata
|
const { icons, name, url } = proposer.metadata
|
||||||
const { chains } = permissions.blockchain
|
const { chains } = permissions.blockchain
|
||||||
|
@ -1,25 +1,35 @@
|
|||||||
import ModalStore from '@/store/ModalStore'
|
import ModalStore from '@/store/ModalStore'
|
||||||
|
import WalletStore from '@/store/WalletStore'
|
||||||
import { CHAIN, MAINNET_CHAINS } from '@/utils/EIP155ChainsUtil'
|
import { CHAIN, MAINNET_CHAINS } from '@/utils/EIP155ChainsUtil'
|
||||||
|
import { client } from '@/utils/WalletConnectUtil'
|
||||||
import { Avatar, Button, Col, Container, Divider, Link, Modal, Row, Text } from '@nextui-org/react'
|
import { Avatar, Button, Col, Container, Divider, Link, Modal, Row, Text } from '@nextui-org/react'
|
||||||
import { Fragment } from 'react'
|
import { Fragment } from 'react'
|
||||||
|
|
||||||
export default function SessionRequestModal() {
|
export default function SessionRequestModal() {
|
||||||
|
// Get request and wallet data from store
|
||||||
const request = ModalStore.state.data?.request
|
const request = ModalStore.state.data?.request
|
||||||
const requestSession = ModalStore.state.data?.requestSession
|
const requestSession = ModalStore.state.data?.requestSession
|
||||||
|
const { wallet } = WalletStore.state
|
||||||
|
|
||||||
if (!request || !requestSession) {
|
// Ensure request and wallet are defined
|
||||||
|
if (!request || !requestSession || !wallet) {
|
||||||
return <Text>Missing request data</Text>
|
return <Text>Missing request data</Text>
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
// Get required request data
|
||||||
chainId,
|
const { chainId } = request
|
||||||
request: { method }
|
const { method } = request.request
|
||||||
} = request
|
|
||||||
const { protocol } = requestSession.relay
|
const { protocol } = requestSession.relay
|
||||||
const { name, icons, url } = requestSession.peer.metadata
|
const { name, icons, url } = requestSession.peer.metadata
|
||||||
|
|
||||||
async function onApprove() {}
|
// Handle approve action (logic varies based on request method)
|
||||||
|
async function onApprove() {
|
||||||
|
if (client && wallet) {
|
||||||
|
// TODO figure out how to sign different personal messages correctly with ethers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle reject action
|
||||||
async function onReject() {}
|
async function onReject() {}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user