Fix generateMutation
* remove resolverName property from wallet defs * move function into lib/wallet * use function in generateMutation on client to fix wrongly generated mutation
This commit is contained in:
parent
7851366cd5
commit
259ebef971
|
@ -16,15 +16,10 @@ import { checkInvoice } from 'worker/wallet'
|
|||
import * as lnd from 'wallets/lnd'
|
||||
import * as lnAddr from 'wallets/lightning-address'
|
||||
import * as cln from 'wallets/cln'
|
||||
import { fetchLnAddrInvoice } from '@/lib/wallet'
|
||||
import { fetchLnAddrInvoice, generateResolverName } from '@/lib/wallet'
|
||||
|
||||
export const SERVER_WALLET_DEFS = [lnd, lnAddr, cln]
|
||||
|
||||
export function generateResolverName (walletField) {
|
||||
const capitalized = walletField[0].toUpperCase() + walletField.slice(1)
|
||||
return `upsertWallet${capitalized}`
|
||||
}
|
||||
|
||||
function injectResolvers (resolvers) {
|
||||
console.group('injected GraphQL resolvers:')
|
||||
for (
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { gql } from 'graphql-tag'
|
||||
import { SERVER_WALLET_DEFS, generateResolverName } from '@/api/resolvers/wallet'
|
||||
import { SERVER_WALLET_DEFS } from '@/api/resolvers/wallet'
|
||||
import { generateResolverName } from '@/lib/wallet'
|
||||
|
||||
function injectTypeDefs (typeDefs) {
|
||||
console.group('injected GraphQL type defs:')
|
||||
|
|
|
@ -60,3 +60,8 @@ export async function fetchLnAddrInvoice ({ addr, amount, maxFee, comment, ...pa
|
|||
|
||||
return res
|
||||
}
|
||||
|
||||
export function generateResolverName (walletField) {
|
||||
const capitalized = walletField[0].toUpperCase() + walletField.slice(1)
|
||||
return `upsertWallet${capitalized}`
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ import { ensureB64 } from '@/lib/format'
|
|||
export const server = {
|
||||
walletType: 'CLN',
|
||||
walletField: 'walletCLN',
|
||||
resolverName: 'upsertWalletCLN',
|
||||
testConnect: async (
|
||||
{ socket, rune, cert },
|
||||
{ me, models, addWalletLog, cln: { createInvoice } }
|
||||
|
|
|
@ -16,6 +16,7 @@ import { REMOVE_WALLET, WALLET_BY_TYPE } from '@/fragments/wallet'
|
|||
import { autowithdrawInitial } from '@/components/autowithdraw-shared'
|
||||
import { useShowModal } from '@/components/modal'
|
||||
import { useToast } from '../components/toast'
|
||||
import { generateResolverName } from '@/lib/wallet'
|
||||
|
||||
// wallet definitions
|
||||
export const WALLET_DEFS = [lnbits, nwc, lnc, lnd, lnAddr, cln]
|
||||
|
@ -224,7 +225,9 @@ function useServerConfig (wallet) {
|
|||
}
|
||||
|
||||
function generateMutation (wallet) {
|
||||
const { resolverName } = wallet.server
|
||||
const { walletField } = wallet.server
|
||||
|
||||
const resolverName = generateResolverName(walletField)
|
||||
|
||||
let headerArgs = '$id: ID, '
|
||||
headerArgs += wallet.fields.map(f => {
|
||||
|
|
|
@ -4,7 +4,6 @@ import { fetchLnAddrInvoice } from '@/lib/wallet'
|
|||
export const server = {
|
||||
walletType: 'LIGHTNING_ADDRESS',
|
||||
walletField: 'walletLightningAddress',
|
||||
resolverName: 'upsertWalletLNAddr',
|
||||
testConnect: async (
|
||||
{ address },
|
||||
{ me, models, addWalletLog }
|
||||
|
|
|
@ -4,7 +4,6 @@ import { datePivot } from '@/lib/time'
|
|||
export const server = {
|
||||
walletType: 'LND',
|
||||
walletField: 'walletLND',
|
||||
resolverName: 'upsertWalletLND',
|
||||
testConnect: async (
|
||||
{ cert, macaroon, socket },
|
||||
{ me, models, addWalletLog, lnService: { authenticatedLndGrpc, createInvoice } }
|
||||
|
|
Loading…
Reference in New Issue