Skip to content

Commit

Permalink
feat: add loading state to useWeb3ModalState hook
Browse files Browse the repository at this point in the history
  • Loading branch information
enesozturk committed Feb 13, 2024
1 parent a03daca commit 82a9668
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/core/src/controllers/PublicStateController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import type { CaipNetworkId } from '../utils/TypeUtil.js'

// -- Types --------------------------------------------- //
export interface PublicStateControllerState {
loading: boolean
open: boolean
selectedNetworkId?: CaipNetworkId
}

// -- State --------------------------------------------- //
const state = proxy<PublicStateControllerState>({
loading: false,
open: false,
selectedNetworkId: undefined
})
Expand Down
2 changes: 1 addition & 1 deletion packages/scaffold/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class Web3ModalScaffold {
}

public getState() {
return { ...PublicStateController.state }
return { ...PublicStateController.state, loading: ModalController.state.loading }
}

public subscribeState(callback: (newState: PublicStateControllerState) => void) {
Expand Down

0 comments on commit 82a9668

Please sign in to comment.