Skip to content

Commit 9e84b8e

Browse files
committed
JS code for Spark
1 parent 32f4706 commit 9e84b8e

File tree

7 files changed

+77
-3
lines changed

7 files changed

+77
-3
lines changed

wallets/client/protocols/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as blink from './blink'
55
import * as webln from './webln'
66
import * as lnc from './lnc'
77
import * as clnRest from './clnRest'
8+
import * as spark from './spark'
89

910
export * from './util'
1011

@@ -54,5 +55,6 @@ export default [
5455
blink,
5556
webln,
5657
lnc,
57-
clnRest
58+
clnRest,
59+
spark
5860
]

wallets/client/protocols/spark.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export const name = 'SPARK'
2+
3+
export async function sendPayment (bolt11, { mnemonic }, { signal }) {
4+
// TODO: implement
5+
}
6+
7+
export async function testSendPayment (config, { signal }) {}

wallets/lib/protocols/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import phoenixdSuite from './phoenixd'
88
import blinkSuite from './blink'
99
import webln from './webln'
1010
import clink from './clink'
11+
import sparkSuite from './spark'
1112

1213
/**
1314
* Protocol names as used in the database
@@ -47,5 +48,6 @@ export default [
4748
...lnbitsSuite,
4849
...blinkSuite,
4950
webln,
50-
clink
51+
clink,
52+
...sparkSuite
5153
]

wallets/lib/protocols/spark.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { bip39Validator, externalLightningAddressValidator } from '@/wallets/lib/validate'
2+
3+
// Spark
4+
// https://github.com/breez/spark-sdk
5+
// https://sdk-doc-spark.breez.technology/
6+
7+
export default [
8+
{
9+
name: 'Spark',
10+
send: true,
11+
displayName: 'Spark',
12+
logName: 'SPARK',
13+
fields: [
14+
{
15+
name: 'mnemonic',
16+
label: 'mnemonic',
17+
type: 'password',
18+
required: true,
19+
validate: bip39Validator(),
20+
encrypt: true
21+
}
22+
],
23+
relationName: 'walletSendSpark'
24+
},
25+
{
26+
name: 'Spark',
27+
send: false,
28+
displayName: 'Spark',
29+
logName: 'SPARK',
30+
fields: [
31+
{
32+
name: 'address',
33+
label: 'address',
34+
type: 'text',
35+
required: true,
36+
validate: externalLightningAddressValidator
37+
}
38+
],
39+
relationName: 'walletRecvSpark'
40+
}
41+
]

wallets/lib/wallets.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,9 @@
168168
"displayName": "Blitz Wallet",
169169
"image": "/wallets/blitz.png",
170170
"url": "https://blitz-wallet.com/"
171+
},
172+
{
173+
"name": "SPARK",
174+
"displayName": "Spark"
171175
}
172176
]

wallets/server/protocols/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as phoenixd from './phoenixd'
66
import * as blink from './blink'
77
import * as lndGrpc from './lndGrpc'
88
import * as clink from './clink'
9+
import * as spark from './spark'
910

1011
export * from './util'
1112

@@ -58,5 +59,6 @@ export default [
5859
phoenixd,
5960
blink,
6061
lndGrpc,
61-
clink
62+
clink,
63+
spark
6264
]

wallets/server/protocols/spark.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export const name = 'SPARK'
2+
3+
export async function createInvoice (
4+
{ msats, description, descriptionHash, expiry },
5+
{ address },
6+
{ signal }
7+
) {
8+
// TODO: implement
9+
}
10+
11+
export async function testCreateInvoice ({ address }, { signal }) {
12+
return await createInvoice(
13+
{ msats: 1000, description: 'SN test invoice', expiry: 1 },
14+
{ address },
15+
{ signal })
16+
}

0 commit comments

Comments
 (0)