This module is used to send cashback in sats to users who purchase with LaWallet through LaPOS using LaCard.
- Bob pays with LaCard in LaPOS (only payments with LaCard are valid, payments with QR code don't work).
- LaPOS sends an HTTP
POST
request to the/publish
endpoint of LaWallet withinternal-transaction-start
, containing Bob's payment to LaPOS - Ledger recive the payment and confirms it by sending
internal-transaction-ok
to LaWallet relay (wss://relay.lawallet.ar
). - The satsback module subscribes to LaWallet relay to listen for
internal-transaction-ok
emmited by the Ledger and directed to LaPOS. - The module receives the
internal-transaction-ok
. - The module sends an HTTP
POST
request to/publish
endpoint of LaWallet withinternal-transaction-start
, containing the satsback for Bob. - 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.
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.
cp .env.example .env
Use correct node version
nvm use
Install the dependencies
pnpm i
pnpm dev
- Fix minimum amount of satsback
- Add database
- Add list of volunteers walias (pubkey and sats of voucher)
- Add satsback percentages (normal and volunteers) to environment variables
- makeEvent
- Volunteers handle
- Search in db
- Handle sats remaining
- Encrypt metadata of conent of event for the ledger send interal transaction
- Save id of payments to LaPOS in db
- Save the last timestamp of the last payment in db
- Volunteers handle
- Subscribe to relay with the last timestamp
- 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