File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import {
1010 SignedTransaction ,
1111 ITransactionRecipient ,
1212} from '../' ;
13- import { isBolt11Invoice , LIGHTNING_INVOICE } from '../lightning' ;
13+ import { isBolt11Invoice } from '../lightning' ;
1414
1515import { Ofc } from './ofc' ;
1616
@@ -76,25 +76,19 @@ export class OfcToken extends Ofc {
7676 throw new Error ( `invalid argument - lightning invoice is only supported for bitcoin` ) ;
7777 }
7878
79- // amount for bolt11 invoices is either 'invoice' or a non-zero bigint
80- if ( recipient . amount === LIGHTNING_INVOICE ) {
81- return ;
82- }
83- // try to parse the amount as a bigint
79+ // amount for bolt11 invoices must be a non-zero bigint
8480 let amount : bigint ;
8581 try {
8682 amount = BigInt ( recipient . amount ) ;
8783 } catch ( e ) {
8884 throw new Error (
89- `invalid argument ${ recipient . amount } for amount - lightning invoice amount must be >= 0 or ${ LIGHTNING_INVOICE } `
85+ `invalid argument ${ recipient . amount } for amount - lightning invoice amount must be a non-zero bigint `
9086 ) ;
9187 }
9288 if ( amount > 0n ) {
9389 return ;
9490 }
95- throw new Error (
96- `invalid argument for amount - lightning invoice amount must be a non-zero bigint or ${ LIGHTNING_INVOICE } `
97- ) ;
91+ throw new Error ( `invalid argument for amount - lightning invoice amount must be a non-zero bigint` ) ;
9892 }
9993
10094 super . checkRecipient ( recipient ) ;
Original file line number Diff line number Diff line change 1- export const LIGHTNING_INVOICE = 'invoice' ;
2-
31export function isBolt11Invoice ( value : unknown ) : value is string {
42 if ( typeof value !== 'string' ) {
53 return false ;
You can’t perform that action at this time.
0 commit comments