Remove unused wallet context args (#1724)
This commit is contained in:
		
							parent
							
								
									bdd24130f9
								
							
						
					
					
						commit
						77d22cfd77
					
				@ -65,7 +65,7 @@ function injectResolvers (resolvers) {
 | 
			
		||||
        wallet,
 | 
			
		||||
        testCreateInvoice:
 | 
			
		||||
          walletDef.testCreateInvoice && validateLightning && canReceive({ def: walletDef, config: data })
 | 
			
		||||
            ? (data) => walletDef.testCreateInvoice(data, { logger, me, models })
 | 
			
		||||
            ? (data) => walletDef.testCreateInvoice(data, { logger })
 | 
			
		||||
            : null
 | 
			
		||||
      }, {
 | 
			
		||||
        settings,
 | 
			
		||||
 | 
			
		||||
@ -43,7 +43,7 @@ export function useWalletConfigurator (wallet) {
 | 
			
		||||
          clientConfig = Object.assign(clientConfig, transformedConfig)
 | 
			
		||||
        }
 | 
			
		||||
        if (wallet.def.testSendPayment && validateLightning) {
 | 
			
		||||
          transformedConfig = await wallet.def.testSendPayment(clientConfig, { me, logger })
 | 
			
		||||
          transformedConfig = await wallet.def.testSendPayment(clientConfig, { logger })
 | 
			
		||||
          if (transformedConfig) {
 | 
			
		||||
            clientConfig = Object.assign(clientConfig, transformedConfig)
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
@ -1,16 +1,16 @@
 | 
			
		||||
import { getNwc, supportedMethods, nwcTryRun } from '@/wallets/nwc'
 | 
			
		||||
export * from '@/wallets/nwc'
 | 
			
		||||
 | 
			
		||||
export async function testSendPayment ({ nwcUrl }, { logger }) {
 | 
			
		||||
export async function testSendPayment ({ nwcUrl }) {
 | 
			
		||||
  const timeout = 15_000
 | 
			
		||||
 | 
			
		||||
  const supported = await supportedMethods(nwcUrl, { logger, timeout })
 | 
			
		||||
  const supported = await supportedMethods(nwcUrl, { timeout })
 | 
			
		||||
  if (!supported.includes('pay_invoice')) {
 | 
			
		||||
    throw new Error('pay_invoice not supported')
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function sendPayment (bolt11, { nwcUrl }, { logger }) {
 | 
			
		||||
export async function sendPayment (bolt11, { nwcUrl }) {
 | 
			
		||||
  const nwc = await getNwc(nwcUrl)
 | 
			
		||||
  const result = await nwcTryRun(() => nwc.payInvoice(bolt11))
 | 
			
		||||
  return result.preimage
 | 
			
		||||
 | 
			
		||||
@ -63,7 +63,7 @@ export async function nwcTryRun (fun) {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function supportedMethods (nwcUrl, { logger, timeout } = {}) {
 | 
			
		||||
export async function supportedMethods (nwcUrl, { timeout } = {}) {
 | 
			
		||||
  const nwc = await getNwc(nwcUrl, { timeout })
 | 
			
		||||
  const result = await nwcTryRun(() => nwc.getInfo())
 | 
			
		||||
  return result.methods
 | 
			
		||||
 | 
			
		||||
@ -2,10 +2,10 @@ import { withTimeout } from '@/lib/time'
 | 
			
		||||
import { getNwc, supportedMethods, nwcTryRun } from '@/wallets/nwc'
 | 
			
		||||
export * from '@/wallets/nwc'
 | 
			
		||||
 | 
			
		||||
export async function testCreateInvoice ({ nwcUrlRecv }, { logger }) {
 | 
			
		||||
export async function testCreateInvoice ({ nwcUrlRecv }) {
 | 
			
		||||
  const timeout = 15_000
 | 
			
		||||
 | 
			
		||||
  const supported = await supportedMethods(nwcUrlRecv, { logger, timeout })
 | 
			
		||||
  const supported = await supportedMethods(nwcUrlRecv, { timeout })
 | 
			
		||||
 | 
			
		||||
  const supports = (method) => supported.includes(method)
 | 
			
		||||
 | 
			
		||||
@ -20,10 +20,10 @@ export async function testCreateInvoice ({ nwcUrlRecv }, { logger }) {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return await withTimeout(createInvoice({ msats: 1000, expiry: 1 }, { nwcUrlRecv }, { logger }), timeout)
 | 
			
		||||
  return await withTimeout(createInvoice({ msats: 1000, expiry: 1 }, { nwcUrlRecv }), timeout)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export async function createInvoice ({ msats, description, expiry }, { nwcUrlRecv }, { logger }) {
 | 
			
		||||
export async function createInvoice ({ msats, description, expiry }, { nwcUrlRecv }) {
 | 
			
		||||
  const nwc = await getNwc(nwcUrlRecv)
 | 
			
		||||
  const result = await nwcTryRun(() => nwc.sendReq('make_invoice', { amount: msats, description, expiry }))
 | 
			
		||||
  return result.invoice
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user