File tree Expand file tree Collapse file tree 5 files changed +11
-7
lines changed
apps/portal/src/app/nebula/plugins/openai Expand file tree Collapse file tree 5 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " thirdweb " : patch
3+ ---
4+
5+ Allow connecting wallets without setting them as active with useConnect
File renamed without changes.
Original file line number Diff line number Diff line change 33import type React from "react" ;
44import { createContext , useContext } from "react" ;
55import type { ThirdwebClient } from "../../../client/client.js" ;
6- import { isAddress } from "../../../utils/address.js" ;
76/**
87 * Props for the <AccountProvider /> component
98 * @component
@@ -53,9 +52,6 @@ export function AccountProvider(
5352 "AccountProvider: No address passed. Ensure an address is always provided to the AccountProvider" ,
5453 ) ;
5554 }
56- if ( ! isAddress ( props . address ) ) {
57- throw new Error ( `AccountProvider: Invalid address: ${ props . address } ` ) ;
58- }
5955 return (
6056 < AccountProviderContext . Provider value = { props } >
6157 { props . children }
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export function useWalletName(props: {
2424/**
2525 * @internal Exported for tests only
2626 */
27- function getQueryKeys ( props : {
27+ export function getQueryKeys ( props : {
2828 id : WalletId ;
2929 formatFn ?: ( str : string ) => string ;
3030} ) {
@@ -41,7 +41,7 @@ function getQueryKeys(props: {
4141/**
4242 * @internal Exported for tests only
4343 */
44- async function fetchWalletName ( props : {
44+ export async function fetchWalletName ( props : {
4545 id : WalletId ;
4646 formatFn ?: ( str : string ) => string ;
4747} ) {
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export type ConnectionManager = ReturnType<typeof createConnectionManager>;
2424export type ConnectManagerOptions = {
2525 client : ThirdwebClient ;
2626 accountAbstraction ?: SmartWalletOptions ;
27+ setWalletAsActive ?: boolean ;
2728 onConnect ?: ( wallet : Wallet ) => void ;
2829} ;
2930
@@ -146,7 +147,9 @@ export function createConnectionManager(storage: AsyncStorage) {
146147 // add personal wallet to connected wallets list even if it's not the active one
147148 addConnectedWallet ( wallet ) ;
148149
149- handleSetActiveWallet ( activeWallet ) ;
150+ if ( options ?. setWalletAsActive !== false ) {
151+ handleSetActiveWallet ( activeWallet ) ;
152+ }
150153
151154 wallet . subscribe ( "accountChanged" , async ( ) => {
152155 // We reimplement connect here to prevent memory leaks
You can’t perform that action at this time.
0 commit comments