Skip to content

Commit a3adb0b

Browse files
authored
Merge pull request #288 from clams-tech/release/2.4.0
Release 2.4.0
2 parents 344232d + 7a91bb6 commit a3adb0b

File tree

27 files changed

+1377
-152
lines changed

27 files changed

+1377
-152
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "remote",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"scripts": {
55
"dev": "vite dev",
66
"dev-https": "vite dev --mode https",
@@ -59,7 +59,7 @@
5959
"bech32": "^2.0.0",
6060
"big.js": "^6.2.1",
6161
"bitcoinjs-lib": "^6.1.3",
62-
"bolt12-decoder": "^0.0.9",
62+
"bolt12-decoder": "^1.0.0",
6363
"chart.js": "^4.3.0",
6464
"crypto-js": "^4.2.0",
6565
"date-fns": "^2.30.0",

src/lib/@types/plugins.ts

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ export type Plugin = {
99
dynamic: boolean
1010
}
1111

12+
/* -----
13+
CLBOSS
14+
----- */
1215
export type ClbossStatus = {
1316
channel_candidates: {
1417
id: string
@@ -52,3 +55,103 @@ export type ClbossStatus = {
5255
[key: string]: string
5356
}
5457
}
58+
59+
/* -----
60+
Prism
61+
----- */
62+
export type PrismMember = {
63+
member_id?: string
64+
description: string
65+
destination: string
66+
split: number
67+
fees_incurred_by: 'local' | 'remote' | string
68+
payout_threshold_msat: number
69+
}
70+
71+
export type PrismType = {
72+
id?: string // prism_id
73+
prism_id: string
74+
description: string
75+
timestamp: number
76+
outlay_factor: number
77+
prism_members: PrismMember[]
78+
}
79+
80+
export interface ListPrismsResponse {
81+
prisms: PrismType[]
82+
}
83+
84+
export type DeletedPrism = {
85+
key: string[] // Array of strings representing key elements
86+
generation: number // Generation number (possibly version control?)
87+
hex: string // Hexadecimal representation of some data
88+
string: string // Stringified JSON object (containing prism details)
89+
}
90+
91+
export interface DeletePrismResponse {
92+
deleted: DeletedPrism
93+
}
94+
95+
export type PrismBinding = {
96+
id?: string // prism_id
97+
offer_id: string
98+
prism_id: string
99+
timestamp: number
100+
member_outlays: [
101+
{
102+
member_id: string
103+
outlay_msat: number
104+
},
105+
{
106+
member_id: string
107+
outlay_msat: number
108+
},
109+
{
110+
member_id: string
111+
outlay_msat: number
112+
}
113+
]
114+
}
115+
116+
export interface ListPrismBindingsResponse {
117+
bolt12_prism_bindings: PrismBinding[]
118+
}
119+
120+
export type CreateBindingResponse = {
121+
status: 'must-replace' | string
122+
timestamp: 1726125745
123+
offer_id: string
124+
prism_id: string
125+
prism_binding_key: string[]
126+
prism_members: PrismMember[]
127+
}
128+
129+
export type DeletedBinding = {
130+
key: string[]
131+
generation: number
132+
hex: string
133+
string: string // JSON object
134+
}
135+
136+
export type DeleteBindingResponse = {
137+
binding_removed: DeletedBinding
138+
}
139+
140+
type Payout = {
141+
destination: string
142+
payment_hash: string
143+
created_at: number
144+
parts: number
145+
amount_msat: number
146+
amount_sent_msat: number
147+
payment_preimage: string
148+
status: string
149+
}
150+
151+
export type PrismMemberPayouts = {
152+
[key: string]: Payout
153+
}
154+
155+
export interface PrismPayResponse {
156+
prism_member_payouts: PrismMemberPayouts
157+
}

src/lib/components/TextInput.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<div style="width: {width};" class="flex flex-col relative">
4040
{#if label}
4141
<label
42-
class="{micro ? 'text-xs' : 'text-sm'} w-1/2 text-inherit text-neutral-300 mb-2 font-semibold"
42+
class="{micro ? 'text-xs' : 'text-sm'} w-3/4 text-inherit text-neutral-300 mb-2 font-semibold"
4343
for={name}
4444
>
4545
{label}

src/lib/components/Toggle.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
export let toggled = false
55
export let large = false
6+
export let disabled = false
67
78
const roundedStyles = large
89
? 'peer-checked:before:translate-x-6 before:h-5 before:w-5 before:left-[2px] before:bottom-[2px]'
@@ -24,7 +25,13 @@
2425
<!-- svelte-ignore a11y-click-events-have-key-events -->
2526
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
2627
<label on:click|stopPropagation class="relative inline-block m-0 {sliderStyles}">
27-
<input bind:checked={toggled} on:change class="opacity-0 w-0 h-0 peer" type="checkbox" />
28+
<input
29+
{disabled}
30+
bind:checked={toggled}
31+
on:change
32+
class="opacity-0 w-0 h-0 peer"
33+
type="checkbox"
34+
/>
2835
<span
2936
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}"
3037
/>

src/lib/db/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import type { ExchangeRate } from '../@types/exchange-rates.js'
1313
import type { Node } from '../@types/nodes.js'
1414
import type { Payment } from '$lib/@types/payments.js'
1515
import type { Tag } from '$lib/@types/metadata.js'
16+
import type { PrismBinding, PrismType } from '$lib/@types/plugins.js'
1617

1718
class DB extends Dexie {
1819
channels!: Table<Channel>
@@ -29,11 +30,13 @@ class DB extends Dexie {
2930
utxos!: Table<Utxo>
3031
wallets!: Table<Wallet>
3132
withdrawals!: Table<Withdrawal>
33+
prisms!: Table<PrismType>
34+
prismBindings!: Table<PrismBinding>
3235

3336
constructor() {
3437
super('Clams Remote')
3538

36-
this.version(1).stores({
39+
this.version(2).stores({
3740
channels:
3841
'&[id+walletId], id, walletId, shortId, balanceLocal, balanceRemote, peerId, status, opener, [id+opener], [fundingTransactionId+fundingOutput], [fundingTransactionId+fundingOutput+walletId], closeTo, *metadata.tags, metadata.contact',
3942
contacts: '&id, name, npub',
@@ -53,7 +56,9 @@ class DB extends Dexie {
5356
utxos: '&id, walletId, txid, timestamp, spendingTxid, *metadata.tags, metadata.contact',
5457
wallets: '&id, type, label, nodeId, *metadata.tags, metadata.contact, createdAt',
5558
withdrawals:
56-
'&id, walletId, destination, timestamp, amount, fee, *metadata.tags, metadata.contact'
59+
'&id, walletId, destination, timestamp, amount, fee, *metadata.tags, metadata.contact',
60+
prisms: `&id, prism_id, description, timestamp, outlay_factor, prism_members`,
61+
prismBindings: `&id, prism_id, offer_id, timestamp, member_outlays`
5762
})
5863
}
5964
}

src/lib/filters.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,15 @@ export const routeSorters = (route: string): Sorters => {
383383
options: [timestamp]
384384
}
385385
}
386+
case 'prisms': {
387+
const timestamp = timestampSorter()
388+
389+
return {
390+
applied: { key: timestamp.key, direction: timestamp.direction },
391+
options: [timestamp]
392+
}
393+
}
394+
386395
default: {
387396
throw new Error(`Unknown route: ${route}`)
388397
}

src/lib/i18n/en.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
"/plugins/clboss": {
4141
"title": "CLBOSS"
4242
},
43+
"/plugins/prism": {
44+
"title": "Prisms"
45+
},
46+
"/plugins/prism/create": {
47+
"title": "Create Prism"
48+
},
4349
"/settings": {
4450
"title": "Settings"
4551
},
@@ -241,6 +247,8 @@
241247
"no_forwards_filtered": "No forwards match your current filters.",
242248
"no_wallets": "No wallets here, add a wallet to get started.",
243249
"no_wallets_filtered": "No wallets match your current filters.",
250+
"no_prisms": "No prisms here, create a prism to get started.",
251+
"no_prisms_filtered": "No prisms march your current filters",
244252
"destination": "Destination",
245253
"unconfirmed": "Spendable (unconfirmed)",
246254
"confirmed": "Spendable",
@@ -535,7 +543,23 @@
535543
"ignoring_onchain_funds_until": "Ignoring onchain funds until",
536544
"toggle_clboss_permissions": "Toggle CLBOSS permissions on a per channel basis",
537545
"node_id": "Node ID",
538-
"permissions": "Permissions"
546+
"permissions": "Permissions",
547+
"prism": "Prism",
548+
"offer_bound": "offer bound",
549+
"name": "Name",
550+
"outlay_factor": "Outlay factor",
551+
"split": "Split",
552+
"payout_threshold": "Payout threshold (msats)",
553+
"fees_incurred_by": "Fees incurred by",
554+
"binding": "Binding",
555+
"member": "Member",
556+
"members": "Members",
557+
"offers": "Offers",
558+
"delete_prism_warning": "Are you sure you want to delete this Prism?",
559+
"no_active_offers_found": "No active offers found",
560+
"create_one": "create one",
561+
"prism_name_placeholder": "Tips for the band",
562+
"member_destination_placeholder": "BOLT12 offer or node pubkey"
539563
},
540564
"messages": {
541565
"closing_channel": "Closing a channel will publish an onchain transaction and settle the current channel balances.",

src/lib/i18n/es.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
"/plugins/clboss": {
4141
"title": "CLBOSS"
4242
},
43+
"/plugins/prism": {
44+
"title": "Prisms"
45+
},
46+
"/plugins/prism/create": {
47+
"title": "Crear Prism"
48+
},
4349
"/settings": {
4450
"title": "Configuración"
4551
},
@@ -240,6 +246,8 @@
240246
"no_forwards_filtered": "No hay reenvios que coincidan con tus filtros actuales.",
241247
"no_wallets": "No hay billeteras aquí, agrega una billetera para comenzar.",
242248
"no_wallets_filtered": "No hay billeteras que coincidan con tus filtros actuales.",
249+
"no_prisms": "No hay Prisms aquí, crea un Prism para comenzar.",
250+
"no_prisms_filtered": "No hay Prisms que coincidan con tus filtros actuales.",
243251
"destination": "Destino",
244252
"unconfirmed": "Para gastar (sin confirmar)",
245253
"confirmed": "Para gastar",
@@ -534,7 +542,23 @@
534542
"ignoring_onchain_funds_until": "Ignorando fondos en cadena hasta",
535543
"toggle_clboss_permissions": "Alternar permisos de CLBOSS por canal",
536544
"node_id": "ID del nodo",
537-
"permissions": "Permisos"
545+
"permissions": "Permisos",
546+
"prism": "Prism",
547+
"offer_bound": "límite de oferta",
548+
"name": "Nombre",
549+
"outlay_factor": "Factor de desembolso",
550+
"split": "División",
551+
"payout_threshold": "Umbral de pago (msats)",
552+
"fees_incurred_by": "Comisiones asumidas por",
553+
"binding": "Vinculante",
554+
"member": "Miembro",
555+
"members": "Miembros",
556+
"offers": "Ofertas",
557+
"delete_prism_warning": "¿Estás seguro de que deseas eliminar este Prism?",
558+
"no_active_offers_found": "No se encontraron ofertas activas",
559+
"create_one": "crear una",
560+
"prism_name_placeholder": "Consejos para la banda",
561+
"member_destination_placeholder": "Oferta BOLT12 o clave pública del nodo"
538562
},
539563
"messages": {
540564
"closing_channel": "Cerrar un canal publicará una transacción en la cadena y liquidará los saldos actuales del canal.",

src/lib/icons/prism.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default `<svg width="100%" height="100%" viewBox="0 0 73 71" fill="none" xmlns="http://www.w3.org/2000/svg">
2+
<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"/>
3+
<path d="M36.4375 2.71703V69" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
4+
</svg>`

0 commit comments

Comments
 (0)