addr test

This commit is contained in:
boufni95 2025-11-04 18:16:57 +00:00
parent 0097dcc46c
commit 64ca3ea3f0

View file

@ -8,6 +8,8 @@ import { initMainHandler, initSettings } from './services/main/init.js';
import { nip19 } from 'nostr-tools'
import { LoadStorageSettingsFromEnv } from './services/storage/index.js';
import Main from './services/main/index.js';
import * as Types from '../proto/autogenerated/ts/types.js';
import { networks } from 'bitcoinjs-lib';
//@ts-ignore
const { nprofileEncode } = nip19
@ -66,7 +68,13 @@ const exitHandler = async (kill: () => void) => {
}
const TMP_swapTest_TMP = async (mainHandler: Main) => {
const i = await mainHandler.lnd.NewInvoice(25000, 'test', 3600, { useProvider: false, from: 'user' })
await new Promise(resolve => setTimeout(resolve, 10000))
/* const i = await mainHandler.lnd.NewInvoice(25000, 'test', 3600, { useProvider: true, from: 'user' })
console.log('Invoice created with provider destination', i.providerDst)
const decoded = await mainHandler.lnd.DecodeInvoice(i.payRequest)
await mainHandler.paymentManager.swaps.SwapInvoice(i.payRequest, decoded.paymentHash)
await mainHandler.paymentManager.swaps.SwapInvoice(i.payRequest, decoded.paymentHash) */
const a = await mainHandler.lnd.NewAddress(Types.AddressType.WITNESS_PUBKEY_HASH, { useProvider: false, from: 'user' })
console.log('Address created', a.address)
await mainHandler.paymentManager.swaps.SwapTransaction(a.address, 25000, networks.bitcoin)
}