File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 11import init , { defaultConfig , connect } from '@breeztech/breez-sdk-spark'
2- import { WalletValidationError } from '@/wallets/client/errors'
32import { getUsername } from '@/wallets/lib/protocols/spark'
43
54export const name = 'SPARK'
@@ -28,17 +27,15 @@ export async function testSendPayment ({ mnemonic }, { signal }) {
2827 paymentMethod : { type : 'sparkAddress' }
2928 } )
3029
31- // check and register lightning address here so we can test it in the next step
30+ // check and register lightning address here
31+ // if we haven't already so we can test it in the next step
3232 // https://sdk-doc-spark.breez.technology/guide/receive_lnurl_pay.html
3333 const username = getUsername ( sparkAddress )
3434
35- // TODO(spark): don't check lightning address again if we already registered it
3635 const available = await sdk . checkLightningAddressAvailable ( { username } )
37- if ( ! available ) {
38- // TODO(spark): better error message for user? but this should never happen with randomly generated mnemonics, right?
39- throw new WalletValidationError ( 'lightning address unavailable' )
36+ if ( available ) {
37+ await sdk . registerLightningAddress ( { username, description : 'Running Spark SDK' } )
4038 }
41- await sdk . registerLightningAddress ( { username, description : 'Running Spark SDK' } )
4239
4340 sdk . disconnect ( )
4441
You can’t perform that action at this time.
0 commit comments