Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
597085d
Add prism route and update wallet interface
johngribbin Aug 30, 2024
9e25885
Add all methods to PrismInterface
johngribbin Sep 4, 2024
ecfe233
Add ItemsList to prism route with placeholder content
johngribbin Sep 4, 2024
7ac6513
Add first pass at create prism page
johngribbin Sep 6, 2024
4d7ab85
Add create prism functionality
johngribbin Sep 7, 2024
ede8c26
Add prisms to the dexie db
johngribbin Sep 8, 2024
3564bcb
Update styling of prism row component
johngribbin Sep 8, 2024
e0b2fb6
Add prism details page with delete prism button
johngribbin Sep 9, 2024
568b4af
Add delete prism functionality
johngribbin Sep 10, 2024
ecc0757
Fix add prism db bug
johngribbin Sep 10, 2024
00a64eb
Add members to prism details and tweak styles
johngribbin Sep 11, 2024
ca58bd2
Add modal for delete prism and fetch the prism bindings
johngribbin Sep 12, 2024
cb65970
Update db to include prismBindings
johngribbin Sep 13, 2024
319b12a
Update worker to add bindings to prisms
johngribbin Sep 23, 2024
dbe1044
Add toggle binding functionality and clean up logic
johngribbin Sep 24, 2024
eee75db
Fix UI bug during prism delete
johngribbin Sep 24, 2024
7a8c90a
Update binding toggle to prevent same offer being bound to two prisms
johngribbin Sep 25, 2024
884511b
Remove log
johngribbin Sep 25, 2024
25f7e33
Add pay button that links to the offer page
johngribbin Sep 25, 2024
0c701dc
Add status and update TODO comments
johngribbin Sep 25, 2024
ff6aa5f
Add disabled states to the prism components
johngribbin Sep 26, 2024
c865fdb
Tweak UI to only render active offers with toggle error messaging
johngribbin Sep 26, 2024
73e06ca
Update toggle binding functionality and improve render of create page
johngribbin Sep 28, 2024
5fd4073
Update logic on prism row to render more than one binding
johngribbin Sep 28, 2024
df77850
Remove binding from Prism type and update UI where needed
johngribbin Sep 28, 2024
9b6d680
Update prism type in db
johngribbin Sep 28, 2024
4d26b3c
Fix bug when toggling last member in list
johngribbin Sep 28, 2024
247b7a5
Add remove member functionality to create flow
johngribbin Sep 29, 2024
9ba77db
Clean up unused variables
johngribbin Sep 29, 2024
e371781
Update offers route to render prism binding icons
johngribbin Sep 29, 2024
6c45dc8
Fix fees incurred binding issue
johngribbin Sep 30, 2024
1d14160
Present outlayFactor as member payout %
johngribbin Sep 30, 2024
64215d8
Remove log
johngribbin Sep 30, 2024
f54657f
Revert changes
johngribbin Sep 30, 2024
ef2fcf8
Add disabled prop to toggle
johngribbin Sep 30, 2024
af7cb5f
Add date as filter option for prism list
johngribbin Sep 30, 2024
abc0f10
Clean up filters
johngribbin Sep 30, 2024
8464fa7
Add multi lang support
johngribbin Sep 30, 2024
65a4d08
More lang support updates
johngribbin Sep 30, 2024
7ac766b
Translations
johngribbin Sep 30, 2024
5ef99c0
Increment db version
johngribbin Sep 30, 2024
289d975
initial QA updates
johngribbin Oct 1, 2024
7ed7683
Add destination scanner functionality
johngribbin Oct 2, 2024
1e2efdd
Handle large member descriptuons gracefully
johngribbin Oct 2, 2024
7538455
Add missing translations
johngribbin Oct 2, 2024
afcb544
Update API method names.
farscapian Oct 2, 2024
9da54d9
Merge pull request #283 from farscapian/feat/prism-plugin-ui
johngribbin Oct 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "remote",
"version": "2.3.0",
"version": "2.3.0-0.1.0",
"scripts": {
"dev": "vite dev",
"dev-https": "vite dev --mode https",
Expand Down
103 changes: 103 additions & 0 deletions src/lib/@types/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export type Plugin = {
dynamic: boolean
}

/* -----
CLBOSS
----- */
export type ClbossStatus = {
channel_candidates: {
id: string
Expand Down Expand Up @@ -52,3 +55,103 @@ export type ClbossStatus = {
[key: string]: string
}
}

/* -----
Prism
----- */
export type PrismMember = {
member_id?: string
description: string
destination: string
split: number
fees_incurred_by: 'local' | 'remote' | string
payout_threshold_msat: number
}

export type PrismType = {
id?: string // prism_id
prism_id: string
description: string
timestamp: number
outlay_factor: number
prism_members: PrismMember[]
}

export interface ListPrismsResponse {
prisms: PrismType[]
}

export type DeletedPrism = {
key: string[] // Array of strings representing key elements
generation: number // Generation number (possibly version control?)
hex: string // Hexadecimal representation of some data
string: string // Stringified JSON object (containing prism details)
}

export interface DeletePrismResponse {
deleted: DeletedPrism
}

export type PrismBinding = {
id?: string // prism_id
offer_id: string
prism_id: string
timestamp: number
member_outlays: [
{
member_id: string
outlay_msat: number
},
{
member_id: string
outlay_msat: number
},
{
member_id: string
outlay_msat: number
}
]
}

export interface ListPrismBindingsResponse {
bolt12_prism_bindings: PrismBinding[]
}

export type CreateBindingResponse = {
status: 'must-replace' | string
timestamp: 1726125745
offer_id: string
prism_id: string
prism_binding_key: string[]
prism_members: PrismMember[]
}

export type DeletedBinding = {
key: string[]
generation: number
hex: string
string: string // JSON object
}

export type DeleteBindingResponse = {
binding_removed: DeletedBinding
}

type Payout = {
destination: string
payment_hash: string
created_at: number
parts: number
amount_msat: number
amount_sent_msat: number
payment_preimage: string
status: string
}

export type PrismMemberPayouts = {
[key: string]: Payout
}

export interface PrismPayResponse {
prism_member_payouts: PrismMemberPayouts
}
2 changes: 1 addition & 1 deletion src/lib/components/TextInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div style="width: {width};" class="flex flex-col relative">
{#if label}
<label
class="{micro ? 'text-xs' : 'text-sm'} w-1/2 text-inherit text-neutral-300 mb-2 font-semibold"
class="{micro ? 'text-xs' : 'text-sm'} w-3/4 text-inherit text-neutral-300 mb-2 font-semibold"
for={name}
>
{label}
Expand Down
9 changes: 8 additions & 1 deletion src/lib/components/Toggle.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

export let toggled = false
export let large = false
export let disabled = false

const roundedStyles = large
? 'peer-checked:before:translate-x-6 before:h-5 before:w-5 before:left-[2px] before:bottom-[2px]'
Expand All @@ -24,7 +25,13 @@
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
<label on:click|stopPropagation class="relative inline-block m-0 {sliderStyles}">
<input bind:checked={toggled} on:change class="opacity-0 w-0 h-0 peer" type="checkbox" />
<input
{disabled}
bind:checked={toggled}
on:change
class="opacity-0 w-0 h-0 peer"
type="checkbox"
/>
<span
class="absolute cursor-pointer top-0 left-0 right-0 bottom-0 bg-neutral-300 peer-checked:bg-purple-500 transition-all rounded-full before:absolute before:bg-white before:transition-all before:rounded-full before:shadow-md {roundedStyles}"
/>
Expand Down
9 changes: 7 additions & 2 deletions src/lib/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type { ExchangeRate } from '../@types/exchange-rates.js'
import type { Node } from '../@types/nodes.js'
import type { Payment } from '$lib/@types/payments.js'
import type { Tag } from '$lib/@types/metadata.js'
import type { PrismBinding, PrismType } from '$lib/@types/plugins.js'

class DB extends Dexie {
channels!: Table<Channel>
Expand All @@ -29,11 +30,13 @@ class DB extends Dexie {
utxos!: Table<Utxo>
wallets!: Table<Wallet>
withdrawals!: Table<Withdrawal>
prisms!: Table<PrismType>
prismBindings!: Table<PrismBinding>

constructor() {
super('Clams Remote')

this.version(1).stores({
this.version(2).stores({
channels:
'&[id+walletId], id, walletId, shortId, balanceLocal, balanceRemote, peerId, status, opener, [id+opener], [fundingTransactionId+fundingOutput], [fundingTransactionId+fundingOutput+walletId], closeTo, *metadata.tags, metadata.contact',
contacts: '&id, name, npub',
Expand All @@ -53,7 +56,9 @@ class DB extends Dexie {
utxos: '&id, walletId, txid, timestamp, spendingTxid, *metadata.tags, metadata.contact',
wallets: '&id, type, label, nodeId, *metadata.tags, metadata.contact, createdAt',
withdrawals:
'&id, walletId, destination, timestamp, amount, fee, *metadata.tags, metadata.contact'
'&id, walletId, destination, timestamp, amount, fee, *metadata.tags, metadata.contact',
prisms: `&id, prism_id, description, timestamp, outlay_factor, prism_members`,
prismBindings: `&id, prism_id, offer_id, timestamp, member_outlays`
})
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/lib/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,15 @@ export const routeSorters = (route: string): Sorters => {
options: [timestamp]
}
}
case 'prisms': {
const timestamp = timestampSorter()

return {
applied: { key: timestamp.key, direction: timestamp.direction },
options: [timestamp]
}
}

default: {
throw new Error(`Unknown route: ${route}`)
}
Expand Down
26 changes: 25 additions & 1 deletion src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
"/plugins/clboss": {
"title": "CLBOSS"
},
"/plugins/prism": {
"title": "Prisms"
},
"/plugins/prism/create": {
"title": "Create Prism"
},
"/settings": {
"title": "Settings"
},
Expand Down Expand Up @@ -241,6 +247,8 @@
"no_forwards_filtered": "No forwards match your current filters.",
"no_wallets": "No wallets here, add a wallet to get started.",
"no_wallets_filtered": "No wallets match your current filters.",
"no_prisms": "No prisms here, create a prism to get started.",
"no_prisms_filtered": "No prisms march your current filters",
"destination": "Destination",
"unconfirmed": "Spendable (unconfirmed)",
"confirmed": "Spendable",
Expand Down Expand Up @@ -535,7 +543,23 @@
"ignoring_onchain_funds_until": "Ignoring onchain funds until",
"toggle_clboss_permissions": "Toggle CLBOSS permissions on a per channel basis",
"node_id": "Node ID",
"permissions": "Permissions"
"permissions": "Permissions",
"prism": "Prism",
"offer_bound": "offer bound",
"name": "Name",
"outlay_factor": "Outlay factor",
"split": "Split",
"payout_threshold": "Payout threshold (msats)",
"fees_incurred_by": "Fees incurred by",
"binding": "Binding",
"member": "Member",
"members": "Members",
"offers": "Offers",
"delete_prism_warning": "Are you sure you want to delete this Prism?",
"no_active_offers_found": "No active offers found",
"create_one": "create one",
"prism_name_placeholder": "Tips for the band",
"member_destination_placeholder": "BOLT12 offer or node pubkey"
},
"messages": {
"closing_channel": "Closing a channel will publish an onchain transaction and settle the current channel balances.",
Expand Down
26 changes: 25 additions & 1 deletion src/lib/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
"/plugins/clboss": {
"title": "CLBOSS"
},
"/plugins/prism": {
"title": "Prisms"
},
"/plugins/prism/create": {
"title": "Crear Prism"
},
"/settings": {
"title": "Configuración"
},
Expand Down Expand Up @@ -240,6 +246,8 @@
"no_forwards_filtered": "No hay reenvios que coincidan con tus filtros actuales.",
"no_wallets": "No hay billeteras aquí, agrega una billetera para comenzar.",
"no_wallets_filtered": "No hay billeteras que coincidan con tus filtros actuales.",
"no_prisms": "No hay Prisms aquí, crea un Prism para comenzar.",
"no_prisms_filtered": "No hay Prisms que coincidan con tus filtros actuales.",
"destination": "Destino",
"unconfirmed": "Para gastar (sin confirmar)",
"confirmed": "Para gastar",
Expand Down Expand Up @@ -534,7 +542,23 @@
"ignoring_onchain_funds_until": "Ignorando fondos en cadena hasta",
"toggle_clboss_permissions": "Alternar permisos de CLBOSS por canal",
"node_id": "ID del nodo",
"permissions": "Permisos"
"permissions": "Permisos",
"prism": "Prism",
"offer_bound": "límite de oferta",
"name": "Nombre",
"outlay_factor": "Factor de desembolso",
"split": "División",
"payout_threshold": "Umbral de pago (msats)",
"fees_incurred_by": "Comisiones asumidas por",
"binding": "Vinculante",
"member": "Miembro",
"members": "Miembros",
"offers": "Ofertas",
"delete_prism_warning": "¿Estás seguro de que deseas eliminar este Prism?",
"no_active_offers_found": "No se encontraron ofertas activas",
"create_one": "crear una",
"prism_name_placeholder": "Consejos para la banda",
"member_destination_placeholder": "Oferta BOLT12 o clave pública del nodo"
},
"messages": {
"closing_channel": "Cerrar un canal publicará una transacción en la cadena y liquidará los saldos actuales del canal.",
Expand Down
4 changes: 4 additions & 0 deletions src/lib/icons/prism.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default `<svg width="100%" height="100%" viewBox="0 0 73 71" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M69.2636 54.6851L38.6934 68.5069C37.2612 69.1542 35.6195 69.1542 34.1875 68.5058L3.60725 54.6681C2.06943 53.9722 1.52367 52.0625 2.46153 50.6591L34.167 3.21462C35.2495 1.59485 37.6306 1.59518 38.7126 3.21528L70.4105 50.6765C71.348 52.0802 70.8014 53.9897 69.2636 54.6851Z" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M36.4375 2.71703V69" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>`
6 changes: 5 additions & 1 deletion src/lib/wallets/coreln/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { parseNodeAddress } from '$lib/address.js'
import handleError from './error.js'
import Network from './network.js'
import Clboss from './clboss.js'
import Prism from './prism.js'
import { createSocket } from './worker.js'

import type {
Expand All @@ -40,7 +41,8 @@ import type {
NetworkInterface,
ConnectionStatus,
PluginsInterface,
ClbossInterface
ClbossInterface,
PrismInterface
} from '../interfaces.js'
import Plugins from './plugins.js'

Expand Down Expand Up @@ -69,6 +71,7 @@ class CoreLightning implements CorelnConnectionInterface {
network: NetworkInterface
plugins: PluginsInterface
clboss: ClbossInterface
prism: PrismInterface

constructor(
walletId: string,
Expand Down Expand Up @@ -181,6 +184,7 @@ class CoreLightning implements CorelnConnectionInterface {
this.network = new Network(this)
this.plugins = new Plugins(this)
this.clboss = new Clboss(this)
this.prism = new Prism(this)
}

updateToken(token: string): void {
Expand Down
Loading