mirror of
https://github.com/acid-info/logos-ordinals-dashboard.git
synced 2025-01-11 22:24:24 +00:00
feat: implement token verification
This commit is contained in:
parent
39083da5f2
commit
a50c7dd187
6
constants/wallet.ts
Normal file
6
constants/wallet.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export const WALLET_SIGN_MESSAGE_REQUEST = `Welcome to The Exit!
|
||||
|
||||
Please click to verify your wallet ownership and to sign into The Exit.
|
||||
|
||||
This request will not trigger a blockchain transaction or cost any gas fees.
|
||||
`
|
@ -4,6 +4,8 @@ import { truncateString } from '@/utils/general.utils'
|
||||
import styled from '@emotion/styled'
|
||||
import Link from 'next/link'
|
||||
import React, { useState } from 'react'
|
||||
import { api } from '../../../../common/api'
|
||||
import { WALLET_SIGN_MESSAGE_REQUEST } from '../../../../constants/wallet'
|
||||
import { Navbar } from '../Navbar'
|
||||
|
||||
declare global {
|
||||
@ -27,7 +29,21 @@ const Header: React.FC<NavbarProps> = () => {
|
||||
// DOCS: https://www.okx.com/web3/build/docs/sdks/chains/bitcoin/provider#connect
|
||||
if (window.okxwallet) {
|
||||
const result = await window.okxwallet.bitcoin.connect()
|
||||
setWalletAddress(result.address)
|
||||
const address = result.address
|
||||
|
||||
setWalletAddress(address)
|
||||
|
||||
const signature = await window.okxwallet.bitcoin.signMessage(
|
||||
WALLET_SIGN_MESSAGE_REQUEST,
|
||||
'bip322-simple',
|
||||
)
|
||||
|
||||
const response = await api.post('/token/pair', {
|
||||
address,
|
||||
signature,
|
||||
})
|
||||
|
||||
console.log('Token pair response:', response)
|
||||
} else {
|
||||
alert('No Bitcoin wallet found. Please install OKX Wallet.')
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user