Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lawalletio/satsback
Simple cash back to reward the people that use LaCard of LaWallet.
https://github.com/lawalletio/satsback
bitcoin lightning-network nostr nostr-dev-kit nostr-tools zap
Last synced: 3 months ago
JSON representation
Simple cash back to reward the people that use LaCard of LaWallet.
- Host: GitHub
- URL: https://github.com/lawalletio/satsback
- Owner: lawalletio
- License: mit
- Created: 2024-09-12T20:01:54.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-20T04:52:11.000Z (4 months ago)
- Last Synced: 2024-09-27T01:52:53.865Z (4 months ago)
- Topics: bitcoin, lightning-network, nostr, nostr-dev-kit, nostr-tools, zap
- Language: TypeScript
- Homepage: https://lawallet.io
- Size: 161 KB
- Stars: 15
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Satsback Module for LaWallet
![License](https://badgen.net/github/license/lawalletio/satsback/?color=cyan)
![Stars](https://badgen.net/github/stars/lawalletio/satsback/?color=yellow)
![Forks](https://badgen.net/github/forks/lawalletio/satsback/?color=grey)This module is used to send cashback in sats to users who purchase with LaWallet through LaPOS using LaCard.
## Table of Contents
- [Flow](#flow)
- [Configuration](#configuration)
- [To Do](#to-do)## Flow
1. **Bob** pays with **LaCard** in **LaPOS** (only payments with **LaCard** are valid, payments with QR code don't work).
2. **LaPOS** sends an HTTP `POST` request to the `/publish` endpoint of LaWallet with`internal-transaction-start`, containing **Bob**'s payment to **LaPOS**
3. **Ledger** recive the payment and confirms it by sending `internal-transaction-ok` to LaWallet relay (`wss://relay.lawallet.ar`).
4. The **satsback module** subscribes to LaWallet relay to listen for `internal-transaction-ok` emmited by the **Ledger** and directed to **LaPOS**.
5. The **module** receives the `internal-transaction-ok`.
6. The **module** sends an HTTP `POST` request to `/publish` endpoint of LaWallet with `internal-transaction-start`, containing the satsback for **Bob**.
7. **Ledger** send `internal-transaction-ok` to LaWallet relay and **Bob** recive your satsback. (Don't showing in the map).> NOTE: The **satsback module** MUST have a LaWallet account.
## Configuration
### 1. Setup environment variables
Copy `.env.example` to `.env` and fill the `MODULE_PRIVATE_KEY` with the private key of LaWallet account
> It's necessary to have a LaWallet account to send internal transactions.
```bash
cp .env.example .env
```### 2. Setup
Use correct node version
```bash
nvm use
```Install the dependencies
```bash
pnpm i
```### 3. Run in dev mode
```bash
pnpm dev
```## To Do
- [x] Fix minimum amount of satsback
- [x] Add database
- [x] Add list of volunteers walias (pubkey and sats of voucher)
- [x] Add satsback percentages (normal and volunteers) to environment variables
- [x] makeEvent
- [x] Volunteers handle
- [x] Search in db
- [x] Handle sats remaining
- [x] Encrypt metadata of conent of event for the ledger send interal transaction
- [x] Save id of payments to LaPOS in db
- [x] Save the last timestamp of the last payment in db
- [x] Subscribe to relay with the last timestamp
- [x] Check if events are already recive satsback
- [ ] Cache for prisma
- [ ] Volunteers model
- [ ] Events model
- [ ] Endpoint to add volunteer
- [ ] Add documentation
- [ ] Of the filters
- [ ] Of event that the module can handle and emit
- [ ] Of the database
- [ ] How avoid double satsback
- [ ] How handle relay disconnection
- [ ] Dockerize