Skip to content

Commit d0998b4

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

File tree

7 files changed

+75
-3
lines changed

7 files changed

+75
-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: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
fields: [
13+
{
14+
name: 'mnemonic',
15+
label: 'mnemonic',
16+
type: 'password',
17+
required: true,
18+
validate: bip39Validator(),
19+
encrypt: true
20+
}
21+
],
22+
relationName: 'walletSendSpark'
23+
},
24+
{
25+
name: 'SPARK',
26+
send: false,
27+
displayName: 'Spark',
28+
fields: [
29+
{
30+
name: 'address',
31+
label: 'address',
32+
type: 'text',
33+
required: true,
34+
validate: externalLightningAddressValidator
35+
}
36+
],
37+
relationName: 'walletRecvSpark'
38+
}
39+
]

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)