Skip to content

Commit

Permalink
Merge pull request #177 from vu3th/feat/export-3-callbacks
Browse files Browse the repository at this point in the history
feat(core): export onDisconnect, onAccountsChanged, and onChainChanged
  • Loading branch information
johnson86tw authored Apr 30, 2024
2 parents b86c833 + ef20ac2 commit b58ef58
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/core/src/services/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ export function useConnect(pinia?: any) {
}
}

function onDisconnect(callback: (...args: any[]) => void) {
walletStore.onDisconnectCallback = callback
}

function onAccountsChanged(callback: (accounts: string[]) => void) {
walletStore.onAccountsChangedCallback = callback
}

function onChainChanged(callback: (chainId: number) => void) {
walletStore.onChainChangedCallback = callback
}

return {
isWindowEthereumAvailable,

Expand All @@ -158,5 +170,9 @@ export function useConnect(pinia?: any) {
connectTo,
disconnect,
autoConnect,

onDisconnect,
onAccountsChanged,
onChainChanged,
}
}

0 comments on commit b58ef58

Please sign in to comment.