Documentation Index
Fetch the complete documentation index at: https://docs.sequence.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Importar
import { useOpenWalletModal } from '@0xsequence/wallet-widget'
Uso
import './App.css'
import { useOpenWalletModal } from '@0xsequence/wallet-widget'
function App() {
// Get the function to open/close the wallet modal
const { setOpenWalletModal } = useOpenWalletModal()
// Function to handle opening the wallet inventory home page
const openWalletWidget = () => {
setOpenWalletModal(true) // Open the wallet modal to view tokens
}
// Function to handle opening the wallet inventory swap page
const openWalletWidgetSwapPage = () => {
setOpenWalletModal(true, { defaultNavigation: { location: 'swap' } }) // Open the wallet modal to view tokens
}
return (
<div>
<button
onClick={openWalletWidget}
title="Wallet Widget"
>
Open Wallet Widget Home Page
</button>
<button
onClick={openWalletWidgetSwapPage}
title="Wallet Widget"
>
Open Wallet Widget Swap Page
</button>
</div>
)
}
export default App
Tipo de retorno: UseOpenWalletModalReturnType
El hook retorna un objeto con las siguientes propiedades:
type UseOpenWalletModalReturnType = {
setOpenWalletModal: (isOpen: boolean, options?: WalletOptions) => void
openWalletModalState: boolean
}
Propiedades
setOpenWalletModal
(isOpen: boolean, options?: WalletOptions) => void
Función para abrir o cerrar el modal de Wallet.
Parámetros:
| Parámetro | Type | Description |
|---|
isOpen | boolean | Indica si el modal debe estar abierto (true) o cerrado (false) |
options | WalletOptions | Configuraciones opcionales para el modal de Wallet |
interface WalletOptions {
defaultNavigation?: Navigation
}
type Navigation =
| BasicNavigation
| CoinDetailsNavigation
| CollectibleDetailsNavigation
| CollectionDetailsNavigation
| TransactionDetailsNavigation
| SendCoinNavigation
| SendCollectibleNavigation
| SwapCoinNavigation
| SwapCoinListNavigation
openWalletModalState
boolean
El estado actual de apertura del modal de Wallet (true si está abierto, false si está cerrado).
Notas
Este hook proporciona métodos para controlar el modal de inventario de Wallet, que permite a los usuarios ver sus tokens y NFTs. El modal de Wallet muestra todos los tokens, NFTs y coleccionables presentes en la wallet conectada.