beignet 0.0.54 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +477 -140
- package/dist/cli/beignet-node.js +2399 -0
- package/dist/cli/beignet-node.js.map +1 -0
- package/dist/cli/cli.js +659 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/config.js +144 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/daemon.js +783 -0
- package/dist/cli/daemon.js.map +1 -0
- package/dist/cli/errors.js +143 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/http-rate-limiter.js +62 -0
- package/dist/cli/http-rate-limiter.js.map +1 -0
- package/dist/cli/index.js +40 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/instance-lock.js +105 -0
- package/dist/cli/instance-lock.js.map +1 -0
- package/dist/cli/openapi.js +2092 -0
- package/dist/cli/openapi.js.map +1 -0
- package/dist/cli/payment-queue.js +198 -0
- package/dist/cli/payment-queue.js.map +1 -0
- package/dist/cli/types.js +3 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/webhooks.js +181 -0
- package/dist/cli/webhooks.js.map +1 -0
- package/dist/electrum/index.js +107 -77
- package/dist/electrum/index.js.map +1 -1
- package/dist/lightning/advisor/channel-suggestions.js +102 -0
- package/dist/lightning/advisor/channel-suggestions.js.map +1 -0
- package/dist/lightning/advisor/fee-advisor.js +96 -0
- package/dist/lightning/advisor/fee-advisor.js.map +1 -0
- package/dist/lightning/advisor/index.js +12 -0
- package/dist/lightning/advisor/index.js.map +1 -0
- package/dist/lightning/advisor/liquidity-advisor.js +153 -0
- package/dist/lightning/advisor/liquidity-advisor.js.map +1 -0
- package/dist/lightning/async-payments/manager.js +63 -0
- package/dist/lightning/async-payments/manager.js.map +1 -0
- package/dist/lightning/async-payments/types.js +6 -0
- package/dist/lightning/async-payments/types.js.map +1 -0
- package/dist/lightning/bootstrap/dns.js +115 -0
- package/dist/lightning/bootstrap/dns.js.map +1 -0
- package/dist/lightning/bootstrap/index.js +20 -0
- package/dist/lightning/bootstrap/index.js.map +1 -0
- package/dist/lightning/bootstrap/seeds.js +35 -0
- package/dist/lightning/bootstrap/seeds.js.map +1 -0
- package/dist/lightning/bootstrap/types.js +3 -0
- package/dist/lightning/bootstrap/types.js.map +1 -0
- package/dist/lightning/chain/chain-monitor.js +702 -0
- package/dist/lightning/chain/chain-monitor.js.map +1 -0
- package/dist/lightning/chain/chain-watcher.js +424 -0
- package/dist/lightning/chain/chain-watcher.js.map +1 -0
- package/dist/lightning/chain/closing.js +194 -0
- package/dist/lightning/chain/closing.js.map +1 -0
- package/dist/lightning/chain/electrum-backend.js +254 -0
- package/dist/lightning/chain/electrum-backend.js.map +1 -0
- package/dist/lightning/chain/index.js +24 -0
- package/dist/lightning/chain/index.js.map +1 -0
- package/dist/lightning/chain/output-resolver.js +1316 -0
- package/dist/lightning/chain/output-resolver.js.map +1 -0
- package/dist/lightning/chain/sweep.js +291 -0
- package/dist/lightning/chain/sweep.js.map +1 -0
- package/dist/lightning/chain/types.js +56 -0
- package/dist/lightning/chain/types.js.map +1 -0
- package/dist/lightning/channel/channel-actions.js +24 -0
- package/dist/lightning/channel/channel-actions.js.map +1 -0
- package/dist/lightning/channel/channel-manager.js +2253 -0
- package/dist/lightning/channel/channel-manager.js.map +1 -0
- package/dist/lightning/channel/channel-state.js +158 -0
- package/dist/lightning/channel/channel-state.js.map +1 -0
- package/dist/lightning/channel/channel.js +4903 -0
- package/dist/lightning/channel/channel.js.map +1 -0
- package/dist/lightning/channel/commitment-builder.js +565 -0
- package/dist/lightning/channel/commitment-builder.js.map +1 -0
- package/dist/lightning/channel/commitment-musig.js +40 -0
- package/dist/lightning/channel/commitment-musig.js.map +1 -0
- package/dist/lightning/channel/dual-funding.js +567 -0
- package/dist/lightning/channel/dual-funding.js.map +1 -0
- package/dist/lightning/channel/index.js +29 -0
- package/dist/lightning/channel/index.js.map +1 -0
- package/dist/lightning/channel/liquidity-ads.js +52 -0
- package/dist/lightning/channel/liquidity-ads.js.map +1 -0
- package/dist/lightning/channel/quiescence.js +74 -0
- package/dist/lightning/channel/quiescence.js.map +1 -0
- package/dist/lightning/channel/splice-tx.js +93 -0
- package/dist/lightning/channel/splice-tx.js.map +1 -0
- package/dist/lightning/channel/splice-weight.js +30 -0
- package/dist/lightning/channel/splice-weight.js.map +1 -0
- package/dist/lightning/channel/splice.js +347 -0
- package/dist/lightning/channel/splice.js.map +1 -0
- package/dist/lightning/channel/types.js +70 -0
- package/dist/lightning/channel/types.js.map +1 -0
- package/dist/lightning/channel/validation.js +169 -0
- package/dist/lightning/channel/validation.js.map +1 -0
- package/dist/lightning/channel/zero-conf.js +28 -0
- package/dist/lightning/channel/zero-conf.js.map +1 -0
- package/dist/lightning/crypto/chacha20poly1305.js +57 -0
- package/dist/lightning/crypto/chacha20poly1305.js.map +1 -0
- package/dist/lightning/crypto/ecdh.js +131 -0
- package/dist/lightning/crypto/ecdh.js.map +1 -0
- package/dist/lightning/crypto/hkdf.js +56 -0
- package/dist/lightning/crypto/hkdf.js.map +1 -0
- package/dist/lightning/crypto/index.js +20 -0
- package/dist/lightning/crypto/index.js.map +1 -0
- package/dist/lightning/crypto/musig.js +168 -0
- package/dist/lightning/crypto/musig.js.map +1 -0
- package/dist/lightning/features/flags.js +150 -0
- package/dist/lightning/features/flags.js.map +1 -0
- package/dist/lightning/features/index.js +18 -0
- package/dist/lightning/features/index.js.map +1 -0
- package/dist/lightning/gossip/gossip-queries.js +141 -0
- package/dist/lightning/gossip/gossip-queries.js.map +1 -0
- package/dist/lightning/gossip/gossip-sync.js +161 -0
- package/dist/lightning/gossip/gossip-sync.js.map +1 -0
- package/dist/lightning/gossip/index.js +27 -0
- package/dist/lightning/gossip/index.js.map +1 -0
- package/dist/lightning/gossip/messages.js +362 -0
- package/dist/lightning/gossip/messages.js.map +1 -0
- package/dist/lightning/gossip/mission-control.js +123 -0
- package/dist/lightning/gossip/mission-control.js.map +1 -0
- package/dist/lightning/gossip/network-graph.js +237 -0
- package/dist/lightning/gossip/network-graph.js.map +1 -0
- package/dist/lightning/gossip/pathfinding.js +551 -0
- package/dist/lightning/gossip/pathfinding.js.map +1 -0
- package/dist/lightning/gossip/rapid-sync.js +201 -0
- package/dist/lightning/gossip/rapid-sync.js.map +1 -0
- package/dist/lightning/gossip/scid-encoding.js +50 -0
- package/dist/lightning/gossip/scid-encoding.js.map +1 -0
- package/dist/lightning/gossip/types.js +86 -0
- package/dist/lightning/gossip/types.js.map +1 -0
- package/dist/lightning/gossip/validation.js +71 -0
- package/dist/lightning/gossip/validation.js.map +1 -0
- package/dist/lightning/index.js +47 -0
- package/dist/lightning/index.js.map +1 -0
- package/dist/lightning/interactive-tx/builder.js +213 -0
- package/dist/lightning/interactive-tx/builder.js.map +1 -0
- package/dist/lightning/interactive-tx/index.js +20 -0
- package/dist/lightning/interactive-tx/index.js.map +1 -0
- package/dist/lightning/interactive-tx/types.js +12 -0
- package/dist/lightning/interactive-tx/types.js.map +1 -0
- package/dist/lightning/interactive-tx/validation.js +75 -0
- package/dist/lightning/interactive-tx/validation.js.map +1 -0
- package/dist/lightning/invoice/amount.js +102 -0
- package/dist/lightning/invoice/amount.js.map +1 -0
- package/dist/lightning/invoice/decode.js +196 -0
- package/dist/lightning/invoice/decode.js.map +1 -0
- package/dist/lightning/invoice/encode.js +120 -0
- package/dist/lightning/invoice/encode.js.map +1 -0
- package/dist/lightning/invoice/index.js +26 -0
- package/dist/lightning/invoice/index.js.map +1 -0
- package/dist/lightning/invoice/signing.js +104 -0
- package/dist/lightning/invoice/signing.js.map +1 -0
- package/dist/lightning/invoice/types.js +32 -0
- package/dist/lightning/invoice/types.js.map +1 -0
- package/dist/lightning/invoice/words.js +53 -0
- package/dist/lightning/invoice/words.js.map +1 -0
- package/dist/lightning/keys/derivation.js +43 -0
- package/dist/lightning/keys/derivation.js.map +1 -0
- package/dist/lightning/keys/index.js +21 -0
- package/dist/lightning/keys/index.js.map +1 -0
- package/dist/lightning/keys/shachain.js +110 -0
- package/dist/lightning/keys/shachain.js.map +1 -0
- package/dist/lightning/keys/signer.js +119 -0
- package/dist/lightning/keys/signer.js.map +1 -0
- package/dist/lightning/keys/wallet-keys.js +120 -0
- package/dist/lightning/keys/wallet-keys.js.map +1 -0
- package/dist/lightning/message/channel-close.js +220 -0
- package/dist/lightning/message/channel-close.js.map +1 -0
- package/dist/lightning/message/channel-commitment.js +133 -0
- package/dist/lightning/message/channel-commitment.js.map +1 -0
- package/dist/lightning/message/channel-funding.js +159 -0
- package/dist/lightning/message/channel-funding.js.map +1 -0
- package/dist/lightning/message/channel-open.js +263 -0
- package/dist/lightning/message/channel-open.js.map +1 -0
- package/dist/lightning/message/channel-reestablish.js +92 -0
- package/dist/lightning/message/channel-reestablish.js.map +1 -0
- package/dist/lightning/message/channel-update.js +167 -0
- package/dist/lightning/message/channel-update.js.map +1 -0
- package/dist/lightning/message/codec.js +87 -0
- package/dist/lightning/message/codec.js.map +1 -0
- package/dist/lightning/message/dual-funding.js +293 -0
- package/dist/lightning/message/dual-funding.js.map +1 -0
- package/dist/lightning/message/error.js +49 -0
- package/dist/lightning/message/error.js.map +1 -0
- package/dist/lightning/message/index.js +33 -0
- package/dist/lightning/message/index.js.map +1 -0
- package/dist/lightning/message/init.js +71 -0
- package/dist/lightning/message/init.js.map +1 -0
- package/dist/lightning/message/interactive-tx.js +342 -0
- package/dist/lightning/message/interactive-tx.js.map +1 -0
- package/dist/lightning/message/ping.js +49 -0
- package/dist/lightning/message/ping.js.map +1 -0
- package/dist/lightning/message/splice.js +195 -0
- package/dist/lightning/message/splice.js.map +1 -0
- package/dist/lightning/message/stfu.js +21 -0
- package/dist/lightning/message/stfu.js.map +1 -0
- package/dist/lightning/message/tlv.js +59 -0
- package/dist/lightning/message/tlv.js.map +1 -0
- package/dist/lightning/message/types.js +67 -0
- package/dist/lightning/message/types.js.map +1 -0
- package/dist/lightning/node/index.js +20 -0
- package/dist/lightning/node/index.js.map +1 -0
- package/dist/lightning/node/lightning-node.js +4433 -0
- package/dist/lightning/node/lightning-node.js.map +1 -0
- package/dist/lightning/node/rate-limiter.js +41 -0
- package/dist/lightning/node/rate-limiter.js.map +1 -0
- package/dist/lightning/node/types.js +34 -0
- package/dist/lightning/node/types.js.map +1 -0
- package/dist/lightning/offer/decode.js +54 -0
- package/dist/lightning/offer/decode.js.map +1 -0
- package/dist/lightning/offer/encode.js +25 -0
- package/dist/lightning/offer/encode.js.map +1 -0
- package/dist/lightning/offer/index.js +24 -0
- package/dist/lightning/offer/index.js.map +1 -0
- package/dist/lightning/offer/merkle.js +68 -0
- package/dist/lightning/offer/merkle.js.map +1 -0
- package/dist/lightning/offer/offer-manager.js +294 -0
- package/dist/lightning/offer/offer-manager.js.map +1 -0
- package/dist/lightning/offer/schnorr.js +67 -0
- package/dist/lightning/offer/schnorr.js.map +1 -0
- package/dist/lightning/offer/tlv.js +479 -0
- package/dist/lightning/offer/tlv.js.map +1 -0
- package/dist/lightning/offer/types.js +3 -0
- package/dist/lightning/offer/types.js.map +1 -0
- package/dist/lightning/onion/blinded-path.js +274 -0
- package/dist/lightning/onion/blinded-path.js.map +1 -0
- package/dist/lightning/onion/blinding.js +73 -0
- package/dist/lightning/onion/blinding.js.map +1 -0
- package/dist/lightning/onion/construct.js +97 -0
- package/dist/lightning/onion/construct.js.map +1 -0
- package/dist/lightning/onion/failures.js +177 -0
- package/dist/lightning/onion/failures.js.map +1 -0
- package/dist/lightning/onion/hop-payload.js +148 -0
- package/dist/lightning/onion/hop-payload.js.map +1 -0
- package/dist/lightning/onion/index.js +25 -0
- package/dist/lightning/onion/index.js.map +1 -0
- package/dist/lightning/onion/process.js +54 -0
- package/dist/lightning/onion/process.js.map +1 -0
- package/dist/lightning/onion/sphinx-crypto.js +59 -0
- package/dist/lightning/onion/sphinx-crypto.js.map +1 -0
- package/dist/lightning/onion/types.js +28 -0
- package/dist/lightning/onion/types.js.map +1 -0
- package/dist/lightning/onion-message/codec.js +153 -0
- package/dist/lightning/onion-message/codec.js.map +1 -0
- package/dist/lightning/onion-message/construct.js +150 -0
- package/dist/lightning/onion-message/construct.js.map +1 -0
- package/dist/lightning/onion-message/index.js +22 -0
- package/dist/lightning/onion-message/index.js.map +1 -0
- package/dist/lightning/onion-message/manager.js +143 -0
- package/dist/lightning/onion-message/manager.js.map +1 -0
- package/dist/lightning/onion-message/process.js +98 -0
- package/dist/lightning/onion-message/process.js.map +1 -0
- package/dist/lightning/onion-message/types.js +10 -0
- package/dist/lightning/onion-message/types.js.map +1 -0
- package/dist/lightning/script/anchor.js +71 -0
- package/dist/lightning/script/anchor.js.map +1 -0
- package/dist/lightning/script/commitment-taproot.js +279 -0
- package/dist/lightning/script/commitment-taproot.js.map +1 -0
- package/dist/lightning/script/commitment.js +216 -0
- package/dist/lightning/script/commitment.js.map +1 -0
- package/dist/lightning/script/funding-taproot.js +52 -0
- package/dist/lightning/script/funding-taproot.js.map +1 -0
- package/dist/lightning/script/funding.js +64 -0
- package/dist/lightning/script/funding.js.map +1 -0
- package/dist/lightning/script/htlc-taproot.js +83 -0
- package/dist/lightning/script/htlc-taproot.js.map +1 -0
- package/dist/lightning/script/htlc.js +170 -0
- package/dist/lightning/script/htlc.js.map +1 -0
- package/dist/lightning/script/index.js +22 -0
- package/dist/lightning/script/index.js.map +1 -0
- package/dist/lightning/script/revocation.js +115 -0
- package/dist/lightning/script/revocation.js.map +1 -0
- package/dist/lightning/storage/index.js +20 -0
- package/dist/lightning/storage/index.js.map +1 -0
- package/dist/lightning/storage/serialization.js +588 -0
- package/dist/lightning/storage/serialization.js.map +1 -0
- package/dist/lightning/storage/sqlite-storage.js +717 -0
- package/dist/lightning/storage/sqlite-storage.js.map +1 -0
- package/dist/lightning/storage/types.js +3 -0
- package/dist/lightning/storage/types.js.map +1 -0
- package/dist/lightning/transport/cipher.js +81 -0
- package/dist/lightning/transport/cipher.js.map +1 -0
- package/dist/lightning/transport/index.js +21 -0
- package/dist/lightning/transport/index.js.map +1 -0
- package/dist/lightning/transport/noise.js +191 -0
- package/dist/lightning/transport/noise.js.map +1 -0
- package/dist/lightning/transport/peer-manager.js +279 -0
- package/dist/lightning/transport/peer-manager.js.map +1 -0
- package/dist/lightning/transport/peer.js +463 -0
- package/dist/lightning/transport/peer.js.map +1 -0
- package/dist/lightning/transport/wire-capture.js +106 -0
- package/dist/lightning/transport/wire-capture.js.map +1 -0
- package/dist/lightning/validation/index.js +67 -0
- package/dist/lightning/validation/index.js.map +1 -0
- package/dist/lightning/wallet/index.js +6 -0
- package/dist/lightning/wallet/index.js.map +1 -0
- package/dist/lightning/wallet/wallet-funding-provider.js +197 -0
- package/dist/lightning/wallet/wallet-funding-provider.js.map +1 -0
- package/dist/transaction/index.js +105 -58
- package/dist/transaction/index.js.map +1 -1
- package/dist/types/cli/beignet-node.d.ts +272 -0
- package/dist/types/cli/cli.d.ts +2 -0
- package/dist/types/cli/config.d.ts +14 -0
- package/dist/types/cli/daemon.d.ts +18 -0
- package/dist/types/cli/errors.d.ts +45 -0
- package/dist/types/cli/http-rate-limiter.d.ts +15 -0
- package/dist/types/cli/index.d.ts +9 -0
- package/dist/types/cli/instance-lock.d.ts +11 -0
- package/dist/types/cli/openapi.d.ts +1 -0
- package/dist/types/cli/payment-queue.d.ts +66 -0
- package/dist/types/cli/types.d.ts +400 -0
- package/dist/types/cli/webhooks.d.ts +32 -0
- package/dist/types/electrum/index.d.ts +3 -1
- package/dist/types/lightning/advisor/channel-suggestions.d.ts +17 -0
- package/dist/types/lightning/advisor/fee-advisor.d.ts +24 -0
- package/dist/types/lightning/advisor/index.d.ts +6 -0
- package/dist/types/lightning/advisor/liquidity-advisor.d.ts +59 -0
- package/dist/types/lightning/async-payments/manager.d.ts +17 -0
- package/dist/types/lightning/async-payments/types.d.ts +8 -0
- package/dist/types/lightning/bootstrap/dns.d.ts +20 -0
- package/dist/types/lightning/bootstrap/index.d.ts +3 -0
- package/dist/types/lightning/bootstrap/seeds.d.ts +3 -0
- package/dist/types/lightning/bootstrap/types.d.ts +15 -0
- package/dist/types/lightning/chain/chain-monitor.d.ts +52 -0
- package/dist/types/lightning/chain/chain-watcher.d.ts +59 -0
- package/dist/types/lightning/chain/closing.d.ts +49 -0
- package/dist/types/lightning/chain/electrum-backend.d.ts +44 -0
- package/dist/types/lightning/chain/index.d.ts +7 -0
- package/dist/types/lightning/chain/output-resolver.d.ts +24 -0
- package/dist/types/lightning/chain/sweep.d.ts +85 -0
- package/dist/types/lightning/chain/types.d.ts +120 -0
- package/dist/types/lightning/channel/channel-actions.d.ts +100 -0
- package/dist/types/lightning/channel/channel-manager.d.ts +182 -0
- package/dist/types/lightning/channel/channel-state.d.ts +144 -0
- package/dist/types/lightning/channel/channel.d.ts +261 -0
- package/dist/types/lightning/channel/commitment-builder.d.ts +55 -0
- package/dist/types/lightning/channel/commitment-musig.d.ts +8 -0
- package/dist/types/lightning/channel/dual-funding.d.ts +112 -0
- package/dist/types/lightning/channel/index.d.ts +12 -0
- package/dist/types/lightning/channel/liquidity-ads.d.ts +8 -0
- package/dist/types/lightning/channel/quiescence.d.ts +22 -0
- package/dist/types/lightning/channel/splice-tx.d.ts +25 -0
- package/dist/types/lightning/channel/splice-weight.d.ts +12 -0
- package/dist/types/lightning/channel/splice.d.ts +100 -0
- package/dist/types/lightning/channel/types.d.ts +72 -0
- package/dist/types/lightning/channel/validation.d.ts +9 -0
- package/dist/types/lightning/channel/zero-conf.d.ts +9 -0
- package/dist/types/lightning/crypto/chacha20poly1305.d.ts +8 -0
- package/dist/types/lightning/crypto/ecdh.d.ts +11 -0
- package/dist/types/lightning/crypto/hkdf.d.ts +6 -0
- package/dist/types/lightning/crypto/index.d.ts +3 -0
- package/dist/types/lightning/crypto/musig.d.ts +34 -0
- package/dist/types/lightning/features/flags.d.ts +46 -0
- package/dist/types/lightning/features/index.d.ts +1 -0
- package/dist/types/lightning/gossip/gossip-queries.d.ts +12 -0
- package/dist/types/lightning/gossip/gossip-sync.d.ts +31 -0
- package/dist/types/lightning/gossip/index.d.ts +10 -0
- package/dist/types/lightning/gossip/messages.d.ts +15 -0
- package/dist/types/lightning/gossip/mission-control.d.ts +20 -0
- package/dist/types/lightning/gossip/network-graph.d.ts +29 -0
- package/dist/types/lightning/gossip/pathfinding.d.ts +23 -0
- package/dist/types/lightning/gossip/rapid-sync.d.ts +12 -0
- package/dist/types/lightning/gossip/scid-encoding.d.ts +4 -0
- package/dist/types/lightning/gossip/types.d.ts +132 -0
- package/dist/types/lightning/gossip/validation.d.ts +15 -0
- package/dist/types/lightning/index.d.ts +20 -0
- package/dist/types/lightning/interactive-tx/builder.d.ts +28 -0
- package/dist/types/lightning/interactive-tx/index.d.ts +3 -0
- package/dist/types/lightning/interactive-tx/types.d.ts +29 -0
- package/dist/types/lightning/interactive-tx/validation.d.ts +8 -0
- package/dist/types/lightning/invoice/amount.d.ts +8 -0
- package/dist/types/lightning/invoice/decode.d.ts +2 -0
- package/dist/types/lightning/invoice/encode.d.ts +2 -0
- package/dist/types/lightning/invoice/index.d.ts +6 -0
- package/dist/types/lightning/invoice/signing.d.ts +6 -0
- package/dist/types/lightning/invoice/types.d.ts +81 -0
- package/dist/types/lightning/invoice/words.d.ts +11 -0
- package/dist/types/lightning/keys/derivation.d.ts +14 -0
- package/dist/types/lightning/keys/index.d.ts +4 -0
- package/dist/types/lightning/keys/shachain.d.ts +18 -0
- package/dist/types/lightning/keys/signer.d.ts +17 -0
- package/dist/types/lightning/keys/wallet-keys.d.ts +31 -0
- package/dist/types/lightning/message/channel-close.d.ts +36 -0
- package/dist/types/lightning/message/channel-commitment.d.ts +18 -0
- package/dist/types/lightning/message/channel-funding.d.ts +25 -0
- package/dist/types/lightning/message/channel-open.d.ts +47 -0
- package/dist/types/lightning/message/channel-reestablish.d.ts +13 -0
- package/dist/types/lightning/message/channel-update.d.ts +40 -0
- package/dist/types/lightning/message/codec.d.ts +13 -0
- package/dist/types/lightning/message/dual-funding.d.ts +56 -0
- package/dist/types/lightning/message/error.d.ts +12 -0
- package/dist/types/lightning/message/index.d.ts +16 -0
- package/dist/types/lightning/message/init.d.ts +8 -0
- package/dist/types/lightning/message/interactive-tx.d.ts +62 -0
- package/dist/types/lightning/message/ping.d.ts +12 -0
- package/dist/types/lightning/message/splice.d.ts +32 -0
- package/dist/types/lightning/message/stfu.d.ts +7 -0
- package/dist/types/lightning/message/tlv.d.ts +13 -0
- package/dist/types/lightning/message/types.d.ts +52 -0
- package/dist/types/lightning/node/index.d.ts +3 -0
- package/dist/types/lightning/node/lightning-node.d.ts +339 -0
- package/dist/types/lightning/node/rate-limiter.d.ts +14 -0
- package/dist/types/lightning/node/types.d.ts +248 -0
- package/dist/types/lightning/offer/decode.d.ts +5 -0
- package/dist/types/lightning/offer/encode.d.ts +5 -0
- package/dist/types/lightning/offer/index.d.ts +7 -0
- package/dist/types/lightning/offer/merkle.d.ts +10 -0
- package/dist/types/lightning/offer/offer-manager.d.ts +56 -0
- package/dist/types/lightning/offer/schnorr.d.ts +5 -0
- package/dist/types/lightning/offer/tlv.d.ts +64 -0
- package/dist/types/lightning/offer/types.d.ts +61 -0
- package/dist/types/lightning/onion/blinded-path.d.ts +61 -0
- package/dist/types/lightning/onion/blinding.d.ts +13 -0
- package/dist/types/lightning/onion/construct.d.ts +9 -0
- package/dist/types/lightning/onion/failures.d.ts +14 -0
- package/dist/types/lightning/onion/hop-payload.d.ts +9 -0
- package/dist/types/lightning/onion/index.d.ts +8 -0
- package/dist/types/lightning/onion/process.d.ts +4 -0
- package/dist/types/lightning/onion/sphinx-crypto.d.ts +10 -0
- package/dist/types/lightning/onion/types.d.ts +58 -0
- package/dist/types/lightning/onion-message/codec.d.ts +13 -0
- package/dist/types/lightning/onion-message/construct.d.ts +11 -0
- package/dist/types/lightning/onion-message/index.d.ts +5 -0
- package/dist/types/lightning/onion-message/manager.d.ts +28 -0
- package/dist/types/lightning/onion-message/process.d.ts +3 -0
- package/dist/types/lightning/onion-message/types.d.ts +35 -0
- package/dist/types/lightning/script/anchor.d.ts +13 -0
- package/dist/types/lightning/script/commitment-taproot.d.ts +47 -0
- package/dist/types/lightning/script/commitment.d.ts +58 -0
- package/dist/types/lightning/script/funding-taproot.d.ts +12 -0
- package/dist/types/lightning/script/funding.d.ts +9 -0
- package/dist/types/lightning/script/htlc-taproot.d.ts +9 -0
- package/dist/types/lightning/script/htlc.d.ts +7 -0
- package/dist/types/lightning/script/index.d.ts +5 -0
- package/dist/types/lightning/script/revocation.d.ts +16 -0
- package/dist/types/lightning/storage/index.d.ts +3 -0
- package/dist/types/lightning/storage/serialization.d.ts +213 -0
- package/dist/types/lightning/storage/sqlite-storage.d.ts +158 -0
- package/dist/types/lightning/storage/types.d.ts +121 -0
- package/dist/types/lightning/transport/cipher.d.ts +21 -0
- package/dist/types/lightning/transport/index.d.ts +4 -0
- package/dist/types/lightning/transport/noise.d.ts +46 -0
- package/dist/types/lightning/transport/peer-manager.d.ts +67 -0
- package/dist/types/lightning/transport/peer.d.ts +74 -0
- package/dist/types/lightning/transport/wire-capture.d.ts +4 -0
- package/dist/types/lightning/validation/index.d.ts +9 -0
- package/dist/types/lightning/wallet/index.d.ts +1 -0
- package/dist/types/lightning/wallet/wallet-funding-provider.d.ts +62 -0
- package/dist/types/transaction/index.d.ts +2 -1
- package/dist/utils/conversion.js +1 -1
- package/dist/utils/conversion.js.map +1 -1
- package/dist/utils/electrum.js +3 -4
- package/dist/utils/electrum.js.map +1 -1
- package/dist/utils/helpers.js +11 -12
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/result.js +0 -1
- package/dist/utils/result.js.map +1 -1
- package/dist/utils/transaction.js +10 -12
- package/dist/utils/transaction.js.map +1 -1
- package/dist/utils/wallet.js +2 -2
- package/dist/utils/wallet.js.map +1 -1
- package/dist/wallet/index.js +173 -121
- package/dist/wallet/index.js.map +1 -1
- package/docs/AI_AGENT_GUIDE.md +724 -0
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/Electrum.html +115 -55
- package/docs/html/classes/Transaction.html +115 -27
- package/docs/html/classes/Wallet.html +290 -136
- package/docs/html/enums/EAddressType.html +18 -5
- package/docs/html/enums/EAvailableNetworks.html +21 -8
- package/docs/html/enums/EBoostType.html +16 -3
- package/docs/html/enums/ECoinSelectPreference.html +275 -0
- package/docs/html/enums/EElectrumNetworks.html +17 -4
- package/docs/html/enums/EFeeId.html +19 -6
- package/docs/html/enums/EPaymentType.html +16 -3
- package/docs/html/enums/EProtocol.html +16 -3
- package/docs/html/enums/EScanningStrategy.html +18 -5
- package/docs/html/enums/EUnit.html +17 -4
- package/docs/html/functions/availableNetworks.html +14 -1
- package/docs/html/functions/constructByteCountParam.html +14 -1
- package/docs/html/functions/decodeOpReturnMessage.html +14 -1
- package/docs/html/functions/decodeRawTransaction.html +14 -1
- package/docs/html/functions/err.html +14 -1
- package/docs/html/functions/filterAddressesForGapLimit.html +17 -2
- package/docs/html/functions/filterAddressesObjForAddressesList.html +241 -0
- package/docs/html/functions/filterAddressesObjForGapLimit.html +17 -2
- package/docs/html/functions/filterAddressesObjForSingleIndex.html +14 -1
- package/docs/html/functions/filterAddressesObjForStartingIndex.html +14 -1
- package/docs/html/functions/formatKeyDerivationPath.html +14 -1
- package/docs/html/functions/formatPeerData.html +14 -1
- package/docs/html/functions/generateMnemonic.html +14 -1
- package/docs/html/functions/generateWalletId.html +14 -1
- package/docs/html/functions/getAddressFromKeyPair.html +14 -1
- package/docs/html/functions/getAddressFromScriptPubKey.html +14 -1
- package/docs/html/functions/getAddressIndexDiff.html +14 -1
- package/docs/html/functions/getAddressTypeFromPath.html +14 -1
- package/docs/html/functions/getAddressesFromPrivateKey.html +14 -1
- package/docs/html/functions/getByteCount.html +14 -1
- package/docs/html/functions/getDataFallback.html +14 -1
- package/docs/html/functions/getDefaultPort.html +14 -1
- package/docs/html/functions/getDefaultWalletData.html +14 -1
- package/docs/html/functions/getDefaultWalletDataKeys.html +14 -1
- package/docs/html/functions/getElectrumNetwork.html +14 -1
- package/docs/html/functions/getHighestUsedIndexFromTxHashes.html +14 -1
- package/docs/html/functions/getKeyDerivationPath.html +14 -1
- package/docs/html/functions/getKeyDerivationPathObject.html +14 -1
- package/docs/html/functions/getKeyDerivationPathString.html +14 -1
- package/docs/html/functions/getKeyValue.html +14 -1
- package/docs/html/functions/getPeers.html +14 -1
- package/docs/html/functions/getProtocolForPort.html +14 -1
- package/docs/html/functions/getScriptHash.html +14 -1
- package/docs/html/functions/getSeed.html +14 -1
- package/docs/html/functions/getSeedHash.html +14 -1
- package/docs/html/functions/getSha256.html +14 -1
- package/docs/html/functions/getStorageKeyValues.html +14 -1
- package/docs/html/functions/getTapRootAddressFromPublicKey.html +14 -1
- package/docs/html/functions/getTxFee.html +14 -1
- package/docs/html/functions/getWalletDataStorageKey.html +14 -1
- package/docs/html/functions/isP2trPrefix.html +14 -1
- package/docs/html/functions/isPositive.html +14 -1
- package/docs/html/functions/isValidBech32mEncodedString.html +14 -1
- package/docs/html/functions/objectKeys-1.html +14 -1
- package/docs/html/functions/objectsMatch.html +14 -1
- package/docs/html/functions/ok.html +14 -1
- package/docs/html/functions/parseOnChainPaymentRequest.html +14 -1
- package/docs/html/functions/reduceValue.html +14 -1
- package/docs/html/functions/removeDustOutputs.html +14 -1
- package/docs/html/functions/removeDustUtxos.html +240 -0
- package/docs/html/functions/setReplaceByFee.html +14 -1
- package/docs/html/functions/shuffleArray.html +14 -1
- package/docs/html/functions/sleep.html +14 -1
- package/docs/html/functions/splitAddresses.html +243 -0
- package/docs/html/functions/validateAddress.html +14 -1
- package/docs/html/functions/validateMnemonic.html +14 -1
- package/docs/html/functions/validateTransaction.html +14 -1
- package/docs/html/index.html +26 -0
- package/docs/html/interfaces/IAddInput.html +17 -4
- package/docs/html/interfaces/IAddress.html +19 -6
- package/docs/html/interfaces/IAddressData.html +17 -4
- package/docs/html/interfaces/IAddressType.html +14 -1
- package/docs/html/interfaces/IAddressTypeData.html +20 -7
- package/docs/html/interfaces/IAddressTypesIO.html +280 -0
- package/docs/html/interfaces/IAddresses.html +14 -1
- package/docs/html/interfaces/IBoostedTransaction.html +18 -5
- package/docs/html/interfaces/IBoostedTransactions.html +14 -1
- package/docs/html/interfaces/IBtInfo.html +372 -0
- package/docs/html/interfaces/ICanBoostResponse.html +265 -0
- package/docs/html/interfaces/ICoinSelectResponse.html +265 -0
- package/docs/html/interfaces/ICreateTransaction.html +25 -5
- package/docs/html/interfaces/ICustomGetAddress.html +17 -4
- package/docs/html/interfaces/ICustomGetScriptHash.html +16 -3
- package/docs/html/interfaces/IElectrumGetAddressBalanceRes.html +17 -4
- package/docs/html/interfaces/IFormattedPeerData.html +19 -6
- package/docs/html/interfaces/IFormattedTransaction.html +43 -23
- package/docs/html/interfaces/IFormattedTransactions.html +14 -1
- package/docs/html/interfaces/IGenerateAddresses.html +21 -8
- package/docs/html/interfaces/IGenerateAddressesResponse.html +16 -3
- package/docs/html/interfaces/IGetAddress.html +17 -4
- package/docs/html/interfaces/IGetAddressBalanceRes.html +16 -3
- package/docs/html/interfaces/IGetAddressByPath.html +16 -3
- package/docs/html/interfaces/IGetAddressHistoryResponse.html +21 -8
- package/docs/html/interfaces/IGetAddressResponse.html +17 -4
- package/docs/html/interfaces/IGetAddressScriptHashBalances.html +19 -6
- package/docs/html/interfaces/IGetAddressScriptHashesHistoryResponse.html +19 -6
- package/docs/html/interfaces/IGetAddressTxResponse.html +19 -6
- package/docs/html/interfaces/IGetAddressesFromKeyPair.html +16 -3
- package/docs/html/interfaces/IGetAddressesFromPrivateKey.html +16 -3
- package/docs/html/interfaces/IGetDerivationPath.html +20 -7
- package/docs/html/interfaces/IGetFeeEstimatesResponse.html +18 -5
- package/docs/html/interfaces/IGetHeaderResponse.html +19 -6
- package/docs/html/interfaces/IGetNextAvailableAddressResponse.html +18 -5
- package/docs/html/interfaces/IGetTransactions.html +19 -6
- package/docs/html/interfaces/IGetTransactionsFromInputs.html +19 -6
- package/docs/html/interfaces/IGetUtxosResponse.html +16 -3
- package/docs/html/interfaces/IHeader.html +17 -4
- package/docs/html/interfaces/IIndexes.html +18 -5
- package/docs/html/interfaces/IKeyDerivationPath.html +19 -6
- package/docs/html/interfaces/IKeyDerivationPathData.html +16 -3
- package/docs/html/interfaces/INewBlock.html +16 -3
- package/docs/html/interfaces/IOnchainFees.html +19 -6
- package/docs/html/interfaces/IOutput.html +17 -4
- package/docs/html/interfaces/IPeerData.html +17 -4
- package/docs/html/interfaces/IPrivateKeyInfo.html +18 -5
- package/docs/html/interfaces/IRbfData.html +27 -7
- package/docs/html/interfaces/ISend.html +16 -3
- package/docs/html/interfaces/ISendTransaction.html +30 -17
- package/docs/html/interfaces/ISendTx.html +17 -4
- package/docs/html/interfaces/ISetupTransaction.html +19 -6
- package/docs/html/interfaces/ISubscribeToAddress.html +18 -5
- package/docs/html/interfaces/ISubscribeToHeader.html +18 -5
- package/docs/html/interfaces/ISweepPrivateKey.html +19 -6
- package/docs/html/interfaces/ISweepPrivateKeyRes.html +17 -4
- package/docs/html/interfaces/ITargets.html +18 -5
- package/docs/html/interfaces/ITransaction.html +20 -7
- package/docs/html/interfaces/ITxHash.html +15 -2
- package/docs/html/interfaces/ITxHashes.html +17 -4
- package/docs/html/interfaces/IUtxo.html +24 -11
- package/docs/html/interfaces/IVin.html +19 -6
- package/docs/html/interfaces/IVout.html +17 -4
- package/docs/html/interfaces/IWallet.html +47 -27
- package/docs/html/interfaces/IWalletData.html +32 -19
- package/docs/html/types/ElectrumConnectionPubSub.html +14 -1
- package/docs/html/types/ElectrumConnectionSubscription.html +15 -2
- package/docs/html/types/InputData.html +14 -1
- package/docs/html/types/Net.html +227 -0
- package/docs/html/types/ObjectKeys.html +14 -1
- package/docs/html/types/Result.html +14 -1
- package/docs/html/types/TAddressIndexInfo.html +14 -1
- package/docs/html/types/TAddressLabel.html +14 -1
- package/docs/html/types/TAddressTxResponse.html +14 -1
- package/docs/html/types/TAddressType.html +14 -1
- package/docs/html/types/TAddressTypeContent.html +14 -1
- package/docs/html/types/TAddressTypes.html +14 -1
- package/docs/html/types/TAvailableNetworks.html +14 -1
- package/docs/html/types/TConnectToElectrumRes.html +14 -1
- package/docs/html/types/TDecodeRawTx.html +14 -1
- package/docs/html/types/TElectrumNetworks.html +14 -1
- package/docs/html/types/TGapLimitOptions.html +20 -3
- package/docs/html/types/TGetAddressHistory.html +14 -1
- package/docs/html/types/TGetByteCountInput.html +14 -1
- package/docs/html/types/TGetByteCountInputs.html +14 -1
- package/docs/html/types/TGetByteCountOutput.html +14 -1
- package/docs/html/types/TGetByteCountOutputs.html +14 -1
- package/docs/html/types/TGetData.html +14 -1
- package/docs/html/types/TGetTotalFeeObj.html +14 -1
- package/docs/html/types/TKeyDerivationAccount.html +14 -1
- package/docs/html/types/TKeyDerivationChange.html +14 -1
- package/docs/html/types/TKeyDerivationCoinType.html +14 -1
- package/docs/html/types/TKeyDerivationIndex.html +14 -1
- package/docs/html/types/TKeyDerivationPurpose.html +14 -1
- package/docs/html/types/TMessageDataMap.html +14 -1
- package/docs/html/types/TMessageKeys.html +14 -1
- package/docs/html/types/TOnMessage.html +14 -1
- package/docs/html/types/TProcessUnconfirmedTransactions.html +14 -1
- package/docs/html/types/TProtocol.html +14 -1
- package/docs/html/types/TServer.html +14 -1
- package/docs/html/types/TSetData.html +14 -1
- package/docs/html/types/TSetupTransactionResponse.html +14 -1
- package/docs/html/types/TStorage.html +14 -1
- package/docs/html/types/TSubscribedReceive.html +14 -1
- package/docs/html/types/TTransactionMessage.html +14 -1
- package/docs/html/types/TTxDetails.html +17 -4
- package/docs/html/types/TTxResponse.html +14 -1
- package/docs/html/types/TTxResult.html +14 -1
- package/docs/html/types/TUnspentAddressScriptHash.html +238 -0
- package/docs/html/types/TUnspentAddressScriptHashData.html +14 -1
- package/docs/html/types/TUnspentAddressScriptHashResponse.html +240 -0
- package/docs/html/types/TUnspentAddressScriptHashResult.html +240 -0
- package/docs/html/types/TWalletDataKeys.html +14 -1
- package/docs/html/types/Tls.html +227 -0
- package/docs/html/variables/defaultElectrumPorts.html +14 -1
- package/docs/html/variables/electrumConnection.html +14 -1
- package/docs/markdown/README.md +265 -102
- package/docs/markdown/classes/Electrum.md +104 -52
- package/docs/markdown/classes/Transaction.md +101 -24
- package/docs/markdown/classes/Wallet.md +286 -129
- package/docs/markdown/enums/EAddressType.md +4 -4
- package/docs/markdown/enums/EAvailableNetworks.md +7 -7
- package/docs/markdown/enums/EBoostType.md +2 -2
- package/docs/markdown/enums/ECoinSelectPreference.md +63 -0
- package/docs/markdown/enums/EElectrumNetworks.md +3 -3
- package/docs/markdown/enums/EFeeId.md +5 -5
- package/docs/markdown/enums/EPaymentType.md +2 -2
- package/docs/markdown/enums/EProtocol.md +2 -2
- package/docs/markdown/enums/EScanningStrategy.md +4 -4
- package/docs/markdown/enums/EUnit.md +3 -3
- package/docs/markdown/interfaces/IAddInput.md +3 -3
- package/docs/markdown/interfaces/IAddress.md +5 -5
- package/docs/markdown/interfaces/IAddressData.md +3 -3
- package/docs/markdown/interfaces/IAddressTypeData.md +6 -6
- package/docs/markdown/interfaces/IAddressTypesIO.md +48 -0
- package/docs/markdown/interfaces/IBoostedTransaction.md +4 -4
- package/docs/markdown/interfaces/IBtInfo.md +102 -0
- package/docs/markdown/interfaces/ICanBoostResponse.md +41 -0
- package/docs/markdown/interfaces/ICoinSelectResponse.md +41 -0
- package/docs/markdown/interfaces/ICreateTransaction.md +13 -2
- package/docs/markdown/interfaces/ICustomGetAddress.md +3 -3
- package/docs/markdown/interfaces/ICustomGetScriptHash.md +2 -2
- package/docs/markdown/interfaces/IElectrumGetAddressBalanceRes.md +3 -3
- package/docs/markdown/interfaces/IFormattedPeerData.md +5 -5
- package/docs/markdown/interfaces/IFormattedTransaction.md +31 -20
- package/docs/markdown/interfaces/IGenerateAddresses.md +7 -7
- package/docs/markdown/interfaces/IGenerateAddressesResponse.md +2 -2
- package/docs/markdown/interfaces/IGetAddress.md +3 -3
- package/docs/markdown/interfaces/IGetAddressBalanceRes.md +2 -2
- package/docs/markdown/interfaces/IGetAddressByPath.md +2 -2
- package/docs/markdown/interfaces/IGetAddressHistoryResponse.md +7 -7
- package/docs/markdown/interfaces/IGetAddressResponse.md +3 -3
- package/docs/markdown/interfaces/IGetAddressScriptHashBalances.md +5 -5
- package/docs/markdown/interfaces/IGetAddressScriptHashesHistoryResponse.md +5 -5
- package/docs/markdown/interfaces/IGetAddressTxResponse.md +5 -5
- package/docs/markdown/interfaces/IGetAddressesFromKeyPair.md +2 -2
- package/docs/markdown/interfaces/IGetAddressesFromPrivateKey.md +2 -2
- package/docs/markdown/interfaces/IGetDerivationPath.md +6 -6
- package/docs/markdown/interfaces/IGetFeeEstimatesResponse.md +4 -4
- package/docs/markdown/interfaces/IGetHeaderResponse.md +5 -5
- package/docs/markdown/interfaces/IGetNextAvailableAddressResponse.md +4 -4
- package/docs/markdown/interfaces/IGetTransactions.md +5 -5
- package/docs/markdown/interfaces/IGetTransactionsFromInputs.md +5 -5
- package/docs/markdown/interfaces/IGetUtxosResponse.md +2 -2
- package/docs/markdown/interfaces/IHeader.md +3 -3
- package/docs/markdown/interfaces/IIndexes.md +4 -4
- package/docs/markdown/interfaces/IKeyDerivationPath.md +5 -5
- package/docs/markdown/interfaces/IKeyDerivationPathData.md +2 -2
- package/docs/markdown/interfaces/INewBlock.md +2 -2
- package/docs/markdown/interfaces/IOnchainFees.md +5 -5
- package/docs/markdown/interfaces/IOutput.md +3 -3
- package/docs/markdown/interfaces/IPeerData.md +3 -3
- package/docs/markdown/interfaces/IPrivateKeyInfo.md +4 -4
- package/docs/markdown/interfaces/IRbfData.md +17 -6
- package/docs/markdown/interfaces/ISend.md +2 -2
- package/docs/markdown/interfaces/ISendTransaction.md +16 -16
- package/docs/markdown/interfaces/ISendTx.md +3 -3
- package/docs/markdown/interfaces/ISetupTransaction.md +5 -5
- package/docs/markdown/interfaces/ISubscribeToAddress.md +4 -4
- package/docs/markdown/interfaces/ISubscribeToHeader.md +4 -4
- package/docs/markdown/interfaces/ISweepPrivateKey.md +5 -5
- package/docs/markdown/interfaces/ISweepPrivateKeyRes.md +3 -3
- package/docs/markdown/interfaces/ITargets.md +4 -4
- package/docs/markdown/interfaces/ITransaction.md +6 -6
- package/docs/markdown/interfaces/ITxHash.md +1 -1
- package/docs/markdown/interfaces/ITxHashes.md +3 -3
- package/docs/markdown/interfaces/IUtxo.md +10 -10
- package/docs/markdown/interfaces/IVin.md +5 -5
- package/docs/markdown/interfaces/IVout.md +3 -3
- package/docs/markdown/interfaces/IWallet.md +35 -24
- package/docs/markdown/interfaces/IWalletData.md +18 -18
- package/package.json +57 -10
- package/.eslintignore +0 -4
- package/.eslintrc +0 -40
- package/.github/workflows/lint-check.yml +0 -28
- package/.github/workflows/tests.yml +0 -43
- package/.github/workflows/type-check.yml +0 -28
- package/.prettierrc +0 -9
- package/dist/index.d.ts +0 -1188
- package/docker/docker-compose.yml +0 -77
- package/docker/electrs.toml +0 -1
- package/example/helpers.ts +0 -83
- package/example/index.ts +0 -89
- package/src/electrum/constants.ts +0 -2
- package/src/electrum/index.ts +0 -1019
- package/src/index.ts +0 -6
- package/src/shapes/electrum.ts +0 -13
- package/src/shapes/index.ts +0 -2
- package/src/shapes/wallet.ts +0 -144
- package/src/transaction/index.ts +0 -1563
- package/src/types/electrum.ts +0 -211
- package/src/types/index.ts +0 -3
- package/src/types/transaction.ts +0 -98
- package/src/types/wallet.ts +0 -622
- package/src/utils/conversion.ts +0 -23
- package/src/utils/derivation-path.ts +0 -173
- package/src/utils/electrum.ts +0 -233
- package/src/utils/helpers.ts +0 -347
- package/src/utils/index.ts +0 -6
- package/src/utils/result.ts +0 -79
- package/src/utils/transaction.ts +0 -440
- package/src/utils/wallet.ts +0 -477
- package/src/wallet/constants.ts +0 -28
- package/src/wallet/index.ts +0 -4055
- package/tests/boost.test.ts +0 -257
- package/tests/constants.ts +0 -13
- package/tests/derivation.test.ts +0 -132
- package/tests/electrum.test.ts +0 -87
- package/tests/expected-results.ts +0 -252
- package/tests/receive.test.ts +0 -216
- package/tests/storage.test.ts +0 -182
- package/tests/transaction.test.ts +0 -438
- package/tests/utils.ts +0 -142
- package/tests/wallet.test.ts +0 -388
- package/tsconfig.json +0 -32
- package/typedoc.json +0 -5
package/README.md
CHANGED
|
@@ -1,220 +1,557 @@
|
|
|
1
1
|
# Beignet
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A self-custodial Bitcoin wallet library for JavaScript/TypeScript, with a full Lightning Network implementation.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Beignet provides two layers of Bitcoin wallet functionality:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- **On-chain wallet** — HD key management, address generation, UTXO tracking, transaction building, and Electrum server connectivity.
|
|
10
|
+
- **Lightning Network** — A complete BOLT-compliant Lightning implementation in TypeScript, supporting channel management, onion-routed payments, BOLT 11 invoices, gossip-based routing, and real TCP transport. Tested against LND, CLN, and Eclair on regtest.
|
|
10
11
|
|
|
11
12
|
## Table of Contents
|
|
12
13
|
|
|
13
14
|
1. [Getting Started](#getting-started)
|
|
14
|
-
2. [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
2. [On-Chain Wallet](#on-chain-wallet)
|
|
16
|
+
3. [Lightning Network](#lightning-network)
|
|
17
|
+
- [Lightning Quick Start (BeignetNode)](#lightning-quick-start-beignetnode)
|
|
18
|
+
- [Decision-Support APIs](#decision-support-apis)
|
|
19
|
+
- [HTTP Daemon](#http-daemon)
|
|
20
|
+
- [Advanced API (LightningNode)](#advanced-api-lightningnode)
|
|
21
|
+
- [Architecture](#architecture)
|
|
22
|
+
- [BOLT Coverage](#bolt-coverage)
|
|
23
|
+
- [Module Reference](#module-reference)
|
|
24
|
+
4. [Running Tests](#running-tests)
|
|
25
|
+
5. [Interop Testing](#interop-testing)
|
|
26
|
+
6. [React Native](#react-native)
|
|
27
|
+
7. [Documentation](#documentation)
|
|
28
|
+
8. [Support](#support)
|
|
23
29
|
|
|
24
30
|
## Getting Started
|
|
25
31
|
|
|
26
32
|
```bash
|
|
33
|
+
# Using npm
|
|
34
|
+
npm install beignet
|
|
35
|
+
|
|
27
36
|
# Using Yarn
|
|
28
37
|
yarn add beignet
|
|
29
|
-
|
|
30
|
-
# Or, using NPM
|
|
31
|
-
npm i -S beignet
|
|
32
38
|
```
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
> Requires **Node.js 18+**
|
|
35
41
|
|
|
36
|
-
###
|
|
42
|
+
### Build from source
|
|
37
43
|
|
|
38
44
|
```bash
|
|
39
|
-
git clone git@github.com:
|
|
45
|
+
git clone git@github.com:coreyphillips/beignet.git && cd beignet
|
|
46
|
+
npm install && npm run build
|
|
40
47
|
```
|
|
41
48
|
|
|
42
|
-
###
|
|
49
|
+
### Run the examples
|
|
50
|
+
|
|
51
|
+
Both examples launch an interactive REPL with a live wallet/node instance:
|
|
43
52
|
|
|
44
53
|
```bash
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
# On-chain wallet REPL
|
|
55
|
+
npm run example
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
# Lightning node REPL (recommended — uses BeignetNode)
|
|
58
|
+
npm run example:lightning
|
|
49
59
|
|
|
50
|
-
|
|
51
|
-
npm run
|
|
52
|
-
```
|
|
60
|
+
# Low-level Lightning node REPL (uses LightningNode directly)
|
|
61
|
+
npm run example:lightning -- --low-level
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
# Lightning node with a specific mnemonic and alias
|
|
64
|
+
npm run example:lightning -- abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about --alias mynode
|
|
65
|
+
|
|
66
|
+
# Two-node payment flow demo (shows complete lifecycle)
|
|
67
|
+
npm run example:lightning -- --payment-flow
|
|
57
68
|
```
|
|
58
69
|
|
|
59
|
-
##
|
|
70
|
+
## On-Chain Wallet
|
|
71
|
+
|
|
60
72
|
```javascript
|
|
61
73
|
import { Wallet, generateMnemonic } from 'beignet';
|
|
62
74
|
|
|
63
|
-
// Generate a mnemonic phrase
|
|
64
75
|
const mnemonic = generateMnemonic();
|
|
65
76
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const wallet = createWalletRes.value;
|
|
77
|
+
const createRes = await Wallet.create({ mnemonic });
|
|
78
|
+
if (createRes.isErr()) return;
|
|
79
|
+
const wallet = createRes.value;
|
|
70
80
|
|
|
71
|
-
// View wallet data (addresses, indexes, utxos, transactions, etc.)
|
|
72
|
-
const walletData = wallet.data;
|
|
73
|
-
|
|
74
81
|
// Get receiving address
|
|
75
82
|
const address = await wallet.getAddress();
|
|
76
83
|
|
|
77
|
-
// Get address balance
|
|
78
|
-
const addressBalanceRes = await wallet.getAddressBalance(address);
|
|
79
|
-
if (addressBalance.isErr()) return;
|
|
80
|
-
const addressBalance = addressBalanceRes.value;
|
|
81
|
-
|
|
82
84
|
// Get wallet balance
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
// Refresh Wallet
|
|
86
|
-
const walletRefresh = await wallet.refreshWallet();
|
|
87
|
-
|
|
88
|
-
// Get fee information to perform a transaction.
|
|
89
|
-
const feeInfo = wallet.getFeeInfo();
|
|
85
|
+
const balance = wallet.getBalance();
|
|
90
86
|
|
|
91
87
|
// Send sats
|
|
92
|
-
const sendRes = await wallet.send({
|
|
88
|
+
const sendRes = await wallet.send({
|
|
89
|
+
address: 'bc1q...',
|
|
90
|
+
amount: 50000,
|
|
91
|
+
satPerByte: 2,
|
|
92
|
+
});
|
|
93
93
|
|
|
94
|
-
//
|
|
95
|
-
|
|
94
|
+
// Refresh wallet state from Electrum
|
|
95
|
+
await wallet.refreshWallet();
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
### Advanced On-Chain Usage
|
|
99
99
|
|
|
100
100
|
```typescript
|
|
101
101
|
import { Wallet, generateMnemonic } from 'beignet';
|
|
102
|
-
import net from 'net'
|
|
103
|
-
import tls from 'tls'
|
|
104
|
-
import { TStorage } from './wallet';
|
|
105
|
-
import { ECoinSelectPreference } from "./transaction";
|
|
102
|
+
import net from 'net';
|
|
103
|
+
import tls from 'tls';
|
|
106
104
|
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
const wallet = await Wallet.create({
|
|
106
|
+
mnemonic: generateMnemonic(),
|
|
107
|
+
passphrase: 'optional-passphrase',
|
|
108
|
+
electrumOptions: {
|
|
109
|
+
servers: { host: '127.0.0.1', ssl: 50002, tcp: 50001, protocol: 'ssl' },
|
|
110
|
+
net,
|
|
111
|
+
tls,
|
|
112
|
+
},
|
|
113
|
+
network: 'mainnet',
|
|
114
|
+
addressType: 'p2wpkh',
|
|
115
|
+
coinSelectPreference: 'consolidate',
|
|
116
|
+
});
|
|
109
117
|
|
|
110
|
-
//
|
|
111
|
-
|
|
118
|
+
// Send to multiple outputs
|
|
119
|
+
await wallet.value.sendMany({
|
|
120
|
+
txs: [
|
|
121
|
+
{ address: 'addr1', amount: 1000 },
|
|
122
|
+
{ address: 'addr2', amount: 2000 },
|
|
123
|
+
],
|
|
124
|
+
});
|
|
112
125
|
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
126
|
+
// Sweep a private key
|
|
127
|
+
await wallet.value.sweepPrivateKey({
|
|
128
|
+
privateKey: 'L...',
|
|
129
|
+
toAddress: 'bc1q...',
|
|
130
|
+
satsPerByte: 5,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// List UTXOs
|
|
134
|
+
const utxos = wallet.value.listUtxos();
|
|
120
135
|
|
|
121
|
-
//
|
|
122
|
-
const
|
|
136
|
+
// Get transaction history
|
|
137
|
+
const history = await wallet.value.getAddressHistory('bc1q...');
|
|
138
|
+
```
|
|
123
139
|
|
|
124
|
-
|
|
125
|
-
const addressType = EAddressType.p2tr;
|
|
140
|
+
## Lightning Network
|
|
126
141
|
|
|
127
|
-
|
|
128
|
-
const addressTypesToMonitor = [EAddressType.p2tr, EAddressType.p2wpkh];
|
|
142
|
+
### Lightning Quick Start (BeignetNode)
|
|
129
143
|
|
|
130
|
-
|
|
131
|
-
const onMessage: TOnMessage = (id, data) => {
|
|
132
|
-
console.log(id);
|
|
133
|
-
console.dir(data, { depth: null });
|
|
134
|
-
}
|
|
144
|
+
`BeignetNode` (from `beignet/cli`) is the recommended API — it wraps the protocol layer with a simpler, JSON-friendly interface: satoshi-denominated amounts, string channel IDs, and structured error codes.
|
|
135
145
|
|
|
136
|
-
|
|
137
|
-
const disableMessagesOnCreate = true;
|
|
146
|
+
For detailed deployment guidance, see [AI Agent Deployment Guide](docs/AI_AGENT_GUIDE.md).
|
|
138
147
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
```typescript
|
|
149
|
+
import { BeignetNode, isRetryableError } from 'beignet/cli';
|
|
150
|
+
|
|
151
|
+
// Create a node (auto-creates wallet, storage, funding provider)
|
|
152
|
+
const node = await BeignetNode.create({
|
|
153
|
+
mnemonic: 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about',
|
|
154
|
+
network: 'regtest',
|
|
155
|
+
electrumHost: '127.0.0.1',
|
|
156
|
+
electrumPort: 60001,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Get node info and health
|
|
160
|
+
console.log(node.getInfo()); // { nodeId, network, alias, ... }
|
|
161
|
+
console.log(node.getHealth()); // { status: 'ready', peers, channels, ... }
|
|
162
|
+
console.log(node.isReady()); // true when node has active channels
|
|
163
|
+
|
|
164
|
+
// Create an invoice
|
|
165
|
+
const inv = node.createInvoice(1000, 'coffee');
|
|
166
|
+
console.log(inv.bolt11);
|
|
167
|
+
|
|
168
|
+
// Pay an invoice with automatic retry logic
|
|
169
|
+
try {
|
|
170
|
+
const payment = await node.payInvoice('lnbcrt10n1...');
|
|
171
|
+
console.log(payment.status); // 'COMPLETED'
|
|
172
|
+
} catch (err) {
|
|
173
|
+
if (isRetryableError(err)) {
|
|
174
|
+
// Transient failure — safe to retry (no route, timeout, etc.)
|
|
175
|
+
} else {
|
|
176
|
+
// Permanent failure — do not retry (invalid invoice, expired, etc.)
|
|
151
177
|
}
|
|
152
|
-
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// List channels, payments, invoices
|
|
181
|
+
console.log(node.listChannels());
|
|
182
|
+
console.log(node.listPayments());
|
|
183
|
+
console.log(node.listInvoices());
|
|
184
|
+
|
|
185
|
+
// Clean shutdown
|
|
186
|
+
await node.destroy();
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Decision-Support APIs
|
|
190
|
+
|
|
191
|
+
Beignet includes built-in advisors that differentiate it from other Lightning libraries:
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
// Channel balance analysis with actionable recommendations
|
|
195
|
+
const liquidity = node.getLiquiditySnapshot();
|
|
196
|
+
console.log('Outbound:', liquidity.outboundLiquidityPct + '%');
|
|
197
|
+
for (const rec of liquidity.recommendations) {
|
|
198
|
+
console.log(`[${rec.priority}] ${rec.type}: ${rec.reason}`);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Graph-based peer suggestions for channel opens
|
|
202
|
+
const suggestions = node.getChannelSuggestions(3);
|
|
203
|
+
|
|
204
|
+
// On-chain fee trend analysis (OPEN_NOW / WAIT / NEUTRAL)
|
|
205
|
+
const fees = node.getFeeSnapshot();
|
|
206
|
+
|
|
207
|
+
// Payment success probability + estimated fee before sending
|
|
208
|
+
const estimate = node.estimatePayment(bolt11);
|
|
209
|
+
|
|
210
|
+
// 11-check mainnet readiness report with weighted score
|
|
211
|
+
const readiness = node.getMainnetReadiness();
|
|
212
|
+
console.log('Score:', readiness.score + '/100', 'Ready:', readiness.ready);
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### HTTP Daemon
|
|
216
|
+
|
|
217
|
+
BeignetNode can also run as an HTTP/SSE daemon for language-agnostic integrations:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Start the daemon (generates OpenAPI spec at /openapi.json)
|
|
221
|
+
npx beignet --mnemonic "abandon ..." --network regtest --electrum-host 127.0.0.1 --electrum-port 60001
|
|
222
|
+
|
|
223
|
+
# Create an invoice
|
|
224
|
+
curl -X POST http://localhost:2112/invoice/create -H 'Authorization: Bearer <token>' \
|
|
225
|
+
-H 'Content-Type: application/json' -d '{"amountSats": 1000, "description": "coffee"}'
|
|
226
|
+
|
|
227
|
+
# Pay an invoice
|
|
228
|
+
curl -X POST http://localhost:2112/invoice/pay -H 'Authorization: Bearer <token>' \
|
|
229
|
+
-H 'Content-Type: application/json' -d '{"bolt11": "lnbcrt10n1..."}'
|
|
230
|
+
|
|
231
|
+
# Stream events (payments, channel state changes)
|
|
232
|
+
curl -N http://localhost:2112/events -H 'Authorization: Bearer <token>'
|
|
233
|
+
|
|
234
|
+
# Simple readiness check (auth-exempt, for load balancers)
|
|
235
|
+
curl http://localhost:2112/ready
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### Response Format
|
|
153
239
|
|
|
154
|
-
|
|
155
|
-
|
|
240
|
+
All responses use: `{ "ok": true, "result": {...} }` or `{ "ok": false, "error": { "code": "...", "message": "..." } }`.
|
|
241
|
+
Full spec: `GET /openapi.json` (no auth required).
|
|
156
242
|
|
|
157
|
-
|
|
158
|
-
|
|
243
|
+
### Advanced API (LightningNode)
|
|
244
|
+
|
|
245
|
+
Most users should use `BeignetNode` above. Use `LightningNode` only if you need direct access to the protocol layer (bigint amounts, Buffer IDs, raw BOLT messages).
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
import { Wallet, generateMnemonic } from 'beignet';
|
|
249
|
+
import { LightningNode, WalletFundingProvider, Network } from 'beignet/lightning';
|
|
250
|
+
import net from 'net';
|
|
251
|
+
import tls from 'tls';
|
|
252
|
+
|
|
253
|
+
const mnemonic = generateMnemonic();
|
|
254
|
+
|
|
255
|
+
// 1. Create an on-chain wallet (same mnemonic funds both layers)
|
|
256
|
+
const wallet = (await Wallet.create({
|
|
159
257
|
mnemonic,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
network,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
addressType,
|
|
170
|
-
addressTypesToMonitor,
|
|
171
|
-
disableMessagesOnCreate,
|
|
172
|
-
coinSelectPreference
|
|
258
|
+
electrumOptions: { net, tls },
|
|
259
|
+
})).value;
|
|
260
|
+
|
|
261
|
+
// 2. Create a Lightning node with auto-funding from the wallet
|
|
262
|
+
const fundingProvider = new WalletFundingProvider(wallet);
|
|
263
|
+
const node = LightningNode.fromMnemonic(mnemonic, {
|
|
264
|
+
network: Network.REGTEST,
|
|
265
|
+
enableNetworking: true,
|
|
266
|
+
fundingProvider,
|
|
173
267
|
});
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
{ address: 'address2', amount: 2000 },
|
|
184
|
-
{ address: 'address3', amount: 3000 },
|
|
185
|
-
];
|
|
186
|
-
const sendManyRes = await wallet.sendMany({ txs });
|
|
187
|
-
|
|
188
|
-
// Sweep from a private key
|
|
189
|
-
const sweepPrivateKeyRes = await wallet.sweepPrivateKey({
|
|
190
|
-
privateKey: 'privateKey',
|
|
191
|
-
toAddress: 'toAddress',
|
|
192
|
-
satsPerByte: 5,
|
|
193
|
-
broadcast: false
|
|
268
|
+
|
|
269
|
+
// 3. Connect to a peer and open a channel — fully automatic
|
|
270
|
+
await node.connectPeer('03...pubkey', '127.0.0.1', 9735);
|
|
271
|
+
node.openChannel('03...pubkey', 100_000n);
|
|
272
|
+
|
|
273
|
+
// 4. Create a BOLT 11 invoice
|
|
274
|
+
const invoice = node.createInvoice({
|
|
275
|
+
amountMsat: 50_000n,
|
|
276
|
+
description: 'Payment for coffee',
|
|
194
277
|
});
|
|
195
278
|
|
|
196
|
-
//
|
|
197
|
-
|
|
279
|
+
// 5. Pay a BOLT 11 invoice
|
|
280
|
+
node.sendPayment(invoiceString);
|
|
198
281
|
|
|
199
|
-
//
|
|
200
|
-
|
|
282
|
+
// 6. Listen for events
|
|
283
|
+
node.on('channel:ready', (channelId) => {
|
|
284
|
+
console.log('Channel ready:', channelId.toString('hex'));
|
|
285
|
+
});
|
|
286
|
+
node.on('payment:received', (payment) => {
|
|
287
|
+
console.log('Received:', payment.amountMsat, 'msat');
|
|
288
|
+
});
|
|
289
|
+
node.on('node:error', (err) => {
|
|
290
|
+
console.error(`[${err.code}]`, err.message);
|
|
291
|
+
});
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Without a wallet** — you can skip `fundingProvider` and handle funding manually:
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
const node = LightningNode.fromMnemonic(mnemonic, {
|
|
298
|
+
network: Network.REGTEST,
|
|
299
|
+
enableNetworking: true,
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
const channel = node.openChannel('03...pubkey', 100_000n);
|
|
303
|
+
// Build your own funding tx, then:
|
|
304
|
+
const channelId = node.createFunding(channel, fundingTxid, outputIndex, signature);
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Architecture
|
|
308
|
+
|
|
309
|
+
Beignet's Lightning implementation follows a layered, transport-agnostic design:
|
|
310
|
+
|
|
311
|
+
```
|
|
312
|
+
LightningNode ← High-level API (EventEmitter)
|
|
313
|
+
├── ChannelManager ← Multiplexes messages to Channel instances
|
|
314
|
+
│ └── Channel ← BOLT 2 state machine (returns ChannelAction[])
|
|
315
|
+
├── PeerManager ← TCP connections + Noise_XK encrypted transport
|
|
316
|
+
│ └── Peer ← Per-connection BOLT 8 handshake + message framing
|
|
317
|
+
├── NetworkGraph ← BOLT 7 gossip topology + Dijkstra pathfinding
|
|
318
|
+
├── InvoiceManager ← BOLT 11 encode/decode/sign
|
|
319
|
+
├── ChainMonitor ← BOLT 5 force-close detection + sweep
|
|
320
|
+
└── FundingProvider? ← Auto-builds + broadcasts funding txs (via Wallet)
|
|
201
321
|
```
|
|
202
322
|
|
|
323
|
+
**Key design principle:** The `Channel` class is fully transport-agnostic. Every method returns `ChannelAction[]` arrays (send message, broadcast tx, watch output, etc.) that the `ChannelManager` maps to real transport or chain operations. This makes the state machine fully testable without network I/O.
|
|
324
|
+
|
|
325
|
+
### BOLT Coverage
|
|
326
|
+
|
|
327
|
+
| BOLT | Specification | Status |
|
|
328
|
+
|------|--------------|--------|
|
|
329
|
+
| 1 | Base Protocol | Peer messaging, init, error, ping/pong, feature negotiation |
|
|
330
|
+
| 2 | Channel Management | Full state machine: open, fund, normal operation, shutdown, close, reestablish; v2 dual-funded opens (interactive-tx), splicing, quiescence |
|
|
331
|
+
| 3 | Transactions | Commitment txs, HTLC scripts, funding scripts, anchor outputs, fee calculation; simple taproot channels (MuSig2 funding, Schnorr HTLC sigs) |
|
|
332
|
+
| 4 | Onion Routing | Sphinx encryption, TLV hop payloads, payment_secret, failure codes, route blinding, onion messages |
|
|
333
|
+
| 5 | On-Chain | Force-close detection, HTLC sweep, output resolution, chain monitoring, wallet-funded anchor fee bumping (commitment CPFP + zero-fee HTLC fee-attach) |
|
|
334
|
+
| 7 | Gossip | Channel/node announcements, network graph, Dijkstra routing, gossip sync |
|
|
335
|
+
| 8 | Transport | Noise_XK handshake, encrypted transport, key rotation |
|
|
336
|
+
| 9 | Features | DATA_LOSS_PROTECT, STATIC_REMOTE_KEY, PAYMENT_SECRET, TLV_ONION, BASIC_MPP, CHANNEL_TYPE, GOSSIP_QUERIES, ANCHORS_ZERO_FEE_HTLC_TX (default), ROUTE_BLINDING, ONION_MESSAGES, QUIESCE, SCID_ALIAS, ZERO_CONF, KEYSEND, OPTION_TAPROOT, OPTION_WILL_FUND |
|
|
337
|
+
| 11 | Invoices | Encode, decode, sign, verify, amount formatting, hold invoices |
|
|
338
|
+
| 12 | Offers | Offer encode/decode, invoice_request/invoice exchange over onion messages, receive-side settlement, async payment offers |
|
|
339
|
+
| bLIP-51 | Liquidity Ads | lease_rates/request_funds/will_fund negotiation, lease fee accounting, CLTV-locked lessor to_local, advisor lease quoting |
|
|
340
|
+
|
|
341
|
+
### Module Reference
|
|
342
|
+
|
|
343
|
+
The Lightning implementation is organized into 21 modules under `src/lightning/`:
|
|
344
|
+
|
|
345
|
+
| Module | Description |
|
|
346
|
+
|--------|-------------|
|
|
347
|
+
| `crypto/` | ChaCha20-Poly1305 AEAD, ECDH, HKDF key derivation, MuSig2 (BIP327) for taproot channels |
|
|
348
|
+
| `message/` | Wire protocol encode/decode for all channel, gossip, and control messages |
|
|
349
|
+
| `features/` | Feature flag bitmap management (BOLT 9) |
|
|
350
|
+
| `transport/` | Noise_XK handshake, encrypted transport cipher, TCP peer connections, PeerManager |
|
|
351
|
+
| `keys/` | HD key derivation, per-commitment secrets (shachain), transaction signing, wallet key derivation |
|
|
352
|
+
| `script/` | Funding (2-of-2 multisig), commitment tx outputs, HTLC scripts, revocation, anchor outputs, taproot commitment/HTLC scripts |
|
|
353
|
+
| `channel/` | Channel state machine, ChannelManager, commitment builder, channel actions, validation, liquidity ads |
|
|
354
|
+
| `chain/` | ChainMonitor, ChainWatcher, output resolver, closing tx, sweep tx, Electrum backend |
|
|
355
|
+
| `invoice/` | BOLT 11 invoice encoding/decoding, bech32 word conversion, signature verification |
|
|
356
|
+
| `gossip/` | NetworkGraph, Dijkstra pathfinding, gossip sync state machine, SCID encoding |
|
|
357
|
+
| `onion/` | Sphinx crypto, onion packet construction/processing, hop payloads, failure handling, blinded paths |
|
|
358
|
+
| `onion-message/` | BOLT 4 onion message construction/processing (carries BOLT 12 and async-payment messages) |
|
|
359
|
+
| `offer/` | BOLT 12 offers: encode/decode, OfferManager invoice_request/invoice flows |
|
|
360
|
+
| `async-payments/` | Hold invoices and AsyncPaymentManager (LSP held-forward, release_held_htlc, wake) |
|
|
361
|
+
| `interactive-tx/` | Interactive transaction construction for v2 dual-funded opens and splicing |
|
|
362
|
+
| `node/` | LightningNode orchestrator — the main entry point for the Lightning API |
|
|
363
|
+
| `wallet/` | WalletFundingProvider — adapts the on-chain Wallet for auto-funded channel opens |
|
|
364
|
+
| `bootstrap/` | DNS seed resolution for discovering initial Lightning peers |
|
|
365
|
+
| `advisor/` | Liquidity, fee, and channel suggestion advisors for AI agents |
|
|
366
|
+
| `storage/` | SQLite persistence backend, channel state serialization/deserialization |
|
|
367
|
+
| `validation/` | Input validation utilities shared across modules |
|
|
368
|
+
|
|
369
|
+
The `BeignetNode` wrapper (`src/cli/beignet-node.ts`) provides a simplified, JSON-friendly API on top of `LightningNode` for AI agents and programmatic use.
|
|
370
|
+
|
|
371
|
+
### LightningNode API
|
|
372
|
+
|
|
373
|
+
`LightningNode` is an `EventEmitter` that provides the high-level API:
|
|
374
|
+
|
|
375
|
+
**Peer Management:**
|
|
376
|
+
- `connectPeer(pubkey, host, port)` — Establish encrypted connection
|
|
377
|
+
- `disconnectPeer(pubkey)` — Disconnect from peer
|
|
378
|
+
- `listPeers()` — List connected peers
|
|
379
|
+
- `getNodeId()` — Get this node's public key
|
|
380
|
+
|
|
381
|
+
**Channel Operations:**
|
|
382
|
+
- `openChannel(peerPubkey, fundingSatoshis, pushMsat?)` — Open a channel (auto-funds when `fundingProvider` is set)
|
|
383
|
+
- `createFunding(channel, txid, outputIndex, signature)` — Manual funding (when no `fundingProvider`)
|
|
384
|
+
- `handleFundingConfirmed(channelId)` — Notify funding tx confirmed
|
|
385
|
+
- `closeChannel(channelId, scriptPubkey)` — Cooperative close
|
|
386
|
+
- `forceCloseChannel(channelId, destinationScript)` — Force close (unilateral)
|
|
387
|
+
- `listChannels()` — List all channels
|
|
388
|
+
- `getChannel(channelId)` — Get channel details
|
|
389
|
+
|
|
390
|
+
**Payments:**
|
|
391
|
+
- `createInvoice(options)` — Generate a BOLT 11 invoice
|
|
392
|
+
- `sendPayment(invoiceString)` — Send a payment
|
|
393
|
+
- `sendPaymentToRoute(route, paymentHash, ...)` — Send via explicit route
|
|
394
|
+
|
|
395
|
+
**Chain Events:**
|
|
396
|
+
- `handleNewBlock(height)` — Process new block
|
|
397
|
+
- `handleOutputSpent(txid, index, spendingTx, height)` — Track spent outputs
|
|
398
|
+
|
|
399
|
+
**Events:**
|
|
400
|
+
- `payment:received` — Incoming payment fulfilled
|
|
401
|
+
- `payment:sent` — Outgoing payment succeeded
|
|
402
|
+
- `payment:failed` — Outgoing payment failed
|
|
403
|
+
- `channel:ready` — Channel entered NORMAL state
|
|
404
|
+
- `channel:closed` — Channel closed
|
|
405
|
+
- `peer:connect` / `peer:disconnect` — Peer connection changes
|
|
406
|
+
- `node:error` — Structured error (code, message, channelId, timestamp)
|
|
407
|
+
|
|
408
|
+
## Running Tests
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
# Run lightning unit tests (2740+ tests, no infrastructure needed)
|
|
412
|
+
npm run test:lightning
|
|
413
|
+
|
|
414
|
+
# Run CLI unit tests (720 CLI tests, no infrastructure needed)
|
|
415
|
+
npm run test:cli
|
|
416
|
+
|
|
417
|
+
# Run daemon/Electrum integration tests (requires Electrum server)
|
|
418
|
+
npm run test:integration
|
|
419
|
+
|
|
420
|
+
# Run interop tests against LND/CLN/Eclair (requires Docker)
|
|
421
|
+
npm run test:interop
|
|
422
|
+
|
|
423
|
+
# Run everything (requires Docker + Electrum)
|
|
424
|
+
npm run test:all
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Test Coverage
|
|
428
|
+
|
|
429
|
+
The Lightning implementation has **2740+ lightning unit tests + 129 interop tests + 720 CLI tests** across many phases:
|
|
430
|
+
|
|
431
|
+
| Phase | Tests | Coverage |
|
|
432
|
+
|-------|-------|---------|
|
|
433
|
+
| Crypto & Messages | 115 | ChaCha20-Poly1305, HKDF, ECDH, codec, TLV, init, error, feature flags |
|
|
434
|
+
| Transport (BOLT 8) | — | Noise_XK handshake, cipher, ping/pong, peer connections, PeerManager |
|
|
435
|
+
| Keys & Scripts (BOLT 3) | — | Key derivation, shachain, signer, funding, commitment, HTLC, revocation |
|
|
436
|
+
| Channel State Machine (BOLT 2) | 161 | Message encode/decode, channel types, validation, Channel, commitment builder, ChannelManager |
|
|
437
|
+
| Chain Monitor (BOLT 5) | 67 | Closing tx, sweep tx, output resolver, chain monitor, force close |
|
|
438
|
+
| Invoices (BOLT 11) | 98 | Types, words, amount, signing, decode, encode |
|
|
439
|
+
| Gossip & Routing (BOLT 7) | 104 | SCID, messages, validation, network graph, pathfinding |
|
|
440
|
+
| Onion & Payments (BOLT 4) | 83 | Sphinx crypto, hop payloads, onion construction/processing, failure handling |
|
|
441
|
+
| Node API | 50 | LightningNode orchestrator, invoice management, payment send/receive, HTLC forwarding |
|
|
442
|
+
| PeerManager Integration | 18 | PeerManager wiring, peer management, event forwarding |
|
|
443
|
+
| Production Hardening | — | Error visibility, input validation, resource management, BOLT 1 error propagation |
|
|
444
|
+
| **Interop (LND/CLN/Eclair)** | **129** | **Multi-implementation interop: TCP handshake, channel lifecycle, bidirectional payments, anchor channels, anchor force-close with wallet-funded CPFP + HTLC-timeout fee-attach, crash recovery against LND v0.20.0, CLN, and Eclair** |
|
|
445
|
+
|
|
446
|
+
## Interop Testing
|
|
447
|
+
|
|
448
|
+
The interop test suite validates beignet against real Lightning implementations on Bitcoin regtest.
|
|
449
|
+
|
|
450
|
+
### Prerequisites
|
|
451
|
+
|
|
452
|
+
- Docker and Docker Compose
|
|
453
|
+
- Node.js 18+
|
|
454
|
+
|
|
455
|
+
### Setup
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
# Start bitcoind + LND + CLN + Eclair containers
|
|
459
|
+
docker compose -f docker/docker-compose.yml up -d
|
|
460
|
+
|
|
461
|
+
# Wait for nodes to sync (~30 seconds)
|
|
462
|
+
|
|
463
|
+
# Run interop tests
|
|
464
|
+
npm run test:interop
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### What's Tested
|
|
468
|
+
|
|
469
|
+
#### LND (43 tests)
|
|
470
|
+
|
|
471
|
+
| Tier | Tests | Validates |
|
|
472
|
+
|------|-------|-----------|
|
|
473
|
+
| **1: TCP & Init** | 5 | BOLT 8 Noise_XK handshake, BOLT 1 init exchange, feature negotiation, disconnect/reconnect, ping/pong survival |
|
|
474
|
+
| **2: Channel Open** | 3 | LND opens channel to beignet, balance verification, error-free lifecycle |
|
|
475
|
+
| **3: LND pays beignet** | 3 | Receive payment from LND, payment_secret validation, multiple sequential payments |
|
|
476
|
+
| **4: Beignet pays LND** | 3 | Pay LND invoice, outbound payment_secret, graceful failure handling |
|
|
477
|
+
| **5-9: Advanced** | 11 | Channel close, reestablish, gossip sync, MPP payments, SCID aliases |
|
|
478
|
+
| **10: Inbound connections** | 4 | LND connects to beignet listener, channel open from inbound peer |
|
|
479
|
+
| **11-13: Anchor & Recovery** | 14 | Anchor channels, beignet-funded opens, crash recovery |
|
|
480
|
+
|
|
481
|
+
#### CLN (42 tests)
|
|
482
|
+
|
|
483
|
+
| Tier | Tests | Validates |
|
|
484
|
+
|------|-------|-----------|
|
|
485
|
+
| **1: TCP & Init** | 5 | BOLT 8 handshake, init exchange, feature negotiation |
|
|
486
|
+
| **2-9: Channel & Payments** | 23 | Channel lifecycle, bidirectional payments, close, reestablish, gossip, MPP, SCID aliases |
|
|
487
|
+
| **10: Inbound** | 4 | Inbound connections from CLN |
|
|
488
|
+
| **12-14: Anchor & Recovery** | 10 | Anchor channels, beignet-funded opens, crash recovery |
|
|
489
|
+
|
|
490
|
+
#### Eclair (42 tests)
|
|
491
|
+
|
|
492
|
+
| Tier | Tests | Validates |
|
|
493
|
+
|------|-------|-----------|
|
|
494
|
+
| **1: TCP & Init** | 5 | BOLT 8 handshake, init exchange, feature negotiation |
|
|
495
|
+
| **2-9: Channel & Payments** | 23 | Channel lifecycle, bidirectional payments, close, reestablish, gossip, MPP |
|
|
496
|
+
| **10: Inbound** | 4 | Inbound connections from Eclair |
|
|
497
|
+
| **12-14: Anchor & Recovery** | 10 | Anchor channels, beignet-funded opens, crash recovery |
|
|
498
|
+
|
|
499
|
+
Interop tests are excluded from `npm run test:lightning` (which runs only unit tests). Use `npm run test:interop` to run them, or `npm run test:all` to run everything.
|
|
500
|
+
|
|
501
|
+
### Docker Compose Services
|
|
502
|
+
|
|
503
|
+
The `docker/docker-compose.yml` includes:
|
|
504
|
+
- **bitcoind** — Bitcoin Core regtest node (RPC port 43782, ZMQ on 28334/28335)
|
|
505
|
+
- **LND** — Lightning Network Daemon v0.20.0-beta (P2P port 9735, REST port 8081)
|
|
506
|
+
- **CLN** — Core Lightning (CLNRest API on port 3010)
|
|
507
|
+
- **Eclair** — ACINQ Eclair (HTTP API on port 8082)
|
|
508
|
+
|
|
509
|
+
## Known Limitations
|
|
510
|
+
|
|
511
|
+
Beignet is under active development. The following features are missing or carry caveats:
|
|
512
|
+
|
|
513
|
+
| Feature | Status | Impact |
|
|
514
|
+
|---------|--------|--------|
|
|
515
|
+
| **Watchtowers** | Not implemented | If your node goes offline, a counterparty could theoretically broadcast a revoked state. Mitigate with frequent backups and auto-reconnect. |
|
|
516
|
+
| **LSP / LSPS protocols** | Not implemented | No automated inbound liquidity acquisition via LSPS0/1/2. Liquidity ads (bLIP-51) are supported for negotiated leases; otherwise open channels manually. |
|
|
517
|
+
| **Trampoline routing** | Not implemented | All route computation is local. Cannot delegate pathfinding to a trampoline node. |
|
|
518
|
+
| **BOLT 12 offers** | Newer | Offer creation/decoding, invoice_request/invoice over onion messages, and receive-side settlement are implemented, but the surface is newer and less battle-tested than BOLT 11. Prefer BOLT 11 invoices for production. |
|
|
519
|
+
| **Async payments** | Implemented (LSP-dependent) | Hold invoices plus AsyncPaymentManager let an offline receiver be paid, but the receiver's LSP must run the held-forward/wake flow. |
|
|
520
|
+
| **Simple taproot channels** | Experimental | Opens, payments both directions, force-close, and reestablish validated against LND v0.20 on regtest; the feature bit is still in staging upstream. Not recommended for mainnet balances yet. |
|
|
521
|
+
| **Splicing / dual funding** | Partial | Splice-out and splice-in validated live against CLN on mainnet; v2 dual-funded opens implemented. CLN-initiated splices, repeat splices, and multi-UTXO splice-ins are untested. |
|
|
522
|
+
| **Mainnet battle-testing** | Limited | Interop-tested against LND/CLN/Eclair on regtest. Exercise caution with large mainnet balances. |
|
|
523
|
+
| **Mobile background** | Limited | Works on React Native but lacks mobile-specific optimizations (background sync, push notifications). |
|
|
524
|
+
|
|
525
|
+
**Recommended safeguards for production use:**
|
|
526
|
+
- Set `maxPaymentSats` and `dailySpendLimitSats` to cap exposure
|
|
527
|
+
- Use `validatePayment()` before every send to catch problems early
|
|
528
|
+
- Enable `backupPath` for automated database backups
|
|
529
|
+
- Use `electrumServers` (plural) for connection redundancy
|
|
530
|
+
- Monitor `node:error` events and `/health` endpoint
|
|
531
|
+
- Start with small channel sizes and increase gradually
|
|
532
|
+
|
|
203
533
|
## React Native
|
|
204
534
|
|
|
205
|
-
You can use `react-native-tcp-socket` as a drop
|
|
535
|
+
You can use `react-native-tcp-socket` as a drop-in replacement for `net` & `tls`:
|
|
206
536
|
|
|
207
537
|
```json
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
538
|
+
{
|
|
539
|
+
"react-native": {
|
|
540
|
+
"net": "react-native-tcp-socket",
|
|
541
|
+
"tls": "react-native-tcp-socket"
|
|
542
|
+
}
|
|
211
543
|
}
|
|
212
544
|
```
|
|
213
545
|
|
|
214
546
|
## Documentation
|
|
547
|
+
|
|
215
548
|
- [HTML](docs/html/classes/Wallet.html)
|
|
216
549
|
- [Markdown](docs/markdown/classes/Wallet.md)
|
|
217
550
|
|
|
218
551
|
## Support
|
|
219
552
|
|
|
220
553
|
If you are experiencing any problems, please open an issue or reach out to us on [Telegram](https://t.me/bitkitchat).
|
|
554
|
+
|
|
555
|
+
## License
|
|
556
|
+
|
|
557
|
+
MIT
|