amount input
This commit is contained in:
parent
3255730ae2
commit
f5eb1f3253
5 changed files with 10 additions and 8 deletions
|
|
@ -1405,7 +1405,7 @@ The nostr server will send back a message response, and inside the body there wi
|
|||
- __quotes__: ARRAY of: _[InvoiceSwapQuote](#InvoiceSwapQuote)_
|
||||
|
||||
### InvoiceSwapRequest
|
||||
- __invoice__: _string_
|
||||
- __amount_sats__: _number_
|
||||
|
||||
### InvoiceSwapsList
|
||||
- __quotes__: ARRAY of: _[InvoiceSwapQuote](#InvoiceSwapQuote)_
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ type InvoiceSwapQuoteList struct {
|
|||
Quotes []InvoiceSwapQuote `json:"quotes"`
|
||||
}
|
||||
type InvoiceSwapRequest struct {
|
||||
Invoice string `json:"invoice"`
|
||||
Amount_sats int64 `json:"amount_sats"`
|
||||
}
|
||||
type InvoiceSwapsList struct {
|
||||
Quotes []InvoiceSwapQuote `json:"quotes"`
|
||||
|
|
|
|||
|
|
@ -2251,19 +2251,19 @@ export const InvoiceSwapQuoteListValidate = (o?: InvoiceSwapQuoteList, opts: Inv
|
|||
}
|
||||
|
||||
export type InvoiceSwapRequest = {
|
||||
invoice: string
|
||||
amount_sats: number
|
||||
}
|
||||
export const InvoiceSwapRequestOptionalFields: [] = []
|
||||
export type InvoiceSwapRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
invoice_CustomCheck?: (v: string) => boolean
|
||||
amount_sats_CustomCheck?: (v: number) => boolean
|
||||
}
|
||||
export const InvoiceSwapRequestValidate = (o?: InvoiceSwapRequest, opts: InvoiceSwapRequestOptions = {}, path: string = 'InvoiceSwapRequest::root.'): Error | null => {
|
||||
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
|
||||
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
|
||||
|
||||
if (typeof o.invoice !== 'string') return new Error(`${path}.invoice: is not a string`)
|
||||
if (opts.invoice_CustomCheck && !opts.invoice_CustomCheck(o.invoice)) return new Error(`${path}.invoice: custom check failed`)
|
||||
if (typeof o.amount_sats !== 'number') return new Error(`${path}.amount_sats: is not a number`)
|
||||
if (opts.amount_sats_CustomCheck && !opts.amount_sats_CustomCheck(o.amount_sats)) return new Error(`${path}.amount_sats: custom check failed`)
|
||||
|
||||
return null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -834,7 +834,7 @@ message MessagingToken {
|
|||
}
|
||||
|
||||
message InvoiceSwapRequest {
|
||||
string invoice = 1;
|
||||
int64 amount_sats = 1;
|
||||
}
|
||||
|
||||
message InvoiceSwapQuote {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue