Format GraphQL wallet stuff + string interpolation (#2375)

* Format GraphQL wallet stuff

* Use string interpolation for GraphQL wallet stuff
This commit is contained in:
ekzyis 2025-07-31 22:01:54 +02:00 committed by GitHub
parent 7247083b72
commit 416b675a2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 219 additions and 39 deletions

View File

@ -1,5 +1,9 @@
import { gql } from 'graphql-tag' import { gql } from 'graphql-tag'
const sharedSend = 'walletId: ID, templateName: ID, enabled: Boolean!'
const sharedRecv = `${sharedSend}, networkTests: Boolean`
const typeDefs = gql` const typeDefs = gql`
extend type Query { extend type Query {
invoice(id: ID!): Invoice! invoice(id: ID!): Invoice!
@ -25,19 +29,83 @@ const typeDefs = gql`
setWalletPriorities(priorities: [WalletPriorityUpdate!]!): Boolean setWalletPriorities(priorities: [WalletPriorityUpdate!]!): Boolean
buyCredits(credits: Int!): BuyCreditsPaidAction! buyCredits(credits: Int!): BuyCreditsPaidAction!
upsertWalletSendLNbits(walletId: ID, templateName: ID, enabled: Boolean!, url: String!, apiKey: VaultEntryInput!): WalletSendLNbits! upsertWalletSendLNbits(
upsertWalletRecvLNbits(walletId: ID, templateName: ID, enabled: Boolean!, networkTests: Boolean, url: String!, apiKey: String!): WalletRecvLNbits! ${sharedSend},
upsertWalletSendPhoenixd(walletId: ID, templateName: ID, enabled: Boolean!, url: String!, apiKey: VaultEntryInput!): WalletSendPhoenixd! url: String!,
upsertWalletRecvPhoenixd(walletId: ID, templateName: ID, enabled: Boolean!, networkTests: Boolean, url: String!, apiKey: String!): WalletRecvPhoenixd! apiKey: VaultEntryInput!
upsertWalletSendBlink(walletId: ID, templateName: ID, enabled: Boolean!, currency: VaultEntryInput!, apiKey: VaultEntryInput!): WalletSendBlink! ): WalletSendLNbits!
upsertWalletRecvBlink(walletId: ID, templateName: ID, enabled: Boolean!, networkTests: Boolean, currency: String!, apiKey: String!): WalletRecvBlink!
upsertWalletRecvLightningAddress(walletId: ID, templateName: ID, enabled: Boolean!, networkTests: Boolean, address: String!): WalletRecvLightningAddress! upsertWalletRecvLNbits(
upsertWalletSendNWC(walletId: ID, templateName: ID, enabled: Boolean!, url: VaultEntryInput!): WalletSendNWC! ${sharedRecv},
upsertWalletRecvNWC(walletId: ID, templateName: ID, enabled: Boolean!, networkTests: Boolean, url: String!): WalletRecvNWC! url: String!,
upsertWalletRecvCLNRest(walletId: ID, templateName: ID, enabled: Boolean!, networkTests: Boolean, socket: String!, rune: String!, cert: String): WalletRecvCLNRest! apiKey: String!
upsertWalletRecvLNDGRPC(walletId: ID, templateName: ID, enabled: Boolean!, networkTests: Boolean, socket: String!, macaroon: String!, cert: String): WalletRecvLNDGRPC! ): WalletRecvLNbits!
upsertWalletSendLNC(walletId: ID, templateName: ID, enabled: Boolean!, pairingPhrase: VaultEntryInput!, localKey: VaultEntryInput!, remoteKey: VaultEntryInput!, serverHost: VaultEntryInput!): WalletSendLNC!
upsertWalletSendWebLN(walletId: ID, templateName: ID, enabled: Boolean!): WalletSendWebLN! upsertWalletSendPhoenixd(
${sharedSend},
url: String!,
apiKey: VaultEntryInput!
): WalletSendPhoenixd!
upsertWalletRecvPhoenixd(
${sharedRecv},
url: String!,
apiKey: String!
): WalletRecvPhoenixd!
upsertWalletSendBlink(
${sharedSend},
currency: VaultEntryInput!,
apiKey: VaultEntryInput!
): WalletSendBlink!
upsertWalletRecvBlink(
${sharedRecv},
currency: String!,
apiKey: String!
): WalletRecvBlink!
upsertWalletRecvLightningAddress(
${sharedRecv},
address: String!
): WalletRecvLightningAddress!
upsertWalletSendNWC(
${sharedSend},
url: VaultEntryInput!
): WalletSendNWC!
upsertWalletRecvNWC(
${sharedRecv},
url: String!
): WalletRecvNWC!
upsertWalletRecvCLNRest(
${sharedRecv},
socket: String!,
rune: String!,
cert: String
): WalletRecvCLNRest!
upsertWalletRecvLNDGRPC(
${sharedRecv},
socket: String!,
macaroon: String!,
cert: String
): WalletRecvLNDGRPC!
upsertWalletSendLNC(
${sharedSend},
pairingPhrase: VaultEntryInput!,
localKey: VaultEntryInput!,
remoteKey: VaultEntryInput!,
serverHost: VaultEntryInput!
): WalletSendLNC!
upsertWalletSendWebLN(
${sharedSend}
): WalletSendWebLN!
removeWalletProtocol(id: ID!): Boolean removeWalletProtocol(id: ID!): Boolean
updateWalletEncryption(keyHash: String!, wallets: [WalletEncryptionUpdate!]!): Boolean updateWalletEncryption(keyHash: String!, wallets: [WalletEncryptionUpdate!]!): Boolean
updateKeyHash(keyHash: String!): Boolean updateKeyHash(keyHash: String!): Boolean

View File

@ -1,5 +1,15 @@
import { gql } from '@apollo/client' import { gql } from '@apollo/client'
const sharedSend = {
variables: '$walletId: ID, $templateName: ID, $enabled: Boolean!',
arguments: 'walletId: $walletId, templateName: $templateName, enabled: $enabled'
}
const sharedRecv = {
variables: `${sharedSend.variables}, $networkTests: Boolean`,
arguments: `${sharedSend.arguments}, networkTests: $networkTests`
}
export const REMOVE_WALLET_PROTOCOL = gql` export const REMOVE_WALLET_PROTOCOL = gql`
mutation removeWalletProtocol($id: ID!) { mutation removeWalletProtocol($id: ID!) {
removeWalletProtocol(id: $id) removeWalletProtocol(id: $id)
@ -7,104 +17,206 @@ export const REMOVE_WALLET_PROTOCOL = gql`
` `
export const UPSERT_WALLET_SEND_LNBITS = gql` export const UPSERT_WALLET_SEND_LNBITS = gql`
mutation upsertWalletSendLNbits($walletId: ID, $templateName: ID, $enabled: Boolean!, $url: String!, $apiKey: VaultEntryInput!) { mutation upsertWalletSendLNbits(
upsertWalletSendLNbits(walletId: $walletId, templateName: $templateName, enabled: $enabled, url: $url, apiKey: $apiKey) { ${sharedSend.variables},
$url: String!,
$apiKey: VaultEntryInput!
) {
upsertWalletSendLNbits(
${sharedSend.arguments}
url: $url,
apiKey: $apiKey
) {
id id
} }
} }
` `
export const UPSERT_WALLET_RECEIVE_LNBITS = gql` export const UPSERT_WALLET_RECEIVE_LNBITS = gql`
mutation upsertWalletRecvLNbits($walletId: ID, $templateName: ID, $enabled: Boolean!, $networkTests: Boolean, $url: String!, $apiKey: String!) { mutation upsertWalletRecvLNbits(
upsertWalletRecvLNbits(walletId: $walletId, templateName: $templateName, enabled: $enabled, networkTests: $networkTests, url: $url, apiKey: $apiKey) { ${sharedRecv.variables},
$url: String!,
$apiKey: String!
) {
upsertWalletRecvLNbits(
${sharedRecv.arguments},
url: $url,
apiKey: $apiKey
) {
id id
} }
} }
` `
export const UPSERT_WALLET_SEND_PHOENIXD = gql` export const UPSERT_WALLET_SEND_PHOENIXD = gql`
mutation upsertWalletSendPhoenixd($walletId: ID, $templateName: ID, $enabled: Boolean!, $url: String!, $apiKey: VaultEntryInput!) { mutation upsertWalletSendPhoenixd(
upsertWalletSendPhoenixd(walletId: $walletId, templateName: $templateName, enabled: $enabled, url: $url, apiKey: $apiKey) { ${sharedSend.variables},
$url: String!,
$apiKey: VaultEntryInput!
) {
upsertWalletSendPhoenixd(
${sharedSend.arguments},
url: $url,
apiKey: $apiKey
) {
id id
} }
} }
` `
export const UPSERT_WALLET_RECEIVE_PHOENIXD = gql` export const UPSERT_WALLET_RECEIVE_PHOENIXD = gql`
mutation upsertWalletRecvPhoenixd($walletId: ID, $templateName: ID, $enabled: Boolean!, $networkTests: Boolean, $url: String!, $apiKey: String!) { mutation upsertWalletRecvPhoenixd(
upsertWalletRecvPhoenixd(walletId: $walletId, templateName: $templateName, enabled: $enabled, networkTests: $networkTests, url: $url, apiKey: $apiKey) { ${sharedRecv.variables},
$url: String!,
$apiKey: String!
) {
upsertWalletRecvPhoenixd(
${sharedRecv.arguments},
url: $url,
apiKey: $apiKey
) {
id id
} }
} }
` `
export const UPSERT_WALLET_SEND_BLINK = gql` export const UPSERT_WALLET_SEND_BLINK = gql`
mutation upsertWalletSendBlink($walletId: ID, $templateName: ID, $enabled: Boolean!, $currency: VaultEntryInput!, $apiKey: VaultEntryInput!) { mutation upsertWalletSendBlink(
upsertWalletSendBlink(walletId: $walletId, templateName: $templateName, enabled: $enabled, currency: $currency, apiKey: $apiKey) { ${sharedSend.variables},
$currency: VaultEntryInput!,
$apiKey: VaultEntryInput!
) {
upsertWalletSendBlink(
${sharedSend.arguments},
currency: $currency,
apiKey: $apiKey
) {
id id
} }
} }
` `
export const UPSERT_WALLET_RECEIVE_BLINK = gql` export const UPSERT_WALLET_RECEIVE_BLINK = gql`
mutation upsertWalletRecvBlink($walletId: ID, $templateName: ID, $enabled: Boolean!, $networkTests: Boolean, $currency: String!, $apiKey: String!) { mutation upsertWalletRecvBlink(
upsertWalletRecvBlink(walletId: $walletId, templateName: $templateName, enabled: $enabled, networkTests: $networkTests, currency: $currency, apiKey: $apiKey) { ${sharedRecv.variables},
$currency: String!,
$apiKey: String!
) {
upsertWalletRecvBlink(
${sharedRecv.arguments},
currency: $currency,
apiKey: $apiKey
) {
id id
} }
} }
` `
export const UPSERT_WALLET_RECEIVE_LIGHTNING_ADDRESS = gql` export const UPSERT_WALLET_RECEIVE_LIGHTNING_ADDRESS = gql`
mutation upsertWalletRecvLightningAddress($walletId: ID, $templateName: ID, $enabled: Boolean!, $networkTests: Boolean, $address: String!) { mutation upsertWalletRecvLightningAddress(
upsertWalletRecvLightningAddress(walletId: $walletId, templateName: $templateName, enabled: $enabled, networkTests: $networkTests, address: $address) { ${sharedRecv.variables},
$address: String!
) {
upsertWalletRecvLightningAddress(
${sharedRecv.arguments},
address: $address
) {
id id
} }
} }
` `
export const UPSERT_WALLET_SEND_NWC = gql` export const UPSERT_WALLET_SEND_NWC = gql`
mutation upsertWalletSendNWC($walletId: ID, $templateName: ID, $enabled: Boolean!, $url: VaultEntryInput!) { mutation upsertWalletSendNWC(
upsertWalletSendNWC(walletId: $walletId, templateName: $templateName, enabled: $enabled, url: $url) { ${sharedSend.variables},
$url: VaultEntryInput!
) {
upsertWalletSendNWC(
${sharedSend.arguments},
url: $url
) {
id id
} }
} }
` `
export const UPSERT_WALLET_RECEIVE_NWC = gql` export const UPSERT_WALLET_RECEIVE_NWC = gql`
mutation upsertWalletRecvNWC($walletId: ID, $templateName: ID, $enabled: Boolean!, $networkTests: Boolean, $url: String!) { mutation upsertWalletRecvNWC(
upsertWalletRecvNWC(walletId: $walletId, templateName: $templateName, enabled: $enabled, networkTests: $networkTests, url: $url) { ${sharedRecv.variables},
$url: String!
) {
upsertWalletRecvNWC(
${sharedRecv.arguments},
url: $url
) {
id id
} }
} }
` `
export const UPSERT_WALLET_RECEIVE_CLN_REST = gql` export const UPSERT_WALLET_RECEIVE_CLN_REST = gql`
mutation upsertWalletRecvCLNRest($walletId: ID, $templateName: ID, $enabled: Boolean!, $networkTests: Boolean, $socket: String!, $rune: String!, $cert: String) { mutation upsertWalletRecvCLNRest(
upsertWalletRecvCLNRest(walletId: $walletId, templateName: $templateName, enabled: $enabled, networkTests: $networkTests, socket: $socket, rune: $rune, cert: $cert) { ${sharedRecv.variables},
$socket: String!,
$rune: String!,
$cert: String
) {
upsertWalletRecvCLNRest(
${sharedRecv.arguments},
socket: $socket,
rune: $rune,
cert: $cert
) {
id id
} }
} }
` `
export const UPSERT_WALLET_RECEIVE_LNDGRPC = gql` export const UPSERT_WALLET_RECEIVE_LNDGRPC = gql`
mutation upsertWalletRecvLNDGRPC($walletId: ID, $templateName: ID, $enabled: Boolean!, $networkTests: Boolean, $socket: String!, $macaroon: String!, $cert: String) { mutation upsertWalletRecvLNDGRPC(
upsertWalletRecvLNDGRPC(walletId: $walletId, templateName: $templateName, enabled: $enabled, networkTests: $networkTests, socket: $socket, macaroon: $macaroon, cert: $cert) { ${sharedRecv.variables},
$socket: String!,
$macaroon: String!,
$cert: String
) {
upsertWalletRecvLNDGRPC(
${sharedRecv.arguments},
socket: $socket,
macaroon: $macaroon,
cert: $cert
) {
id id
} }
} }
` `
export const UPSERT_WALLET_SEND_LNC = gql` export const UPSERT_WALLET_SEND_LNC = gql`
mutation upsertWalletSendLNC($walletId: ID, $templateName: ID, $enabled: Boolean!, $pairingPhrase: VaultEntryInput!, $localKey: VaultEntryInput!, $remoteKey: VaultEntryInput!, $serverHost: VaultEntryInput!) { mutation upsertWalletSendLNC(
upsertWalletSendLNC(walletId: $walletId, templateName: $templateName, enabled: $enabled, pairingPhrase: $pairingPhrase, localKey: $localKey, remoteKey: $remoteKey, serverHost: $serverHost) { ${sharedSend.variables},
$pairingPhrase: VaultEntryInput!,
$localKey: VaultEntryInput!,
$remoteKey: VaultEntryInput!,
$serverHost: VaultEntryInput!
) {
upsertWalletSendLNC(
${sharedSend.arguments},
pairingPhrase: $pairingPhrase,
localKey: $localKey,
remoteKey: $remoteKey,
serverHost: $serverHost
) {
id id
} }
} }
` `
export const UPSERT_WALLET_SEND_WEBLN = gql` export const UPSERT_WALLET_SEND_WEBLN = gql`
mutation upsertWalletSendWebLN($walletId: ID, $templateName: ID, $enabled: Boolean!) { mutation upsertWalletSendWebLN(
upsertWalletSendWebLN(walletId: $walletId, templateName: $templateName, enabled: $enabled) { ${sharedSend.variables}
) {
upsertWalletSendWebLN(
${sharedSend.arguments}
) {
id id
} }
} }