Migrating to v4
Version 4 of @passkeys/core
has been released as a release candidate, introducing improvements in bundle size and performance. The migration process requires two steps:
1. Update dependencies
Ensure that both @passkeys/core
and @passkeys/react
are updated to their latest versions. Note that earlier major versions of @passkeys/react
are not compatible with @passkeys/core
v4.
npm i @passkeys/[email protected] @passkeys/[email protected]
2. Update references to wallet.providers
The wallet.providers
API has been removed in v4. If you are using <WalletProvider />
, you are likely not directly interacting with wallet.providers
. However, if you do access providers this way, you will need to replace these references with the new asynchronous getter function.
import { createWallet } from '@passkeys/core';
const wallet = createWallet({
appId: '<YOUR_APP_ID>',
providers: {
ethereum: true,
// ...
},
});
- const ethereumProvider = wallet.providers.ethereum
+ const ethereumProvider = await wallet.getProvider('ethereum')
3. Use the new wallet.disconnect()
Until now, the wallet was not aware if you externally disconnected it and would keep its running state.
The new wallet.disconnect()
method allows you to notify the wallet that you would like to terminate the current connection.
If you're running multiple providers at once, the wallet will inform all of them that it is no longer connected.