Skip to main content

API Reference

setupLuksoConnector

Returns Promise<LuksoConnector>. Call once at app initialization. Example with custom options:

const connector = await setupLuksoConnector({
theme: 'dark',
walletConnect: {
projectId: 'YOUR_REOWN_PROJECT_ID', // get yours at https://cloud.reown.com
},
chains: {
enableTestnet: true,
},
connectors: {
eoa: false,
},
onConnect: (event) => console.log('Connected:', event.detail),
onError: (event) => console.error('Error:', event.detail),
onClose: () => console.log('Modal closed'),
});

Config Options

OptionTypeDefaultDescription
theme'light' | 'dark' | 'auto''light'Modal theme
onConnect(e: CustomEvent) => voidCalled on successful connection
onError(e: CustomEvent) => voidCalled on connection error
onClose() => voidCalled when modal is closed
walletConnect.enabledbooleantrueEnable WalletConnect
walletConnect.projectIdstringLUKSO defaultWalletConnect project ID
chains.defaultChainIdnumber42Default chain (LUKSO mainnet)
chains.enableTestnetbooleanfalseAlso enable LUKSO testnet (4201)
storage.keystring'up-wagmi'localStorage key prefix for wagmi state
connectors.upMobilebooleantrueShow UP Mobile connector button
connectors.upExtensionbooleantrueShow UP Extension connector button
connectors.eoabooleantrueShow EOA wallets divider and button
wagmiConfigConfig (from @wagmi/core)auto-createdPass your own wagmi config

LuksoConnector Methods

MethodDescription
showSignInModal()Opens the sign-in modal (creates <connect-modal> in document.body on first call)
showSignUpModal()Opens the sign-up modal for creating a new Universal Profile
closeModal()Closes the modal
setTheme(theme)Updates the theme ('light' | 'dark' | 'auto') — works while modal is open
destroyModal()Closes the modal and removes the element from the DOM
wagmiConfigThe underlying wagmi Config instance for advanced use

Advanced

Using Your Own Wagmi Config

import { setupLuksoConnector } from '@lukso/up-modal';
import { myWagmiConfig } from './wagmi';

const connector = await setupLuksoConnector({
wagmiConfig: myWagmiConfig,
});

Watching Connection State

import { watchConnection, getConnection } from '@wagmi/core';

const { wagmiConfig } = connector;

// One-time read
const connection = getConnection(wagmiConfig);

// Subscribe to changes
const stopWatching = watchConnection(wagmiConfig, {
onChange: (connection) => {
console.log(connection.address, connection.chainId);
},
});