SatsAllDay 362f95add9
LUD-18 Wallet implementation (#531)
* LUD-18 Wallet implementation

Query the lightning address provider client-side to learn of capabilities

Conditionally render LUD-12 and LUD-18 fields based on what the remote
server says is supported

Allow identifier, name, and email to be sent from the SN side during the withdrawal flow. Auth seems too complicated for our use case, and idk about pubkey?

* Clear inputs if the new ln addr provier doesn't support those fields

* various ux improvements

* dynamic client-side validation for required payer data

* don't re-init form state on error

* correct min and max amount values

* only send applicable data to graphql api based on payerdata schema

* input type for numeric values (amount, max fee)

* update step for amount and max fee

* Fix identifier optional and field blur

* reuse more code

---------

Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
Co-authored-by: keyan <keyan.kousha+huumn@gmail.com>
2023-10-03 18:22:56 -05:00

67 lines
1.4 KiB
JavaScript

import { gql } from 'graphql-tag'
export default gql`
extend type Query {
invoice(id: ID!): Invoice!
withdrawl(id: ID!): Withdrawl!
connectAddress: String!
walletHistory(cursor: String, inc: String): History
}
extend type Mutation {
createInvoice(amount: Int!, expireSecs: Int, hodlInvoice: Boolean): Invoice!
createWithdrawl(invoice: String!, maxFee: Int!): Withdrawl!
sendToLnAddr(addr: String!, amount: Int!, maxFee: Int!, comment: String, identifier: Boolean, name: String, email: String): Withdrawl!
cancelInvoice(hash: String!, hmac: String!): Invoice!
}
type Invoice {
id: ID!
createdAt: Date!
hash: String!
bolt11: String!
expiresAt: Date!
cancelled: Boolean!
confirmedAt: Date
satsReceived: Int
satsRequested: Int!
nostr: JSONObject
comment: String
lud18Data: JSONObject
hmac: String
isHeld: Boolean
}
type Withdrawl {
id: ID!
createdAt: Date!
hash: String!
bolt11: String!
satsPaying: Int!
satsPaid: Int
satsFeePaying: Int!
satsFeePaid: Int
status: String
}
type Fact {
id: ID!
factId: ID!
bolt11: String
createdAt: Date!
sats: Float!
satsFee: Float
status: String
type: String!
description: String
item: Item
invoiceComment: String
invoicePayerData: JSONObject
}
type History {
facts: [Fact!]!
cursor: String
}
`