Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused wallet context args #1724

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading