@web3-onboard/react
Advanced tools
Comparing version 2.8.17 to 2.9.0-alpha.4
@@ -9,1 +9,2 @@ export { useAccountCenter } from './useAccountCenter.js'; | ||
export { useUpdateTheme } from './useUpdateTheme.js'; | ||
export { useWagmiConfig } from './useWagmiConfig.js'; |
@@ -10,1 +10,2 @@ // Barrel file | ||
export { useUpdateTheme } from './useUpdateTheme.js'; | ||
export { useWagmiConfig } from './useWagmiConfig.js'; |
import type { AccountCenter } from '@web3-onboard/core'; | ||
export declare const useAccountCenter: () => (update: AccountCenter | Partial<AccountCenter>) => void; | ||
export declare const useAccountCenter: () => ((update: AccountCenter | Partial<AccountCenter>) => void); |
import type { ConnectOptions, DisconnectOptions, WalletState } from '@web3-onboard/core'; | ||
import type { WalletInit } from '@web3-onboard/common'; | ||
export declare const useConnectWallet: () => [{ | ||
wallet: WalletState | null; | ||
connecting: boolean; | ||
}, (options?: ConnectOptions) => Promise<WalletState[]>, (wallet: DisconnectOptions) => Promise<WalletState[]>, (addresses?: string[]) => Promise<void>, (wallets: WalletInit[]) => void, (wallet: WalletState, address?: string) => void]; | ||
export declare const useConnectWallet: () => [ | ||
{ | ||
wallet: WalletState | null; | ||
connecting: boolean; | ||
}, | ||
(options?: ConnectOptions) => Promise<WalletState[]>, | ||
(wallet: DisconnectOptions) => Promise<WalletState[]>, | ||
(addresses?: string[]) => Promise<void>, | ||
(wallets: WalletInit[]) => void, | ||
(wallet: WalletState, address?: string) => void | ||
]; |
import type { CustomNotification, Notify, UpdateNotification, Notification, PreflightNotificationsOptions } from '@web3-onboard/core'; | ||
export declare const useNotifications: () => [Notification[], (updatedNotification: CustomNotification) => { | ||
dismiss: () => void; | ||
update: UpdateNotification; | ||
}, (update: Partial<Notify>) => void, (options: PreflightNotificationsOptions) => Promise<void | string>]; | ||
export declare const useNotifications: () => [ | ||
Notification[], | ||
(updatedNotification: CustomNotification) => { | ||
dismiss: () => void; | ||
update: UpdateNotification; | ||
}, | ||
(update: Partial<Notify>) => void, | ||
(options: PreflightNotificationsOptions) => Promise<void | string> | ||
]; |
@@ -7,7 +7,10 @@ import type { ConnectedChain } from '@web3-onboard/core'; | ||
}; | ||
export declare const useSetChain: (walletLabel?: string) => [{ | ||
chains: Chain[]; | ||
connectedChain: ConnectedChain | null; | ||
settingChain: boolean; | ||
}, (options: SetChainOptions) => Promise<boolean>]; | ||
export declare const useSetChain: (walletLabel?: string) => [ | ||
{ | ||
chains: Chain[]; | ||
connectedChain: ConnectedChain | null; | ||
settingChain: boolean; | ||
}, | ||
(options: SetChainOptions) => Promise<boolean> | ||
]; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
export declare const useSetLocale: () => (locale: string) => void; | ||
export declare const useSetLocale: () => ((locale: string) => void); |
import type { Theme } from '@web3-onboard/core'; | ||
export declare const useUpdateTheme: () => (update: Theme) => void; | ||
export declare const useUpdateTheme: () => ((update: Theme) => void); |
@@ -1,2 +0,2 @@ | ||
export { useAccountCenter, useAppState, useConnectWallet, useNotifications, useSetChain, useSetLocale, useUpdateTheme, useWallets } from './hooks/index.js'; | ||
export { init, Web3OnboardProvider, Web3OnboardProviderProps } from './context.js'; | ||
export { useAccountCenter, useAppState, useConnectWallet, useNotifications, useSetChain, useSetLocale, useUpdateTheme, useWallets, useWagmiConfig } from './hooks/index.js'; | ||
export { init, Web3OnboardProvider, type Web3OnboardProviderProps } from './context.js'; |
@@ -1,2 +0,2 @@ | ||
export { useAccountCenter, useAppState, useConnectWallet, useNotifications, useSetChain, useSetLocale, useUpdateTheme, useWallets } from './hooks/index.js'; | ||
export { useAccountCenter, useAppState, useConnectWallet, useNotifications, useSetChain, useSetLocale, useUpdateTheme, useWallets, useWagmiConfig } from './hooks/index.js'; | ||
export { init, Web3OnboardProvider } from './context.js'; |
{ | ||
"name": "@web3-onboard/react", | ||
"version": "2.8.17", | ||
"version": "2.9.0-alpha.4", | ||
"description": "A collection of React hooks for integrating Web3-Onboard in to React and Next.js projects. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.", | ||
@@ -61,7 +61,7 @@ "keywords": [ | ||
"react": "^18.0.0", | ||
"typescript": "^4.5.5" | ||
"typescript": "^5.4.5" | ||
}, | ||
"dependencies": { | ||
"@web3-onboard/common": "^2.3.3", | ||
"@web3-onboard/core": "^2.21.6", | ||
"@web3-onboard/core": "^2.22.0-alpha.4", | ||
"@web3-onboard/common": "^2.4.0-alpha.2", | ||
"use-sync-external-store": "1.0.0" | ||
@@ -71,3 +71,6 @@ }, | ||
"react": ">=16.8" | ||
}, | ||
"engines": { | ||
"node": ">=16.15.1" | ||
} | ||
} |
@@ -38,2 +38,3 @@ <a href="https://onboard.blocknative.com/"> | ||
init({ | ||
// This javascript object is unordered meaning props do not require a certain order | ||
apiKey, | ||
@@ -451,1 +452,29 @@ wallets: [injected], | ||
``` | ||
## `useWagmiConfig` | ||
This hook allows you to get the WagmiConfig (Config from the Wagmi project) from @web3-onboard/core if web3-onboard has been initialized with the wagmi property imported and passing into the web3-onboard/core config. | ||
```typescript | ||
import { sendTransaction as wagmiSendTransaction } from '@web3-onboard/wagmi' | ||
import { parseEther } from 'viem' | ||
import { useWagmiConfig, wallets } from '@web3-onboard/react' | ||
import type { WagmiConfig } from '@web3-onboard/core' | ||
type useWagmiConfig = (): WagmiConfig | ||
const wagmiConfig = useWagmiConfig() | ||
const w3OWallets = useWallets() | ||
const sendTransaction = async () => { | ||
// current primary wallet - as multiple wallets can connect this value is the currently active | ||
const [currentPrimaryWallet] = w3OWallets | ||
const result = await wagmiSendTransaction(wagmiConfig, { | ||
to: toAddress, | ||
// desired connector to send txn from | ||
account: currentPrimaryWallet.accounts[0], | ||
value: parseEther('0.001') | ||
}) | ||
console.log(result) | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26078
26
213
479
1