Experimental integration of `fedimint-client` with the Leptos web frontend framework

Overview

CAUTION: highly experimental, the Database implementation is likely horribly broken

Fedimint Client built with Leptos

This repo contains a proof-of-concept of how to integrate fedimint-client with the Leptos web framework to build a PWA. There are still some bugs being worked out, but there is a demo available at https://fedimint-leptos.sirion.io/.

Prerequisites

Check out Fedimint at commit 183bff69f030b89f2cd78dbb91bdecf895048e3e:

git clone https://github.com/fedimint/fedimint
cd fedimint
git checkout 183bff69f030b89f2cd78dbb91bdecf895048e3e

Make sure you have set up local dev environment needed to run fedimint locally

Open terminal and run to open development shell:

nix develop

just build
just mprocs

To get an invite code (you'll need it for next steps) select user process and enter fedimint-cli dev invite-code.

Example

bash-5.1$ fedimint-cli dev invite-code
{
  "invite_code": "fed1132h0j84q5t6qzg8vkxk2lj3dmmzw54flqh3m6z4yrf6ryyerrn6sg36nuratsuf0mjvm84svt40cuqq4waen5te0xyerwt3s9cczuvf6xyurzde59ld2c273s3xm3z3ms552g7x2yu0"
}

The invite code is needed in next step Development.

Development

  1. Open terminal and enter:
nix develop

# only once
npm i

trunk serve

Your output will look like this:

fedimint-leptos-test$ nix develop
💡 Run 'just' for a list of available 'just ...' helper recipes
fedimint-leptos-test$ trunk serve
2023-08-06T12:00:41.373844Z  INFO 📦 starting build
2023-08-06T12:00:41.374062Z  INFO spawning asset pipelines
2023-08-06T12:00:41.522959Z  INFO building fedimint-leptos-test
    Finished dev [unoptimized + debuginfo] target(s) in 0.14s
2023-08-06T12:00:41.673972Z  INFO fetching cargo artifacts
2023-08-06T12:00:41.834730Z  INFO processing WASM for fedimint-leptos-test
2023-08-06T12:00:41.933395Z  INFO calling wasm-bindgen for fedimint-leptos-test
2023-08-06T12:00:42.907392Z  INFO copying generated wasm-bindgen artifacts
2023-08-06T12:00:42.919447Z  INFO applying new distribution
2023-08-06T12:00:42.919736Z  INFO ✅ success
2023-08-06T12:00:42.919871Z  INFO 📡 serving static assets at -> /
2023-08-06T12:00:42.919899Z  INFO 📡 server listening at http://127.0.0.1:8080
  1. Open http://127.0.0.1:8080 in your browser

  2. Enter invite code into to input and submit. Check Pre-requirements above to see how to get it.

You should see "Starting client" in the browser and the JS console should be logging a lot:

Screenshot of config fetching failing

Comments
  • .envrc

    .envrc

    Thanks to direnv no need to enter nix develop "by hand" anymore (see https://zero-to-flakes.com/direnv/)

    You can now cd into the project directory in a terminal and the devshell will be automatically activated.

    ^ https://zero-to-flakes.com/direnv#add-a-envrc

    opened by sectore 2
  • Support Tailwind

    Support Tailwind

    • [x] Support Tailwind
    • [x] Add fonts, basic styles tec. - all based on Fedimints ui
    • [x] Style Join screen
    • [x] Style Send screen
    • [x] Style Receive screen
    • [x] Extend flake.nix to support Node + Tailwind
    • [x] Update CI to install npm dependencies (needed by Tailwind) c15f82b

    Demo

    Screencast from 17.08.2023 14:22:30.webm

    Closes #5 Closes #6 Closes #7

    opened by sectore 2
  • Leptonize ui code

    Leptonize ui code

    Leptos provides some sugaring and build-in things we might want to use:

    • [x] Extract content into components
    • [x] Use context to provide client, balance etc. in components
    • [x] Use Resource, Action, Show, Suspense, ErrorBoundary etc.

    • [x] Add .vscode/settings.json
    opened by sectore 1
  • Add QR scanner to input fields

    Add QR scanner to input fields

    Now every input field has an optional QR scanner. The button probably needs some refactoring (should be a different class than the submit one I guess), but it works and makes the app more usable in practice.

    1. QR scanning disabled by default

    Screenshot 2023-08-20 at 17-19-12 Fedimint Web Client

    1. Scanning, text field is hidden

    Screenshot 2023-08-20 at 17-19-27 Fedimint Web Client

    1. Scan successful, submit is triggered automatically while the text field shows the scanned input.

    Screenshot 2023-08-20 at 17-22-23 Fedimint Web Client

    opened by elsirion 0
  • Copyable text component

    Copyable text component

    Both raw e-cash and lightning invoices need to be copied by the user, we should have a component that displays the data in monospace, has proper line breaking and a copy button, but also allows easy selection of the text.

    opened by elsirion 0
  • Automating screenshots in README

    Automating screenshots in README

    This is probably a total nerd-snipe and not a good idea, but I remembered we are installing Firefox as part of our CI build env anyway since Fedimint uses it for WASM testing, so maybe the screenshot in the README could be automatically generated :laughing:

    opened by elsirion 0
  • Routing

    Routing

    Routes:

    • / Home (Join Federation)
    • /receive-ecash (receive e-cash)
    • /send-ln (send LN invoices)
    • ...

    Docs: https://leptos-rs.github.io/leptos/router/index.html

    Note: Make sure an user needs to joined a federation before navigating to other routes. Special case: Deep-links!

    opened by sectore 0
Owner
Cypherpunk, bitcoiner, tinkerer
null
Leptos integration with Golden Layout.

Leptos Golden Layout Leptos integration with Golden Layout. This has many features missing but covers the basics for integrating leptos with golden la

Ari Seyhun 3 Oct 23, 2023
A website for the Leptos Web Framework!

Leptos Website A Repo for the public facing Leptos website. Still a WIP. Client Side Rendering This example cannot be built as a trunk standalone CSR-

Leptos 7 May 2, 2023
JiaShiwen 12 Nov 5, 2022
A Nix template for full-stack web apps in Rust using Leptos

leptos-fullstack A Nix template for full-stack web apps in Rust using Leptos. Tech used: Leptos full-stack framework server functions ssr + hydration

Sridhar Ratnakumar 6 Aug 4, 2023
Simple template to use csr and ssr leptos with tauri for ios/android/windows/macos/linux and web dev

Tailwind-Leptos-Tauri Template Simple template to use csr and ssr leptos with tauri for ios/android/windows/macos/linux and web dev Just clone the rep

Victor Batarse 11 Mar 10, 2024
A binary that bootstraps a Leptos application with client side rendering, tailwind, and vercel

create-leptos-csr-tw This CLI provides a quick setup to start building web applications using the Leptos web framework integrated with TailwindCSS. It

Matthew 3 Nov 3, 2023
Black-box integration tests for your REST API using the Rust and its test framework

restest Black-box integration test for REST APIs in Rust. This crate provides the [assert_api] macro that allows to declaratively test, given a certai

IOmentum 10 Nov 23, 2022
easy-to-use immediate mode client side Rust web framework

An immediate mode web frontend library written in Rust. It builds up VDOM for not having to run too many DOM operations, but as it runs every time any

null 22 Dec 17, 2022
A simple solution for scoped styles in Leptos

Styled: Easy Styling for Leptos Components If you're looking for an easy way to apply scoped styles to your Leptos components, Styled is the Leptos ma

Eran Boodnero 8 Mar 5, 2023
A formatter for the leptos view! macro

leptosfmt A formatter for the leptos view! macro All notable changes are documented in: CHANGELOG.md Install cargo install leptosfmt or for trying out

Bram 13 Apr 4, 2023
A zero-config leptos component to display markdown

A port of yew-markdown using leptos ! Usage You can use this component to render both static and dynamic markdown. Static markdown use leptos::*; {

Antonin Peronnet 4 Aug 4, 2023
Leptos server signals synced through Server-Sent-Events (SSE)

Leptos Server Sent Events Server signals are leptos signals kept in sync with the server through server-sent-events (SSE). The signals are read-only o

messense 13 Oct 3, 2023
A UI component library for Leptos, based on Tailwind Elements.

leptos-twelements A UI component library for Leptos, based on Tailwind Elements. Installation (for projects using cargo leptos) Use the nightly rust c

Sebastian Meßmer 4 Oct 20, 2023
💫 List-rendering component utilizing FLIP position transitions for Leptos

<AnimatedFor /> component for Leptos FLIP animations for element and component groups inspired by Vue's <TransitionGroup>. This crate exports a compon

Kajetan Welc 6 Nov 13, 2023
A fully extensible command interface to navigate around your leptos application.

leptos-kbar A fully extensible command interface to navigate around your leptos application. See demo: https://leptos-kbar.vercel.app/ Roadmap leptos-

null 7 Mar 10, 2024
a (soon to be) calculator frontend and a (soon to be optimizing) toy IR backend

Zach-Calc Zach-Calc is a pet project for me to try and better understand pattern matching, optimization, IRs, and the likes. ./libs/* contains librari

Zachary Petti 0 Jan 6, 2022
Macchina - A system information frontend, with an (unhealthy) emphasis on performance.

macchina Fast, minimal and customizable system information frontend. Linux • macOS • Windows • NetBSD • FreeBSD • OpenWrt • Android About macchina let

Macchina CLI 682 Jan 5, 2023
Simple TUI frontend for paru,

parui Simple TUI frontend for paru. Images Keybinds parui adopts vim-like keybinds. Key Mode Action <Escape> Insert Enter Select Mode <Return> Insert

Qther 25 Jan 3, 2023
Yet another command-line chat GPT frontend written in Rust.

gpterm Yet another command-line chat GPT frontend written in Rust. Features Stream output with typing effect Store chat messages/history Context aware

Makis Christou 22 May 4, 2023