small fixes
This commit is contained in:
@@ -4,6 +4,8 @@ const nextConfig: NextConfig = {
|
||||
transpilePackages: [
|
||||
'@tamagui/lucide-icons-2',
|
||||
'@descro/sdk',
|
||||
'@solana/connector',
|
||||
'@wallet-ui/core',
|
||||
],
|
||||
turbopack: {
|
||||
resolveAlias: {
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
import { useMemo } from 'react'
|
||||
import { AppProvider } from '@solana/connector/react'
|
||||
import { getDefaultConfig } from '@solana/connector/headless'
|
||||
import { AppProvider, getDefaultConfig, getDefaultMobileConfig } from '@solana/connector/react'
|
||||
|
||||
function getOrigin() {
|
||||
if (typeof window !== 'undefined') return window.location.origin
|
||||
@@ -33,5 +32,10 @@ export function WalletProviders({ children }: { children: ReactNode }) {
|
||||
[],
|
||||
)
|
||||
|
||||
return <AppProvider connectorConfig={connectorConfig}>{children}</AppProvider>
|
||||
const mobile = useMemo(
|
||||
() => getDefaultMobileConfig({ appName: 'Descro', appUrl: getOrigin() }),
|
||||
[],
|
||||
)
|
||||
|
||||
return <AppProvider connectorConfig={connectorConfig} mobile={mobile}>{children}</AppProvider>
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useConnector, useConnectWallet, useDisconnectWallet, useWalletConnectors } from '@solana/connector/react'
|
||||
import { useConnector } from '@solana/connector/react'
|
||||
|
||||
export function WalletButton() {
|
||||
const { isConnected, isConnecting, account, connector } = useConnector()
|
||||
const { connect } = useConnectWallet()
|
||||
const { disconnect } = useDisconnectWallet()
|
||||
const connectors = useWalletConnectors()
|
||||
const { isConnected, isConnecting, account, connector, connectWallet, disconnectWallet, connectors } = useConnector()
|
||||
const [showList, setShowList] = useState(false)
|
||||
|
||||
const baseStyle: React.CSSProperties = {
|
||||
@@ -24,7 +21,7 @@ export function WalletButton() {
|
||||
if (isConnected && account) {
|
||||
const short = `${account.slice(0, 4)}…${account.slice(-4)}`
|
||||
return (
|
||||
<button style={{ ...baseStyle, backgroundColor: '#2e7d32' }} onClick={() => disconnect()}>
|
||||
<button style={{ ...baseStyle, backgroundColor: '#2e7d32' }} onClick={() => disconnectWallet()}>
|
||||
{connector?.icon && (
|
||||
<img src={connector.icon} width={16} height={16} alt="" style={{ marginRight: 6, verticalAlign: 'middle', borderRadius: 4 }} />
|
||||
)}
|
||||
@@ -47,7 +44,7 @@ export function WalletButton() {
|
||||
{connectors.map((w) => (
|
||||
<button
|
||||
key={w.id}
|
||||
onClick={() => { connect(w.id); setShowList(false) }}
|
||||
onClick={() => { connectWallet(w.id); setShowList(false) }}
|
||||
style={{
|
||||
display: 'flex', alignItems: 'center', gap: 8, width: '100%',
|
||||
padding: '8px 12px', border: 'none', background: 'none',
|
||||
|
||||
Reference in New Issue
Block a user