dApp Integration
If you are using dapp-kit
, you do not need to install any additional packages to integrate with
the Slush wallet. Read how to integrate with dapp-kit.
Using the Slush Wallet SDK, you can allow users to connect to the Slush wallet from your dApp. The wallet is provided through the Wallet Standard, and should appear automatically in your existing wallet connection UI.
The Slush Wallet SDK is only needed if you want to support the Slush web wallet in your dApp. If you want to integrate with the Slush browser extension or native mobile wallet, you do not need to install any additional packages - they will work automatically through the Wallet Standard.
Setup
To use the Slush web wallet, you will need to register it in your application, using
registerSlushWallet
. This only needs to be done once, and should be done as early as possible in
your application's lifecycle.
registerSlushWallet
takes two arguments:
name
: The name of your dApp. This will be shown to the user when they are asked to approve the connection in Slush.options
: An optional object with the following properties:origin
: The origin of the Slush website. Defaults tohttps://[TODO]
.network
: The network that you would like the Slush wallet to use. Defaults tomainnet
, supportsmainnet
andtestnet
.
import { registerSlushWallet } from '@mysten/slush-wallet';
registerSlushWallet('Your dApp Name');
Supported features
The Slush wallet currently supports the following features:
signTransaction
signAndExecuteTransaction
signPersonalMessage
Detecting the Slush wallet
If you'd like to detect whether the user is connected to the Slush wallet, you can use the id
or
name
property on the wallet
For example, if you are using dapp-kit
, you can use the useCurrentWallet
hook to get the current
wallet, and check if it is the Slush wallet.
import { useCurrentWallet } from '@mysten/dapp-kit';
import { SLUSH_WALLET_NAME } from '@mysten/slush-wallet';
function SlushOnly() {
const { currentWallet } = useCurrentWallet();
const walletIsSlushWallet = currentWallet?.name === SLUSH_WALLET_NAME;
// rest of component logic...
}
Migration from Stashed Wallet -> Slush Wallet
If you're currently using @mysten/zksend
's registerStashedWallet
directly, you should migrate to
the @mysten/slush-wallet
package to ensure compatibility with the new Slush experience.
π Installation
pnpm install @mysten/slush-wallet
π Migration
If you're using registerStashedWallet
, switch to registerSlushWallet
:
Before:
import { registerStashedWallet } from '@mysten/zksend';
registerStashedWallet(...);
After:
import { registerSlushWallet } from '@mysten/slush-wallet';
registerSlushWallet(...);
If you're using dapp-kit, update to the latest dapp-kit version and change the stashedWallet
prop
on WalletProvider to slushWallet
Note: In the connect modal, users with the Slush Wallet extension installed will only see the extension. If they donβt have it, the connection will default to the Slush web app.