An open API service indexing awesome lists of open source software.

https://github.com/shiny-lua/capsule-miniapp


https://github.com/shiny-lua/capsule-miniapp

Last synced: about 1 year ago
JSON representation

Awesome Lists containing this project

README

          

# Capsule Telegram Mini-App

image

This template provides a minimal setup to get Capsule Pre-generated wallets working in a Mini-App

## Key Steps

1. **Initialize the App**

- When the mini-app starts, it calls `initializeApp()` which checks for an existing wallet.

2. **Generate Wallet**

- If no wallet exists, `generateWallet()` is called to create a pre-generated wallet using
`capsuleClient.createWalletPreGen()`.

3. **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.

4. **Retrieve Wallet Data**

- When the app starts, it attempts to retrieve stored data using `retrieveChunkedData()`.
- This function reassembles the chunked data.

5. **Sign Messages**

- Once the wallet is set up, users can sign messages using `signMessage()`.

6. **Clear Storage**
- Users can clear all stored data using `clearChunkedStorage()`.

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.

## Usage

First, deploy your app to a link (This repo is hosted [here](https://capsule-org.github.io/capsule-telegram-miniapp/))

Then, make a telegram bot [(See Telegram's Guide Here)](https://core.telegram.org/bots/tutorial) and point it to open
this link

## Try it out

image

A Telegram mini-app linked to this app is [here](https://t.me/capsule_miniapp_bot)