dApp Integration
If you are using dapp-kit
, you do not need to install any additional packages to integrate with
the Stashed wallet. Read how to integrate with dapp-kit.
Using the zkSend SDK, you can allow users to connect to the Stashed wallet from your dApp. The wallet is provided through the Wallet Standard (opens in a new tab), and should appear automatically in your existing wallet connection UI.
Considerations
- Stashed only supports Mainnet at this time.
- Users will only be able to connect their zkLogin wallet from Stashed.
- The zkLogin account will be managed by Stashed, you do not need to set up any OAuth providers.
- You will not get access to the user's private key, you will only be able to connect to the wallet, and suggest transactions and messages to sign, just like any other wallet in the ecosystem.
Setup
To use the Stashed wallet, you will need to register it in your application, using
registerStashedWallet
. This only needs to be done once, and should be done as early as possible in
your application's lifecycle.
registerStashedWallet
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 Stashed.options
: An optional object with the following properties:origin
: The origin of the Stashed website. Defaults tohttps://getstashed.com
.network
: The network that you would like the Stashed wallet to use. Defaults tomainnet
, supportsmainnet
andtestnet
.
import { registerStashedWallet } from '@mysten/zksend';
registerStashedWallet('Your dApp Name');
Supported features
The Stashed wallet currently supports the following features:
signTransaction
signPersonalMessage
We intentionally do not support signAndExecuteTransaction
, and suggest that your dApp instead use
signTransaction
, and submit the signed transaction within your dApp instead. This provides better
control around execution, and avoids potential issues around data inconsistency. If you believe you
have a strong reason for using signAndExecuteTransaction
, please
open an issue (opens in a new tab).
Detecting the Stashed wallet
If you'd like to detect whether the user is connected to the Stashed wallet, you can use the 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 Stashed wallet.
import { useCurrentWallet } from '@mysten/dapp-kit';
import { STASHED_WALLET_NAME } from '@mysten/zksend';
function StashedOnly() {
const { currentWallet } = useCurrentWallet();
const walletIsStashedWallet = currentWallet?.name === STASHED_WALLET_NAME;
// rest of component logic...
}