This template provides a minimal setup to get Capsule Pre-generated wallets working in a Mini-App
-
Initialize the App
- When the mini-app starts, it calls
initializeApp()
which checks for an existing wallet.
- When the mini-app starts, it calls
-
Generate Wallet
- If no wallet exists,
generateWallet()
is called to create a pre-generated wallet usingcapsuleClient.createWalletPreGen()
.
- If no wallet exists,
-
Store Wallet Data
- After wallet creation, the user share and wallet ID need to be stored.
- Due to storage limitations, data is chunked using
storeWithChunking()
. - This process runs asynchronously to avoid blocking the app.
-
Retrieve Wallet Data
- When the app starts, it attempts to retrieve stored data using
retrieveChunkedData()
. - This function reassembles the chunked data.
- When the app starts, it attempts to retrieve stored data using
-
Sign Messages
- Once the wallet is set up, users can sign messages using
signMessage()
.
- Once the wallet is set up, users can sign messages using
-
Clear Storage
- Users can clear all stored data using
clearChunkedStorage()
.
- Users can clear all stored data using
Note: The app can start signing transactions as soon as the wallet is created. However, ensure the user doesn't close the app until the storage of the user share is completed.
First, deploy your app to a link (This repo is hosted here)
Then, make a telegram bot (See Telegram's Guide Here) and point it to open this link
A Telegram mini-app linked to this app is here