Skip to content

Commit

Permalink
Remove unused wallet context args (#1724)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzyis authored Dec 14, 2024
1 parent bdd2413 commit 77d22cf
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion api/resolvers/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion wallets/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions wallets/nwc/client.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion wallets/nwc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions wallets/nwc/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down

0 comments on commit 77d22cf

Please sign in to comment.