From 2fac4e2e14874d6865820783738f989295f4c94f Mon Sep 17 00:00:00 2001 From: jackstar12 <62219658+jackstar12@users.noreply.github.com> Date: Tue, 7 Jan 2025 18:19:37 +0100 Subject: [PATCH] refactor: package structure (#366) --- .gitignore | 8 ++--- .mockery.yaml | 9 ++--- Makefile | 6 ++-- cmd/boltzcli/boltzcli.go | 6 ++-- cmd/boltzcli/commands.go | 12 +++---- cmd/boltzcli/utils.go | 6 ++-- cmd/boltzd/boltzd.go | 10 +++--- .../autoswap}/RpcProvider_mock.go | 14 ++++---- {autoswap => internal/autoswap}/autoswap.go | 16 ++++----- .../autoswap}/autoswap_test.go | 8 ++--- {autoswap => internal/autoswap}/balance.go | 4 +-- {autoswap => internal/autoswap}/budget.go | 6 ++-- {autoswap => internal/autoswap}/chain.go | 14 ++++---- {autoswap => internal/autoswap}/chain_test.go | 14 ++++---- .../autoswap}/config_test.go | 8 ++--- {autoswap => internal/autoswap}/lightning.go | 16 ++++----- .../autoswap}/lightning_test.go | 14 ++++---- .../autoswap}/recommendation.go | 6 ++-- .../autoswap}/recommendation_test.go | 2 +- {autoswap => internal/autoswap}/rpc.go | 8 ++--- {autoswap => internal/autoswap}/strategy.go | 8 ++--- {autoswap => internal/autoswap}/util.go | 2 +- {build => internal/build}/version.go | 0 {build => internal/build}/version_test.go | 0 {cln => internal/cln}/cln.go | 8 ++--- {cln => internal/cln}/protos/node.pb.go | 0 {cln => internal/cln}/protos/node.proto | 0 {cln => internal/cln}/protos/node_grpc.pb.go | 0 {cln => internal/cln}/protos/primitives.pb.go | 0 {cln => internal/cln}/protos/primitives.proto | 0 {config => internal/config}/config.go | 16 ++++----- {database => internal/database}/any.go | 4 +-- {database => internal/database}/budget.go | 0 {database => internal/database}/chain.go | 4 +-- {database => internal/database}/database.go | 6 ++-- {database => internal/database}/entity.go | 0 {database => internal/database}/macaroons.go | 0 {database => internal/database}/migration.go | 6 ++-- .../database}/migration_test.go | 0 {database => internal/database}/reverse.go | 6 ++-- {database => internal/database}/scan.go | 0 {database => internal/database}/scan_test.go | 0 {database => internal/database}/stats.go | 4 +-- {database => internal/database}/stats_test.go | 8 ++--- {database => internal/database}/swap.go | 6 ++-- {database => internal/database}/tx_test.go | 0 {database => internal/database}/wallet.go | 2 +- {electrum => internal/electrum}/electrum.go | 4 +-- .../electrum}/electrum_test.go | 4 +-- {lightning => internal/lightning}/bolt12.go | 0 .../lightning}/bolt12_test.go | 0 {lightning => internal/lightning}/channel.go | 0 .../lightning}/channel_test.go | 0 {lightning => internal/lightning}/connect.go | 4 +-- .../lightning}/connect_test.go | 0 {lightning => internal/lightning}/dynamic.go | 0 {lightning => internal/lightning}/invoice.go | 2 +- .../lightning}/lib/bolt12/Cargo.lock | 0 .../lightning}/lib/bolt12/Cargo.toml | 0 .../lightning}/lib/bolt12/build.rs | 0 .../lightning}/lib/bolt12/src/lib.rs | 0 .../lightning}/lightning.go | 4 +-- .../lightning}/payment_fee.go | 0 .../lightning}/payment_fee_test.go | 0 {lightning => internal/lightning}/static.go | 0 {lnd => internal/lnd}/lnd.go | 6 ++-- {logger => internal/logger}/logger.go | 0 .../macaroons}/interceptors.go | 0 .../macaroons}/permissions.go | 2 +- .../macaroons}/permissions_test.go | 0 {macaroons => internal/macaroons}/service.go | 2 +- {macaroons => internal/macaroons}/storage.go | 2 +- {macaroons => internal/macaroons}/utils.go | 2 +- .../macaroons}/utils_test.go | 0 {mempool => internal/mempool}/mempool.go | 4 +-- {mempool => internal/mempool}/mempool_test.go | 4 +-- .../mocks}/lightning/LightningNode_mock.go | 26 +++++++-------- .../mocks}/onchain/BlockProvider_mock.go | 12 +++---- .../mocks}/onchain/TxProvider_mock.go | 2 +- .../mocks}/onchain/Wallet_mock.go | 14 ++++---- {nursery => internal/nursery}/chain.go | 10 +++--- {nursery => internal/nursery}/data/test.json | 0 {nursery => internal/nursery}/nursery.go | 16 ++++----- {nursery => internal/nursery}/refund.go | 10 +++--- {nursery => internal/nursery}/reverse.go | 16 ++++----- {nursery => internal/nursery}/swap.go | 14 ++++---- {onchain => internal/onchain}/boltz.go | 2 +- {onchain => internal/onchain}/multi_tx.go | 0 .../onchain}/multi_tx_test.go | 4 +-- {onchain => internal/onchain}/onchain.go | 6 ++-- {onchain => internal/onchain}/onchain_test.go | 8 ++--- .../onchain}/wallet/dummy.cpp | 0 .../onchain}/wallet/dynamic.go | 0 .../onchain}/wallet/encrypt.go | 0 .../onchain}/wallet/encrypt_test.go | 0 .../onchain}/wallet/handler.go | 2 +- .../onchain}/wallet/include/gdk.h | 0 .../onchain}/wallet/include/gdk_export.h | 0 .../onchain/wallet/lib/.dockerenv | 0 internal/onchain/wallet/lib/.gitkeep | 0 internal/onchain/wallet/lib/dev/console | 0 internal/onchain/wallet/lib/etc/hostname | 0 internal/onchain/wallet/lib/etc/hosts | 0 internal/onchain/wallet/lib/etc/mtab | 1 + internal/onchain/wallet/lib/etc/resolv.conf | 0 .../onchain}/wallet/static.go | 0 .../onchain}/wallet/wallet.go | 8 ++--- .../onchain}/wallet/wallet_test.go | 12 +++---- {rpcserver => internal/rpcserver}/autoswap.go | 8 ++--- {rpcserver => internal/rpcserver}/cert.go | 4 +-- .../rpcserver}/cert_test.go | 2 +- .../rpcserver}/macaroons.go | 8 ++--- {rpcserver => internal/rpcserver}/router.go | 26 +++++++-------- .../rpcserver}/router_test.go | 4 +-- .../rpcserver}/rpcserver_test.go | 33 +++++++++---------- .../rpcserver}/serializer.go | 14 ++++---- {rpcserver => internal/rpcserver}/server.go | 22 ++++++------- {rpcserver => internal/rpcserver}/sync.go | 4 +-- .../rpcserver}/test/boltz.toml | 4 +-- {rpcserver => internal/rpcserver}/version.go | 8 ++--- {test => internal/test}/test.go | 10 +++--- {utils => internal/utils}/channelforwarder.go | 0 {utils => internal/utils}/datadir.go | 0 {utils => internal/utils}/datadir_test.go | 0 {utils => internal/utils}/fees.go | 4 +-- {utils => internal/utils}/json.go | 0 {utils => internal/utils}/memo.go | 0 {utils => internal/utils}/memo_test.go | 0 {utils => internal/utils}/utils.go | 0 {utils => internal/utils}/utils_test.go | 0 {utils => internal/utils}/version.go | 0 {utils => internal/utils}/version_test.go | 0 {boltz => pkg/boltz}/address.go | 0 {boltz => pkg/boltz}/address_test.go | 0 {boltz => pkg/boltz}/api.go | 0 {boltz => pkg/boltz}/blocktime.go | 0 {boltz => pkg/boltz}/blocktime_test.go | 0 {boltz => pkg/boltz}/btc.go | 0 {boltz => pkg/boltz}/currency.go | 0 {boltz => pkg/boltz}/events.go | 0 {boltz => pkg/boltz}/fees.go | 0 {boltz => pkg/boltz}/fees_test.go | 0 {boltz => pkg/boltz}/liquid.go | 0 {boltz => pkg/boltz}/musig.go | 0 {boltz => pkg/boltz}/network.go | 0 {boltz => pkg/boltz}/pair.go | 0 {boltz => pkg/boltz}/routing_hints.go | 0 {boltz => pkg/boltz}/routing_hints_test.go | 0 {boltz => pkg/boltz}/swaptree.go | 0 {boltz => pkg/boltz}/swaptree_test.go | 0 {boltz => pkg/boltz}/transaction.go | 0 {boltz => pkg/boltz}/ws.go | 2 +- .../boltzrpc}/autoswaprpc/autoswaprpc.pb.go | 2 +- .../boltzrpc}/autoswaprpc/autoswaprpc.proto | 0 .../autoswaprpc/autoswaprpc_grpc.pb.go | 0 {boltzrpc => pkg/boltzrpc}/boltzrpc.pb.go | 0 {boltzrpc => pkg/boltzrpc}/boltzrpc.pb.gw.go | 0 {boltzrpc => pkg/boltzrpc}/boltzrpc.proto | 0 .../boltzrpc}/boltzrpc_grpc.pb.go | 0 {boltzrpc => pkg/boltzrpc}/client/autoswap.go | 2 +- {boltzrpc => pkg/boltzrpc}/client/client.go | 2 +- .../boltzrpc}/client/connection.go | 0 {boltzrpc => pkg/boltzrpc}/gen_protos.sh | 0 {boltzrpc => pkg/boltzrpc}/grpc_docs.template | 0 .../boltzrpc}/rest-annotations.yaml | 0 .../boltzrpc}/serializers/utils.go | 6 ++-- 166 files changed, 318 insertions(+), 317 deletions(-) rename {autoswap => internal/autoswap}/RpcProvider_mock.go (96%) rename {autoswap => internal/autoswap}/autoswap.go (95%) rename {autoswap => internal/autoswap}/autoswap_test.go (91%) rename {autoswap => internal/autoswap}/balance.go (82%) rename {autoswap => internal/autoswap}/budget.go (92%) rename {autoswap => internal/autoswap}/chain.go (94%) rename {autoswap => internal/autoswap}/chain_test.go (95%) rename {autoswap => internal/autoswap}/config_test.go (97%) rename {autoswap => internal/autoswap}/lightning.go (96%) rename {autoswap => internal/autoswap}/lightning_test.go (98%) rename {autoswap => internal/autoswap}/recommendation.go (90%) rename {autoswap => internal/autoswap}/recommendation_test.go (97%) rename {autoswap => internal/autoswap}/rpc.go (79%) rename {autoswap => internal/autoswap}/strategy.go (90%) rename {autoswap => internal/autoswap}/util.go (94%) rename {build => internal/build}/version.go (100%) rename {build => internal/build}/version_test.go (100%) rename {cln => internal/cln}/cln.go (97%) rename {cln => internal/cln}/protos/node.pb.go (100%) rename {cln => internal/cln}/protos/node.proto (100%) rename {cln => internal/cln}/protos/node_grpc.pb.go (100%) rename {cln => internal/cln}/protos/primitives.pb.go (100%) rename {cln => internal/cln}/protos/primitives.proto (100%) rename {config => internal/config}/config.go (94%) rename {database => internal/database}/any.go (96%) rename {database => internal/database}/budget.go (100%) rename {database => internal/database}/chain.go (99%) rename {database => internal/database}/database.go (98%) rename {database => internal/database}/entity.go (100%) rename {database => internal/database}/macaroons.go (100%) rename {database => internal/database}/migration.go (98%) rename {database => internal/database}/migration_test.go (100%) rename {database => internal/database}/reverse.go (98%) rename {database => internal/database}/scan.go (100%) rename {database => internal/database}/scan_test.go (100%) rename {database => internal/database}/stats.go (90%) rename {database => internal/database}/stats_test.go (92%) rename {database => internal/database}/swap.go (98%) rename {database => internal/database}/tx_test.go (100%) rename {database => internal/database}/wallet.go (97%) rename {electrum => internal/electrum}/electrum.go (96%) rename {electrum => internal/electrum}/electrum_test.go (89%) rename {lightning => internal/lightning}/bolt12.go (100%) rename {lightning => internal/lightning}/bolt12_test.go (100%) rename {lightning => internal/lightning}/channel.go (100%) rename {lightning => internal/lightning}/channel_test.go (100%) rename {lightning => internal/lightning}/connect.go (93%) rename {lightning => internal/lightning}/connect_test.go (100%) rename {lightning => internal/lightning}/dynamic.go (100%) rename {lightning => internal/lightning}/invoice.go (93%) rename {lightning => internal/lightning}/lib/bolt12/Cargo.lock (100%) rename {lightning => internal/lightning}/lib/bolt12/Cargo.toml (100%) rename {lightning => internal/lightning}/lib/bolt12/build.rs (100%) rename {lightning => internal/lightning}/lib/bolt12/src/lib.rs (100%) rename {lightning => internal/lightning}/lightning.go (95%) rename {lightning => internal/lightning}/payment_fee.go (100%) rename {lightning => internal/lightning}/payment_fee_test.go (100%) rename {lightning => internal/lightning}/static.go (100%) rename {lnd => internal/lnd}/lnd.go (98%) rename {logger => internal/logger}/logger.go (100%) rename {macaroons => internal/macaroons}/interceptors.go (100%) rename {macaroons => internal/macaroons}/permissions.go (98%) rename {macaroons => internal/macaroons}/permissions_test.go (100%) rename {macaroons => internal/macaroons}/service.go (96%) rename {macaroons => internal/macaroons}/storage.go (94%) rename {macaroons => internal/macaroons}/utils.go (95%) rename {macaroons => internal/macaroons}/utils_test.go (100%) rename {mempool => internal/mempool}/mempool.go (97%) rename {mempool => internal/mempool}/mempool_test.go (96%) rename {mocks/github.com/BoltzExchange/boltz-client/v2 => internal/mocks}/lightning/LightningNode_mock.go (97%) rename {mocks/github.com/BoltzExchange/boltz-client/v2 => internal/mocks}/onchain/BlockProvider_mock.go (96%) rename {mocks/github.com/BoltzExchange/boltz-client/v2 => internal/mocks}/onchain/TxProvider_mock.go (99%) rename {mocks/github.com/BoltzExchange/boltz-client/v2 => internal/mocks}/onchain/Wallet_mock.go (96%) rename {nursery => internal/nursery}/chain.go (96%) rename {nursery => internal/nursery}/data/test.json (100%) rename {nursery => internal/nursery}/nursery.go (95%) rename {nursery => internal/nursery}/refund.go (87%) rename {nursery => internal/nursery}/reverse.go (96%) rename {nursery => internal/nursery}/swap.go (96%) rename {onchain => internal/onchain}/boltz.go (92%) rename {onchain => internal/onchain}/multi_tx.go (100%) rename {onchain => internal/onchain}/multi_tx_test.go (91%) rename {onchain => internal/onchain}/onchain.go (98%) rename {onchain => internal/onchain}/onchain_test.go (73%) rename {onchain => internal/onchain}/wallet/dummy.cpp (100%) rename {onchain => internal/onchain}/wallet/dynamic.go (100%) rename {onchain => internal/onchain}/wallet/encrypt.go (100%) rename {onchain => internal/onchain}/wallet/encrypt_test.go (100%) rename {onchain => internal/onchain}/wallet/handler.go (95%) rename {onchain => internal/onchain}/wallet/include/gdk.h (100%) rename {onchain => internal/onchain}/wallet/include/gdk_export.h (100%) rename onchain/wallet/lib/.gitkeep => internal/onchain/wallet/lib/.dockerenv (100%) mode change 100644 => 100755 create mode 100644 internal/onchain/wallet/lib/.gitkeep create mode 100755 internal/onchain/wallet/lib/dev/console create mode 100755 internal/onchain/wallet/lib/etc/hostname create mode 100755 internal/onchain/wallet/lib/etc/hosts create mode 120000 internal/onchain/wallet/lib/etc/mtab create mode 100755 internal/onchain/wallet/lib/etc/resolv.conf rename {onchain => internal/onchain}/wallet/static.go (100%) rename {onchain => internal/onchain}/wallet/wallet.go (99%) rename {onchain => internal/onchain}/wallet/wallet_test.go (95%) rename {rpcserver => internal/rpcserver}/autoswap.go (95%) rename {rpcserver => internal/rpcserver}/cert.go (91%) rename {rpcserver => internal/rpcserver}/cert_test.go (95%) rename {rpcserver => internal/rpcserver}/macaroons.go (87%) rename {rpcserver => internal/rpcserver}/router.go (98%) rename {rpcserver => internal/rpcserver}/router_test.go (93%) rename {rpcserver => internal/rpcserver}/rpcserver_test.go (98%) rename {rpcserver => internal/rpcserver}/serializer.go (95%) rename {rpcserver => internal/rpcserver}/server.go (94%) rename {rpcserver => internal/rpcserver}/sync.go (87%) rename {rpcserver => internal/rpcserver}/test/boltz.toml (57%) rename {rpcserver => internal/rpcserver}/version.go (75%) rename {test => internal/test}/test.go (94%) rename {utils => internal/utils}/channelforwarder.go (100%) rename {utils => internal/utils}/datadir.go (100%) rename {utils => internal/utils}/datadir_test.go (100%) rename {utils => internal/utils}/fees.go (65%) rename {utils => internal/utils}/json.go (100%) rename {utils => internal/utils}/memo.go (100%) rename {utils => internal/utils}/memo_test.go (100%) rename {utils => internal/utils}/utils.go (100%) rename {utils => internal/utils}/utils_test.go (100%) rename {utils => internal/utils}/version.go (100%) rename {utils => internal/utils}/version_test.go (100%) rename {boltz => pkg/boltz}/address.go (100%) rename {boltz => pkg/boltz}/address_test.go (100%) rename {boltz => pkg/boltz}/api.go (100%) rename {boltz => pkg/boltz}/blocktime.go (100%) rename {boltz => pkg/boltz}/blocktime_test.go (100%) rename {boltz => pkg/boltz}/btc.go (100%) rename {boltz => pkg/boltz}/currency.go (100%) rename {boltz => pkg/boltz}/events.go (100%) rename {boltz => pkg/boltz}/fees.go (100%) rename {boltz => pkg/boltz}/fees_test.go (100%) rename {boltz => pkg/boltz}/liquid.go (100%) rename {boltz => pkg/boltz}/musig.go (100%) rename {boltz => pkg/boltz}/network.go (100%) rename {boltz => pkg/boltz}/pair.go (100%) rename {boltz => pkg/boltz}/routing_hints.go (100%) rename {boltz => pkg/boltz}/routing_hints_test.go (100%) rename {boltz => pkg/boltz}/swaptree.go (100%) rename {boltz => pkg/boltz}/swaptree_test.go (100%) rename {boltz => pkg/boltz}/transaction.go (100%) rename {boltz => pkg/boltz}/ws.go (98%) rename {boltzrpc => pkg/boltzrpc}/autoswaprpc/autoswaprpc.pb.go (99%) rename {boltzrpc => pkg/boltzrpc}/autoswaprpc/autoswaprpc.proto (100%) rename {boltzrpc => pkg/boltzrpc}/autoswaprpc/autoswaprpc_grpc.pb.go (100%) rename {boltzrpc => pkg/boltzrpc}/boltzrpc.pb.go (100%) rename {boltzrpc => pkg/boltzrpc}/boltzrpc.pb.gw.go (100%) rename {boltzrpc => pkg/boltzrpc}/boltzrpc.proto (100%) rename {boltzrpc => pkg/boltzrpc}/boltzrpc_grpc.pb.go (100%) rename {boltzrpc => pkg/boltzrpc}/client/autoswap.go (98%) rename {boltzrpc => pkg/boltzrpc}/client/client.go (99%) rename {boltzrpc => pkg/boltzrpc}/client/connection.go (100%) rename {boltzrpc => pkg/boltzrpc}/gen_protos.sh (100%) rename {boltzrpc => pkg/boltzrpc}/grpc_docs.template (100%) rename {boltzrpc => pkg/boltzrpc}/rest-annotations.yaml (100%) rename {boltzrpc => pkg/boltzrpc}/serializers/utils.go (88%) diff --git a/.gitignore b/.gitignore index e2276e80..8b74adf6 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,7 @@ boltzcli !cmd/boltzd !cmd/boltzcli bin/ -onchain/wallet/lib/ +internal/onchain/wallet/lib/ boltz-client-*.tar.gz boltz-client-manifest-*.txt @@ -26,9 +26,9 @@ vendor/ # Config, database, log, certificate and macaroon files boltz.toml -!rpcserver/test/boltz.toml -rpcserver/test/wallet -rpcserver/test/autoswap.toml +!internal/rpcserver/test/boltz.toml +internal/rpcserver/test/wallet +internal/rpcserver/test/autoswap.toml boltz.db boltz.log tls.key diff --git a/.mockery.yaml b/.mockery.yaml index cbc63e5b..10b3d6a6 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -1,17 +1,18 @@ with-expecter: True filename: "{{ .InterfaceName }}_mock.go" +dir: ./internal/mocks/{{.PackageName}} packages: - github.com/BoltzExchange/boltz-client/v2/onchain: + github.com/BoltzExchange/boltz-client/v2/internal/onchain: interfaces: Wallet: TxProvider: BlockProvider: - github.com/BoltzExchange/boltz-client/v2/autoswap: + github.com/BoltzExchange/boltz-client/v2/internal/autoswap: config: - dir: autoswap + dir: ./internal/autoswap inpackage: True interfaces: RpcProvider: - github.com/BoltzExchange/boltz-client/v2/lightning: + github.com/BoltzExchange/boltz-client/v2/internal/lightning: interfaces: LightningNode: diff --git a/Makefile b/Makefile index fe4b4728..dc3cd89a 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,7 @@ restart-regtest: download-regtest build-bolt12: @$(call print, "Building bolt12") - cd lightning/lib/bolt12 && cargo build --release + cd internal/lightning/lib/bolt12 && cargo build --release build: download-gdk build-bolt12 @$(call print, "Building boltz-client") @@ -117,10 +117,10 @@ deps: submodules find secp256k1-zkp -type f -name "*.h" -print0 | xargs -0 sed -i '/include/!s/secp256k1/go_secp256k1/g' download-gdk: -ifeq ("$(wildcard onchain/wallet/lib/libgreen_gdk.so)","") +ifeq ("$(wildcard internal/onchain/wallet/lib/libgreen_gdk.so)","") @$(call print, "Downloading gdk library") @container_id=$$(docker create "boltz/gdk-ubuntu:$(GDK_VERSION)" true); \ - docker cp "$$container_id:/" onchain/wallet/lib/ && \ + docker cp "$$container_id:/" internal/onchain/wallet/lib/ && \ docker rm "$$container_id"; endif diff --git a/cmd/boltzcli/boltzcli.go b/cmd/boltzcli/boltzcli.go index 845d7b68..ae436add 100644 --- a/cmd/boltzcli/boltzcli.go +++ b/cmd/boltzcli/boltzcli.go @@ -7,9 +7,9 @@ import ( "path" "strings" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/client" - "github.com/BoltzExchange/boltz-client/v2/build" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/build" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/client" "github.com/urfave/cli/v2" "google.golang.org/grpc/status" ) diff --git a/cmd/boltzcli/commands.go b/cmd/boltzcli/commands.go index 1e284ad0..df8de7e5 100644 --- a/cmd/boltzcli/commands.go +++ b/cmd/boltzcli/commands.go @@ -7,8 +7,8 @@ import ( "encoding/json" "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/client" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/serializers" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/client" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/serializers" "google.golang.org/protobuf/proto" "io" "os" @@ -21,10 +21,10 @@ import ( "google.golang.org/protobuf/encoding/protojson" "github.com/AlecAivazis/survey/v2" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/autoswaprpc" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/autoswaprpc" "github.com/BurntSushi/toml" "github.com/briandowns/spinner" "github.com/fatih/color" diff --git a/cmd/boltzcli/utils.go b/cmd/boltzcli/utils.go index 2f32bd93..829c5f70 100644 --- a/cmd/boltzcli/utils.go +++ b/cmd/boltzcli/utils.go @@ -3,9 +3,9 @@ package main import ( "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "os" "regexp" "strconv" diff --git a/cmd/boltzd/boltzd.go b/cmd/boltzd/boltzd.go index c8f41c2d..91379bd4 100644 --- a/cmd/boltzd/boltzd.go +++ b/cmd/boltzd/boltzd.go @@ -2,11 +2,11 @@ package main import ( "fmt" - "github.com/BoltzExchange/boltz-client/v2/build" - "github.com/BoltzExchange/boltz-client/v2/config" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/rpcserver" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/build" + "github.com/BoltzExchange/boltz-client/v2/internal/config" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/rpcserver" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" "os" "os/signal" "runtime" diff --git a/autoswap/RpcProvider_mock.go b/internal/autoswap/RpcProvider_mock.go similarity index 96% rename from autoswap/RpcProvider_mock.go rename to internal/autoswap/RpcProvider_mock.go index e7721504..7f625d70 100644 --- a/autoswap/RpcProvider_mock.go +++ b/internal/autoswap/RpcProvider_mock.go @@ -1,18 +1,18 @@ -// Code generated by mockery v2.50.1. DO NOT EDIT. +// Code generated by mockery v2.42.2. DO NOT EDIT. package autoswap import ( - boltz "github.com/BoltzExchange/boltz-client/v2/boltz" - boltzrpc "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + boltz "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + boltzrpc "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" - database "github.com/BoltzExchange/boltz-client/v2/database" + database "github.com/BoltzExchange/boltz-client/v2/internal/database" - lightning "github.com/BoltzExchange/boltz-client/v2/lightning" + lightning "github.com/BoltzExchange/boltz-client/v2/internal/lightning" mock "github.com/stretchr/testify/mock" - onchain "github.com/BoltzExchange/boltz-client/v2/onchain" + onchain "github.com/BoltzExchange/boltz-client/v2/internal/onchain" ) // MockRpcProvider is an autogenerated mock type for the RpcProvider type @@ -288,7 +288,7 @@ func (_c *MockRpcProvider_GetBlockUpdates_Call) RunAndReturn(run func(boltz.Curr return _c } -// GetLightningChannels provides a mock function with no fields +// GetLightningChannels provides a mock function with given fields: func (_m *MockRpcProvider) GetLightningChannels() ([]*lightning.LightningChannel, error) { ret := _m.Called() diff --git a/autoswap/autoswap.go b/internal/autoswap/autoswap.go similarity index 95% rename from autoswap/autoswap.go rename to internal/autoswap/autoswap.go index 89ad752d..fb1bb6f4 100644 --- a/autoswap/autoswap.go +++ b/internal/autoswap/autoswap.go @@ -4,14 +4,14 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/autoswaprpc" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/autoswaprpc" "github.com/BurntSushi/toml" "google.golang.org/protobuf/encoding/protojson" "os" diff --git a/autoswap/autoswap_test.go b/internal/autoswap/autoswap_test.go similarity index 91% rename from autoswap/autoswap_test.go rename to internal/autoswap/autoswap_test.go index e26115d0..cb15a9e5 100644 --- a/autoswap/autoswap_test.go +++ b/internal/autoswap/autoswap_test.go @@ -1,10 +1,10 @@ package autoswap import ( - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "os" "testing" diff --git a/autoswap/balance.go b/internal/autoswap/balance.go similarity index 82% rename from autoswap/balance.go rename to internal/autoswap/balance.go index 6f0cedc5..0c01626d 100644 --- a/autoswap/balance.go +++ b/internal/autoswap/balance.go @@ -1,8 +1,8 @@ package autoswap import ( - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" ) type Balance struct { diff --git a/autoswap/budget.go b/internal/autoswap/budget.go similarity index 92% rename from autoswap/budget.go rename to internal/autoswap/budget.go index ee73a541..9fc94618 100644 --- a/autoswap/budget.go +++ b/internal/autoswap/budget.go @@ -2,11 +2,11 @@ package autoswap import ( "errors" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "time" - "github.com/BoltzExchange/boltz-client/v2/database" + "github.com/BoltzExchange/boltz-client/v2/internal/database" ) type Budget struct { diff --git a/autoswap/chain.go b/internal/autoswap/chain.go similarity index 94% rename from autoswap/chain.go rename to internal/autoswap/chain.go index c6c7d3cd..24eb4d30 100644 --- a/autoswap/chain.go +++ b/internal/autoswap/chain.go @@ -3,13 +3,13 @@ package autoswap import ( "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/autoswaprpc" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/serializers" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/autoswaprpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/serializers" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "sync" diff --git a/autoswap/chain_test.go b/internal/autoswap/chain_test.go similarity index 95% rename from autoswap/chain_test.go rename to internal/autoswap/chain_test.go index 3bc24c17..f5ec5676 100644 --- a/autoswap/chain_test.go +++ b/internal/autoswap/chain_test.go @@ -1,13 +1,13 @@ package autoswap import ( - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/autoswaprpc" - "github.com/BoltzExchange/boltz-client/v2/database" - onchainmock "github.com/BoltzExchange/boltz-client/v2/mocks/github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/test" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + onchainmock "github.com/BoltzExchange/boltz-client/v2/internal/mocks/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/test" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/autoswaprpc" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" diff --git a/autoswap/config_test.go b/internal/autoswap/config_test.go similarity index 97% rename from autoswap/config_test.go rename to internal/autoswap/config_test.go index cdf712d5..11ed3ecc 100644 --- a/autoswap/config_test.go +++ b/internal/autoswap/config_test.go @@ -1,12 +1,12 @@ package autoswap import ( - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" "testing" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "github.com/stretchr/testify/require" ) diff --git a/autoswap/lightning.go b/internal/autoswap/lightning.go similarity index 96% rename from autoswap/lightning.go rename to internal/autoswap/lightning.go index 31814d10..41870747 100644 --- a/autoswap/lightning.go +++ b/internal/autoswap/lightning.go @@ -3,19 +3,19 @@ package autoswap import ( "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/autoswaprpc" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/serializers" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/autoswaprpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/serializers" "google.golang.org/protobuf/proto" "slices" "sync" "time" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" ) type LightningSwapper = swapper[*LightningConfig] diff --git a/autoswap/lightning_test.go b/internal/autoswap/lightning_test.go similarity index 98% rename from autoswap/lightning_test.go rename to internal/autoswap/lightning_test.go index 2d22e967..13f86623 100644 --- a/autoswap/lightning_test.go +++ b/internal/autoswap/lightning_test.go @@ -1,16 +1,16 @@ package autoswap import ( - "github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/test" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/test" "testing" "time" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/autoswaprpc" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/autoswaprpc" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "google.golang.org/protobuf/types/known/fieldmaskpb" diff --git a/autoswap/recommendation.go b/internal/autoswap/recommendation.go similarity index 90% rename from autoswap/recommendation.go rename to internal/autoswap/recommendation.go index ee6ae10f..e345c26c 100644 --- a/autoswap/recommendation.go +++ b/internal/autoswap/recommendation.go @@ -1,11 +1,11 @@ package autoswap import ( - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "math" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" ) type checks struct { diff --git a/autoswap/recommendation_test.go b/internal/autoswap/recommendation_test.go similarity index 97% rename from autoswap/recommendation_test.go rename to internal/autoswap/recommendation_test.go index 4700b48c..c978817d 100644 --- a/autoswap/recommendation_test.go +++ b/internal/autoswap/recommendation_test.go @@ -1,7 +1,7 @@ package autoswap import ( - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "github.com/stretchr/testify/require" "testing" ) diff --git a/autoswap/rpc.go b/internal/autoswap/rpc.go similarity index 79% rename from autoswap/rpc.go rename to internal/autoswap/rpc.go index a12a3a59..f60d51a7 100644 --- a/autoswap/rpc.go +++ b/internal/autoswap/rpc.go @@ -1,10 +1,10 @@ package autoswap import ( - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/autoswaprpc" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/serializers" - "github.com/BoltzExchange/boltz-client/v2/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/autoswaprpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/serializers" ) func serializeLightningChannel(channel *lightning.LightningChannel) *boltzrpc.LightningChannel { diff --git a/autoswap/strategy.go b/internal/autoswap/strategy.go similarity index 90% rename from autoswap/strategy.go rename to internal/autoswap/strategy.go index 7dc57a16..fdc00b57 100644 --- a/autoswap/strategy.go +++ b/internal/autoswap/strategy.go @@ -3,11 +3,11 @@ package autoswap import ( "math" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/autoswaprpc" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/autoswaprpc" - "github.com/BoltzExchange/boltz-client/v2/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" ) type Strategy = func(channels []*lightning.LightningChannel) []*LightningRecommendation diff --git a/autoswap/util.go b/internal/autoswap/util.go similarity index 94% rename from autoswap/util.go rename to internal/autoswap/util.go index 46d29b64..ddf813af 100644 --- a/autoswap/util.go +++ b/internal/autoswap/util.go @@ -2,7 +2,7 @@ package autoswap import ( "errors" - "github.com/BoltzExchange/boltz-client/v2/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" "slices" "github.com/mennanov/fmutils" diff --git a/build/version.go b/internal/build/version.go similarity index 100% rename from build/version.go rename to internal/build/version.go diff --git a/build/version_test.go b/internal/build/version_test.go similarity index 100% rename from build/version_test.go rename to internal/build/version_test.go diff --git a/cln/cln.go b/internal/cln/cln.go similarity index 97% rename from cln/cln.go rename to internal/cln/cln.go index 253048c2..0f545c37 100755 --- a/cln/cln.go +++ b/internal/cln/cln.go @@ -12,11 +12,11 @@ import ( "strconv" "time" - "github.com/BoltzExchange/boltz-client/v2/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" - "github.com/BoltzExchange/boltz-client/v2/cln/protos" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/cln/protos" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" "google.golang.org/grpc" "google.golang.org/grpc/credentials" ) diff --git a/cln/protos/node.pb.go b/internal/cln/protos/node.pb.go similarity index 100% rename from cln/protos/node.pb.go rename to internal/cln/protos/node.pb.go diff --git a/cln/protos/node.proto b/internal/cln/protos/node.proto similarity index 100% rename from cln/protos/node.proto rename to internal/cln/protos/node.proto diff --git a/cln/protos/node_grpc.pb.go b/internal/cln/protos/node_grpc.pb.go similarity index 100% rename from cln/protos/node_grpc.pb.go rename to internal/cln/protos/node_grpc.pb.go diff --git a/cln/protos/primitives.pb.go b/internal/cln/protos/primitives.pb.go similarity index 100% rename from cln/protos/primitives.pb.go rename to internal/cln/protos/primitives.pb.go diff --git a/cln/protos/primitives.proto b/internal/cln/protos/primitives.proto similarity index 100% rename from cln/protos/primitives.proto rename to internal/cln/protos/primitives.proto diff --git a/config/config.go b/internal/config/config.go similarity index 94% rename from config/config.go rename to internal/config/config.go index cabd50e7..060c7058 100644 --- a/config/config.go +++ b/internal/config/config.go @@ -7,19 +7,19 @@ import ( "runtime" "strings" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" "gopkg.in/natefinch/lumberjack.v2" "github.com/BurntSushi/toml" "github.com/jessevdk/go-flags" - "github.com/BoltzExchange/boltz-client/v2/build" - "github.com/BoltzExchange/boltz-client/v2/cln" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/lnd" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/build" + "github.com/BoltzExchange/boltz-client/v2/internal/cln" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/lnd" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" ) type helpOptions struct { diff --git a/database/any.go b/internal/database/any.go similarity index 96% rename from database/any.go rename to internal/database/any.go index a9821df1..29b34767 100644 --- a/database/any.go +++ b/internal/database/any.go @@ -6,8 +6,8 @@ import ( "strings" "time" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" ) type AnySwap struct { diff --git a/database/budget.go b/internal/database/budget.go similarity index 100% rename from database/budget.go rename to internal/database/budget.go diff --git a/database/chain.go b/internal/database/chain.go similarity index 99% rename from database/chain.go rename to internal/database/chain.go index a4d6c478..0867da11 100644 --- a/database/chain.go +++ b/internal/database/chain.go @@ -5,8 +5,8 @@ import ( "encoding/hex" "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "github.com/btcsuite/btcd/btcec/v2" "time" ) diff --git a/database/database.go b/internal/database/database.go similarity index 98% rename from database/database.go rename to internal/database/database.go index a7a398ad..fbe94c16 100644 --- a/database/database.go +++ b/internal/database/database.go @@ -9,11 +9,11 @@ import ( "sync" "time" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "golang.org/x/exp/constraints" - "github.com/BoltzExchange/boltz-client/v2/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" "github.com/btcsuite/btcd/btcec/v2" _ "github.com/mattn/go-sqlite3" ) diff --git a/database/entity.go b/internal/database/entity.go similarity index 100% rename from database/entity.go rename to internal/database/entity.go diff --git a/database/macaroons.go b/internal/database/macaroons.go similarity index 100% rename from database/macaroons.go rename to internal/database/macaroons.go diff --git a/database/migration.go b/internal/database/migration.go similarity index 98% rename from database/migration.go rename to internal/database/migration.go index 8d65781b..e3dd667b 100644 --- a/database/migration.go +++ b/internal/database/migration.go @@ -7,9 +7,9 @@ import ( "strconv" "strings" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" ) type swapStatus struct { diff --git a/database/migration_test.go b/internal/database/migration_test.go similarity index 100% rename from database/migration_test.go rename to internal/database/migration_test.go diff --git a/database/reverse.go b/internal/database/reverse.go similarity index 98% rename from database/reverse.go rename to internal/database/reverse.go index 87e418f9..c64d6fcf 100644 --- a/database/reverse.go +++ b/internal/database/reverse.go @@ -8,9 +8,9 @@ import ( "fmt" "time" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "github.com/btcsuite/btcd/btcec/v2" ) diff --git a/database/scan.go b/internal/database/scan.go similarity index 100% rename from database/scan.go rename to internal/database/scan.go diff --git a/database/scan_test.go b/internal/database/scan_test.go similarity index 100% rename from database/scan_test.go rename to internal/database/scan_test.go diff --git a/database/stats.go b/internal/database/stats.go similarity index 90% rename from database/stats.go rename to internal/database/stats.go index 83f77f5b..60d65125 100644 --- a/database/stats.go +++ b/internal/database/stats.go @@ -2,8 +2,8 @@ package database import ( "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "strings" ) diff --git a/database/stats_test.go b/internal/database/stats_test.go similarity index 92% rename from database/stats_test.go rename to internal/database/stats_test.go index f0605b50..afa5f19e 100644 --- a/database/stats_test.go +++ b/internal/database/stats_test.go @@ -1,10 +1,10 @@ package database_test import ( - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/test" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/test" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "github.com/stretchr/testify/require" "testing" "time" diff --git a/database/swap.go b/internal/database/swap.go similarity index 98% rename from database/swap.go rename to internal/database/swap.go index 8c85a1a3..3e420278 100644 --- a/database/swap.go +++ b/internal/database/swap.go @@ -7,9 +7,9 @@ import ( "fmt" "time" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "github.com/btcsuite/btcd/btcec/v2" ) diff --git a/database/tx_test.go b/internal/database/tx_test.go similarity index 100% rename from database/tx_test.go rename to internal/database/tx_test.go diff --git a/database/wallet.go b/internal/database/wallet.go similarity index 97% rename from database/wallet.go rename to internal/database/wallet.go index 61327ad9..48ae8437 100644 --- a/database/wallet.go +++ b/internal/database/wallet.go @@ -3,7 +3,7 @@ package database import ( "fmt" - onchainWallet "github.com/BoltzExchange/boltz-client/v2/onchain/wallet" + onchainWallet "github.com/BoltzExchange/boltz-client/v2/internal/onchain/wallet" ) type Wallet struct { diff --git a/electrum/electrum.go b/internal/electrum/electrum.go similarity index 96% rename from electrum/electrum.go rename to internal/electrum/electrum.go index baf59ec7..6ff492c0 100644 --- a/electrum/electrum.go +++ b/internal/electrum/electrum.go @@ -5,8 +5,8 @@ import ( "crypto/tls" "time" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" "github.com/BoltzExchange/go-electrum/electrum" ) diff --git a/electrum/electrum_test.go b/internal/electrum/electrum_test.go similarity index 89% rename from electrum/electrum_test.go rename to internal/electrum/electrum_test.go index 5a9c29ef..e3537579 100644 --- a/electrum/electrum_test.go +++ b/internal/electrum/electrum_test.go @@ -4,10 +4,10 @@ package electrum import ( "context" + "github.com/BoltzExchange/boltz-client/v2/internal/test" "testing" - "github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/test" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" "github.com/stretchr/testify/require" ) diff --git a/lightning/bolt12.go b/internal/lightning/bolt12.go similarity index 100% rename from lightning/bolt12.go rename to internal/lightning/bolt12.go diff --git a/lightning/bolt12_test.go b/internal/lightning/bolt12_test.go similarity index 100% rename from lightning/bolt12_test.go rename to internal/lightning/bolt12_test.go diff --git a/lightning/channel.go b/internal/lightning/channel.go similarity index 100% rename from lightning/channel.go rename to internal/lightning/channel.go diff --git a/lightning/channel_test.go b/internal/lightning/channel_test.go similarity index 100% rename from lightning/channel_test.go rename to internal/lightning/channel_test.go diff --git a/lightning/connect.go b/internal/lightning/connect.go similarity index 93% rename from lightning/connect.go rename to internal/lightning/connect.go index d2985b28..f957539d 100644 --- a/lightning/connect.go +++ b/internal/lightning/connect.go @@ -6,8 +6,8 @@ import ( "net" "strings" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" ) func searchUri(network string, uris []string) string { diff --git a/lightning/connect_test.go b/internal/lightning/connect_test.go similarity index 100% rename from lightning/connect_test.go rename to internal/lightning/connect_test.go diff --git a/lightning/dynamic.go b/internal/lightning/dynamic.go similarity index 100% rename from lightning/dynamic.go rename to internal/lightning/dynamic.go diff --git a/lightning/invoice.go b/internal/lightning/invoice.go similarity index 93% rename from lightning/invoice.go rename to internal/lightning/invoice.go index cc501afb..01c91320 100644 --- a/lightning/invoice.go +++ b/internal/lightning/invoice.go @@ -2,7 +2,7 @@ package lightning import "C" import ( - "github.com/BoltzExchange/boltz-client/v2/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/chaincfg" "github.com/lightningnetwork/lnd/zpay32" diff --git a/lightning/lib/bolt12/Cargo.lock b/internal/lightning/lib/bolt12/Cargo.lock similarity index 100% rename from lightning/lib/bolt12/Cargo.lock rename to internal/lightning/lib/bolt12/Cargo.lock diff --git a/lightning/lib/bolt12/Cargo.toml b/internal/lightning/lib/bolt12/Cargo.toml similarity index 100% rename from lightning/lib/bolt12/Cargo.toml rename to internal/lightning/lib/bolt12/Cargo.toml diff --git a/lightning/lib/bolt12/build.rs b/internal/lightning/lib/bolt12/build.rs similarity index 100% rename from lightning/lib/bolt12/build.rs rename to internal/lightning/lib/bolt12/build.rs diff --git a/lightning/lib/bolt12/src/lib.rs b/internal/lightning/lib/bolt12/src/lib.rs similarity index 100% rename from lightning/lib/bolt12/src/lib.rs rename to internal/lightning/lib/bolt12/src/lib.rs diff --git a/lightning/lightning.go b/internal/lightning/lightning.go similarity index 95% rename from lightning/lightning.go rename to internal/lightning/lightning.go index a79d5191..d4a4f70c 100755 --- a/lightning/lightning.go +++ b/internal/lightning/lightning.go @@ -3,8 +3,8 @@ package lightning import ( "context" "errors" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" ) type PaymentState string diff --git a/lightning/payment_fee.go b/internal/lightning/payment_fee.go similarity index 100% rename from lightning/payment_fee.go rename to internal/lightning/payment_fee.go diff --git a/lightning/payment_fee_test.go b/internal/lightning/payment_fee_test.go similarity index 100% rename from lightning/payment_fee_test.go rename to internal/lightning/payment_fee_test.go diff --git a/lightning/static.go b/internal/lightning/static.go similarity index 100% rename from lightning/static.go rename to internal/lightning/static.go diff --git a/lnd/lnd.go b/internal/lnd/lnd.go similarity index 98% rename from lnd/lnd.go rename to internal/lnd/lnd.go index da81e85a..f8b19d3b 100644 --- a/lnd/lnd.go +++ b/internal/lnd/lnd.go @@ -10,9 +10,9 @@ import ( "strconv" "strings" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc/chainrpc" "github.com/lightningnetwork/lnd/lnrpc/invoicesrpc" diff --git a/logger/logger.go b/internal/logger/logger.go similarity index 100% rename from logger/logger.go rename to internal/logger/logger.go diff --git a/macaroons/interceptors.go b/internal/macaroons/interceptors.go similarity index 100% rename from macaroons/interceptors.go rename to internal/macaroons/interceptors.go diff --git a/macaroons/permissions.go b/internal/macaroons/permissions.go similarity index 98% rename from macaroons/permissions.go rename to internal/macaroons/permissions.go index e215287e..f9a233cc 100644 --- a/macaroons/permissions.go +++ b/internal/macaroons/permissions.go @@ -1,7 +1,7 @@ package macaroons import ( - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "gopkg.in/macaroon-bakery.v2/bakery" ) diff --git a/macaroons/permissions_test.go b/internal/macaroons/permissions_test.go similarity index 100% rename from macaroons/permissions_test.go rename to internal/macaroons/permissions_test.go diff --git a/macaroons/service.go b/internal/macaroons/service.go similarity index 96% rename from macaroons/service.go rename to internal/macaroons/service.go index a581a30a..205f0ed5 100644 --- a/macaroons/service.go +++ b/internal/macaroons/service.go @@ -3,7 +3,7 @@ package macaroons import ( "context" "fmt" - "github.com/BoltzExchange/boltz-client/v2/database" + "github.com/BoltzExchange/boltz-client/v2/internal/database" "gopkg.in/macaroon-bakery.v2/bakery" "gopkg.in/macaroon-bakery.v2/bakery/checkers" "gopkg.in/macaroon.v2" diff --git a/macaroons/storage.go b/internal/macaroons/storage.go similarity index 94% rename from macaroons/storage.go rename to internal/macaroons/storage.go index f5f5e3cd..db9dc8bb 100644 --- a/macaroons/storage.go +++ b/internal/macaroons/storage.go @@ -2,7 +2,7 @@ package macaroons import ( "context" - "github.com/BoltzExchange/boltz-client/v2/database" + "github.com/BoltzExchange/boltz-client/v2/internal/database" ) // TODO: encryption diff --git a/macaroons/utils.go b/internal/macaroons/utils.go similarity index 95% rename from macaroons/utils.go rename to internal/macaroons/utils.go index 6610629a..20b3737f 100644 --- a/macaroons/utils.go +++ b/internal/macaroons/utils.go @@ -4,7 +4,7 @@ import ( "context" "crypto/rand" "errors" - "github.com/BoltzExchange/boltz-client/v2/database" + "github.com/BoltzExchange/boltz-client/v2/internal/database" "io" ) diff --git a/macaroons/utils_test.go b/internal/macaroons/utils_test.go similarity index 100% rename from macaroons/utils_test.go rename to internal/macaroons/utils_test.go diff --git a/mempool/mempool.go b/internal/mempool/mempool.go similarity index 97% rename from mempool/mempool.go rename to internal/mempool/mempool.go index 3317ab6d..ffc515eb 100644 --- a/mempool/mempool.go +++ b/internal/mempool/mempool.go @@ -12,8 +12,8 @@ import ( "strings" "time" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" "github.com/btcsuite/websocket" ) diff --git a/mempool/mempool_test.go b/internal/mempool/mempool_test.go similarity index 96% rename from mempool/mempool_test.go rename to internal/mempool/mempool_test.go index 5d6b6871..44ef0bc6 100644 --- a/mempool/mempool_test.go +++ b/internal/mempool/mempool_test.go @@ -5,9 +5,9 @@ package mempool import ( "testing" - "github.com/BoltzExchange/boltz-client/v2/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/mocks/github.com/BoltzExchange/boltz-client/v2/lightning/LightningNode_mock.go b/internal/mocks/lightning/LightningNode_mock.go similarity index 97% rename from mocks/github.com/BoltzExchange/boltz-client/v2/lightning/LightningNode_mock.go rename to internal/mocks/lightning/LightningNode_mock.go index 127e3d6b..ccff25fe 100644 --- a/mocks/github.com/BoltzExchange/boltz-client/v2/lightning/LightningNode_mock.go +++ b/internal/mocks/lightning/LightningNode_mock.go @@ -1,14 +1,14 @@ -// Code generated by mockery v2.50.1. DO NOT EDIT. +// Code generated by mockery v2.42.2. DO NOT EDIT. package lightning import ( context "context" - lightning "github.com/BoltzExchange/boltz-client/v2/lightning" + lightning "github.com/BoltzExchange/boltz-client/v2/internal/lightning" mock "github.com/stretchr/testify/mock" - onchain "github.com/BoltzExchange/boltz-client/v2/onchain" + onchain "github.com/BoltzExchange/boltz-client/v2/internal/onchain" ) // MockLightningNode is an autogenerated mock type for the LightningNode type @@ -80,7 +80,7 @@ func (_c *MockLightningNode_CheckInvoicePaid_Call) RunAndReturn(run func([]byte) return _c } -// Connect provides a mock function with no fields +// Connect provides a mock function with given fields: func (_m *MockLightningNode) Connect() error { ret := _m.Called() @@ -232,7 +232,7 @@ func (_c *MockLightningNode_CreateInvoice_Call) RunAndReturn(run func(uint64, [] return _c } -// Disconnect provides a mock function with no fields +// Disconnect provides a mock function with given fields: func (_m *MockLightningNode) Disconnect() error { ret := _m.Called() @@ -277,7 +277,7 @@ func (_c *MockLightningNode_Disconnect_Call) RunAndReturn(run func() error) *Moc return _c } -// GetBalance provides a mock function with no fields +// GetBalance provides a mock function with given fields: func (_m *MockLightningNode) GetBalance() (*onchain.Balance, error) { ret := _m.Called() @@ -334,7 +334,7 @@ func (_c *MockLightningNode_GetBalance_Call) RunAndReturn(run func() (*onchain.B return _c } -// GetInfo provides a mock function with no fields +// GetInfo provides a mock function with given fields: func (_m *MockLightningNode) GetInfo() (*lightning.LightningInfo, error) { ret := _m.Called() @@ -450,7 +450,7 @@ func (_c *MockLightningNode_GetTransactions_Call) RunAndReturn(run func(uint64, return _c } -// GetWalletInfo provides a mock function with no fields +// GetWalletInfo provides a mock function with given fields: func (_m *MockLightningNode) GetWalletInfo() onchain.WalletInfo { ret := _m.Called() @@ -495,7 +495,7 @@ func (_c *MockLightningNode_GetWalletInfo_Call) RunAndReturn(run func() onchain. return _c } -// ListChannels provides a mock function with no fields +// ListChannels provides a mock function with given fields: func (_m *MockLightningNode) ListChannels() ([]*lightning.LightningChannel, error) { ret := _m.Called() @@ -552,7 +552,7 @@ func (_c *MockLightningNode_ListChannels_Call) RunAndReturn(run func() ([]*light return _c } -// Name provides a mock function with no fields +// Name provides a mock function with given fields: func (_m *MockLightningNode) Name() string { ret := _m.Called() @@ -597,7 +597,7 @@ func (_c *MockLightningNode_Name_Call) RunAndReturn(run func() string) *MockLigh return _c } -// NewAddress provides a mock function with no fields +// NewAddress provides a mock function with given fields: func (_m *MockLightningNode) NewAddress() (string, error) { ret := _m.Called() @@ -772,7 +772,7 @@ func (_c *MockLightningNode_PaymentStatus_Call) RunAndReturn(run func([]byte) (* return _c } -// Ready provides a mock function with no fields +// Ready provides a mock function with given fields: func (_m *MockLightningNode) Ready() bool { ret := _m.Called() @@ -905,7 +905,7 @@ func (_c *MockLightningNode_SetupWallet_Call) Return() *MockLightningNode_SetupW } func (_c *MockLightningNode_SetupWallet_Call) RunAndReturn(run func(onchain.WalletInfo)) *MockLightningNode_SetupWallet_Call { - _c.Run(run) + _c.Call.Return(run) return _c } diff --git a/mocks/github.com/BoltzExchange/boltz-client/v2/onchain/BlockProvider_mock.go b/internal/mocks/onchain/BlockProvider_mock.go similarity index 96% rename from mocks/github.com/BoltzExchange/boltz-client/v2/onchain/BlockProvider_mock.go rename to internal/mocks/onchain/BlockProvider_mock.go index 7895ad47..59b8cd2f 100644 --- a/mocks/github.com/BoltzExchange/boltz-client/v2/onchain/BlockProvider_mock.go +++ b/internal/mocks/onchain/BlockProvider_mock.go @@ -1,11 +1,11 @@ -// Code generated by mockery v2.50.1. DO NOT EDIT. +// Code generated by mockery v2.42.2. DO NOT EDIT. package onchain import ( context "context" - onchain "github.com/BoltzExchange/boltz-client/v2/onchain" + onchain "github.com/BoltzExchange/boltz-client/v2/internal/onchain" mock "github.com/stretchr/testify/mock" ) @@ -22,7 +22,7 @@ func (_m *MockBlockProvider) EXPECT() *MockBlockProvider_Expecter { return &MockBlockProvider_Expecter{mock: &_m.Mock} } -// Disconnect provides a mock function with no fields +// Disconnect provides a mock function with given fields: func (_m *MockBlockProvider) Disconnect() { _m.Called() } @@ -50,11 +50,11 @@ func (_c *MockBlockProvider_Disconnect_Call) Return() *MockBlockProvider_Disconn } func (_c *MockBlockProvider_Disconnect_Call) RunAndReturn(run func()) *MockBlockProvider_Disconnect_Call { - _c.Run(run) + _c.Call.Return(run) return _c } -// EstimateFee provides a mock function with no fields +// EstimateFee provides a mock function with given fields: func (_m *MockBlockProvider) EstimateFee() (float64, error) { ret := _m.Called() @@ -109,7 +109,7 @@ func (_c *MockBlockProvider_EstimateFee_Call) RunAndReturn(run func() (float64, return _c } -// GetBlockHeight provides a mock function with no fields +// GetBlockHeight provides a mock function with given fields: func (_m *MockBlockProvider) GetBlockHeight() (uint32, error) { ret := _m.Called() diff --git a/mocks/github.com/BoltzExchange/boltz-client/v2/onchain/TxProvider_mock.go b/internal/mocks/onchain/TxProvider_mock.go similarity index 99% rename from mocks/github.com/BoltzExchange/boltz-client/v2/onchain/TxProvider_mock.go rename to internal/mocks/onchain/TxProvider_mock.go index 139e7303..40b7d463 100644 --- a/mocks/github.com/BoltzExchange/boltz-client/v2/onchain/TxProvider_mock.go +++ b/internal/mocks/onchain/TxProvider_mock.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.50.1. DO NOT EDIT. +// Code generated by mockery v2.42.2. DO NOT EDIT. package onchain diff --git a/mocks/github.com/BoltzExchange/boltz-client/v2/onchain/Wallet_mock.go b/internal/mocks/onchain/Wallet_mock.go similarity index 96% rename from mocks/github.com/BoltzExchange/boltz-client/v2/onchain/Wallet_mock.go rename to internal/mocks/onchain/Wallet_mock.go index bef9f22d..db40a364 100644 --- a/mocks/github.com/BoltzExchange/boltz-client/v2/onchain/Wallet_mock.go +++ b/internal/mocks/onchain/Wallet_mock.go @@ -1,9 +1,9 @@ -// Code generated by mockery v2.50.1. DO NOT EDIT. +// Code generated by mockery v2.42.2. DO NOT EDIT. package onchain import ( - onchain "github.com/BoltzExchange/boltz-client/v2/onchain" + onchain "github.com/BoltzExchange/boltz-client/v2/internal/onchain" mock "github.com/stretchr/testify/mock" ) @@ -20,7 +20,7 @@ func (_m *MockWallet) EXPECT() *MockWallet_Expecter { return &MockWallet_Expecter{mock: &_m.Mock} } -// Disconnect provides a mock function with no fields +// Disconnect provides a mock function with given fields: func (_m *MockWallet) Disconnect() error { ret := _m.Called() @@ -65,7 +65,7 @@ func (_c *MockWallet_Disconnect_Call) RunAndReturn(run func() error) *MockWallet return _c } -// GetBalance provides a mock function with no fields +// GetBalance provides a mock function with given fields: func (_m *MockWallet) GetBalance() (*onchain.Balance, error) { ret := _m.Called() @@ -181,7 +181,7 @@ func (_c *MockWallet_GetTransactions_Call) RunAndReturn(run func(uint64, uint64) return _c } -// GetWalletInfo provides a mock function with no fields +// GetWalletInfo provides a mock function with given fields: func (_m *MockWallet) GetWalletInfo() onchain.WalletInfo { ret := _m.Called() @@ -226,7 +226,7 @@ func (_c *MockWallet_GetWalletInfo_Call) RunAndReturn(run func() onchain.WalletI return _c } -// NewAddress provides a mock function with no fields +// NewAddress provides a mock function with given fields: func (_m *MockWallet) NewAddress() (string, error) { ret := _m.Called() @@ -281,7 +281,7 @@ func (_c *MockWallet_NewAddress_Call) RunAndReturn(run func() (string, error)) * return _c } -// Ready provides a mock function with no fields +// Ready provides a mock function with given fields: func (_m *MockWallet) Ready() bool { ret := _m.Called() diff --git a/nursery/chain.go b/internal/nursery/chain.go similarity index 96% rename from nursery/chain.go rename to internal/nursery/chain.go index b88774d7..616b4c66 100644 --- a/nursery/chain.go +++ b/internal/nursery/chain.go @@ -3,11 +3,11 @@ package nursery import ( "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" ) func (nursery *Nursery) sendChainSwapUpdate(swap database.ChainSwap) { diff --git a/nursery/data/test.json b/internal/nursery/data/test.json similarity index 100% rename from nursery/data/test.json rename to internal/nursery/data/test.json diff --git a/nursery/nursery.go b/internal/nursery/nursery.go similarity index 95% rename from nursery/nursery.go rename to internal/nursery/nursery.go index 448460bd..9ee4c278 100644 --- a/nursery/nursery.go +++ b/internal/nursery/nursery.go @@ -6,19 +6,19 @@ import ( "fmt" "sync" - "github.com/BoltzExchange/boltz-client/v2/onchain/wallet" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain/wallet" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" ) type Nursery struct { diff --git a/nursery/refund.go b/internal/nursery/refund.go similarity index 87% rename from nursery/refund.go rename to internal/nursery/refund.go index 5a470af9..1c3e9a4e 100644 --- a/nursery/refund.go +++ b/internal/nursery/refund.go @@ -2,11 +2,11 @@ package nursery import ( "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" ) func (nursery *Nursery) startBlockListener(currency boltz.Currency) *utils.ChannelForwarder[*onchain.BlockEpoch] { diff --git a/nursery/reverse.go b/internal/nursery/reverse.go similarity index 96% rename from nursery/reverse.go rename to internal/nursery/reverse.go index 467ab0f7..190457be 100644 --- a/nursery/reverse.go +++ b/internal/nursery/reverse.go @@ -5,18 +5,18 @@ import ( "database/sql" "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/onchain/wallet" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain/wallet" "github.com/btcsuite/btcd/btcec/v2" "slices" "time" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" ) func (nursery *Nursery) sendReverseSwapUpdate(reverseSwap database.ReverseSwap) { diff --git a/nursery/swap.go b/internal/nursery/swap.go similarity index 96% rename from nursery/swap.go rename to internal/nursery/swap.go index 4c3feb36..f06c6f2e 100644 --- a/nursery/swap.go +++ b/internal/nursery/swap.go @@ -5,13 +5,13 @@ import ( "crypto/sha256" "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" ) func (nursery *Nursery) sendSwapUpdate(swap database.Swap) { diff --git a/onchain/boltz.go b/internal/onchain/boltz.go similarity index 92% rename from onchain/boltz.go rename to internal/onchain/boltz.go index 6b694c55..d18f2ddf 100644 --- a/onchain/boltz.go +++ b/internal/onchain/boltz.go @@ -1,7 +1,7 @@ package onchain import ( - "github.com/BoltzExchange/boltz-client/v2/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" ) type BoltzTxProvider struct { diff --git a/onchain/multi_tx.go b/internal/onchain/multi_tx.go similarity index 100% rename from onchain/multi_tx.go rename to internal/onchain/multi_tx.go diff --git a/onchain/multi_tx_test.go b/internal/onchain/multi_tx_test.go similarity index 91% rename from onchain/multi_tx_test.go rename to internal/onchain/multi_tx_test.go index 1efc1a61..1c99f321 100644 --- a/onchain/multi_tx_test.go +++ b/internal/onchain/multi_tx_test.go @@ -1,8 +1,8 @@ package onchain_test import ( - onchainmock "github.com/BoltzExchange/boltz-client/v2/mocks/github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/onchain" + onchainmock "github.com/BoltzExchange/boltz-client/v2/internal/mocks/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" "github.com/stretchr/testify/assert" "testing" ) diff --git a/onchain/onchain.go b/internal/onchain/onchain.go similarity index 98% rename from onchain/onchain.go rename to internal/onchain/onchain.go index f1f6d472..e566bea1 100644 --- a/onchain/onchain.go +++ b/internal/onchain/onchain.go @@ -9,9 +9,9 @@ import ( "sync" "time" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" "github.com/btcsuite/btcd/btcec/v2" "github.com/vulpemventures/go-elements/confidential" ) diff --git a/onchain/onchain_test.go b/internal/onchain/onchain_test.go similarity index 73% rename from onchain/onchain_test.go rename to internal/onchain/onchain_test.go index 340bfdb3..bdb27c2f 100644 --- a/onchain/onchain_test.go +++ b/internal/onchain/onchain_test.go @@ -3,10 +3,10 @@ package onchain_test import ( - "github.com/BoltzExchange/boltz-client/v2/boltz" - onchainmock "github.com/BoltzExchange/boltz-client/v2/mocks/github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/onchain/wallet" + onchainmock "github.com/BoltzExchange/boltz-client/v2/internal/mocks/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain/wallet" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" "github.com/stretchr/testify/require" "testing" ) diff --git a/onchain/wallet/dummy.cpp b/internal/onchain/wallet/dummy.cpp similarity index 100% rename from onchain/wallet/dummy.cpp rename to internal/onchain/wallet/dummy.cpp diff --git a/onchain/wallet/dynamic.go b/internal/onchain/wallet/dynamic.go similarity index 100% rename from onchain/wallet/dynamic.go rename to internal/onchain/wallet/dynamic.go diff --git a/onchain/wallet/encrypt.go b/internal/onchain/wallet/encrypt.go similarity index 100% rename from onchain/wallet/encrypt.go rename to internal/onchain/wallet/encrypt.go diff --git a/onchain/wallet/encrypt_test.go b/internal/onchain/wallet/encrypt_test.go similarity index 100% rename from onchain/wallet/encrypt_test.go rename to internal/onchain/wallet/encrypt_test.go diff --git a/onchain/wallet/handler.go b/internal/onchain/wallet/handler.go similarity index 95% rename from onchain/wallet/handler.go rename to internal/onchain/wallet/handler.go index 80ced1f1..b1404a21 100644 --- a/onchain/wallet/handler.go +++ b/internal/onchain/wallet/handler.go @@ -1,7 +1,7 @@ package wallet import ( - "github.com/BoltzExchange/boltz-client/v2/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" "sync" ) diff --git a/onchain/wallet/include/gdk.h b/internal/onchain/wallet/include/gdk.h similarity index 100% rename from onchain/wallet/include/gdk.h rename to internal/onchain/wallet/include/gdk.h diff --git a/onchain/wallet/include/gdk_export.h b/internal/onchain/wallet/include/gdk_export.h similarity index 100% rename from onchain/wallet/include/gdk_export.h rename to internal/onchain/wallet/include/gdk_export.h diff --git a/onchain/wallet/lib/.gitkeep b/internal/onchain/wallet/lib/.dockerenv old mode 100644 new mode 100755 similarity index 100% rename from onchain/wallet/lib/.gitkeep rename to internal/onchain/wallet/lib/.dockerenv diff --git a/internal/onchain/wallet/lib/.gitkeep b/internal/onchain/wallet/lib/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/internal/onchain/wallet/lib/dev/console b/internal/onchain/wallet/lib/dev/console new file mode 100755 index 00000000..e69de29b diff --git a/internal/onchain/wallet/lib/etc/hostname b/internal/onchain/wallet/lib/etc/hostname new file mode 100755 index 00000000..e69de29b diff --git a/internal/onchain/wallet/lib/etc/hosts b/internal/onchain/wallet/lib/etc/hosts new file mode 100755 index 00000000..e69de29b diff --git a/internal/onchain/wallet/lib/etc/mtab b/internal/onchain/wallet/lib/etc/mtab new file mode 120000 index 00000000..4c0a0948 --- /dev/null +++ b/internal/onchain/wallet/lib/etc/mtab @@ -0,0 +1 @@ +/proc/mounts \ No newline at end of file diff --git a/internal/onchain/wallet/lib/etc/resolv.conf b/internal/onchain/wallet/lib/etc/resolv.conf new file mode 100755 index 00000000..e69de29b diff --git a/onchain/wallet/static.go b/internal/onchain/wallet/static.go similarity index 100% rename from onchain/wallet/static.go rename to internal/onchain/wallet/static.go diff --git a/onchain/wallet/wallet.go b/internal/onchain/wallet/wallet.go similarity index 99% rename from onchain/wallet/wallet.go rename to internal/onchain/wallet/wallet.go index 0dd27cf5..0e76970e 100644 --- a/onchain/wallet/wallet.go +++ b/internal/onchain/wallet/wallet.go @@ -17,7 +17,7 @@ import ( "encoding/json" "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" "github.com/btcsuite/btcd/wire" "github.com/mitchellh/mapstructure" "slices" @@ -26,10 +26,10 @@ import ( "time" "unsafe" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" - "github.com/BoltzExchange/boltz-client/v2/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" ) const MinFeeRate = 0.01 diff --git a/onchain/wallet/wallet_test.go b/internal/onchain/wallet/wallet_test.go similarity index 95% rename from onchain/wallet/wallet_test.go rename to internal/onchain/wallet/wallet_test.go index 6b0a405f..91a3305d 100644 --- a/onchain/wallet/wallet_test.go +++ b/internal/onchain/wallet/wallet_test.go @@ -3,12 +3,12 @@ package wallet_test import ( - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/logger" - onchainmock "github.com/BoltzExchange/boltz-client/v2/mocks/github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/onchain" - onchainWallet "github.com/BoltzExchange/boltz-client/v2/onchain/wallet" - "github.com/BoltzExchange/boltz-client/v2/test" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + onchainmock "github.com/BoltzExchange/boltz-client/v2/internal/mocks/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + onchainWallet "github.com/BoltzExchange/boltz-client/v2/internal/onchain/wallet" + "github.com/BoltzExchange/boltz-client/v2/internal/test" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" "github.com/btcsuite/btcd/wire" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" diff --git a/rpcserver/autoswap.go b/internal/rpcserver/autoswap.go similarity index 95% rename from rpcserver/autoswap.go rename to internal/rpcserver/autoswap.go index fe2e7e37..8329e4b0 100644 --- a/rpcserver/autoswap.go +++ b/internal/rpcserver/autoswap.go @@ -4,10 +4,10 @@ import ( "context" "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/autoswap" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/autoswaprpc" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/macaroons" + "github.com/BoltzExchange/boltz-client/v2/internal/autoswap" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/macaroons" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/autoswaprpc" "github.com/golang/protobuf/ptypes/empty" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/rpcserver/cert.go b/internal/rpcserver/cert.go similarity index 91% rename from rpcserver/cert.go rename to internal/rpcserver/cert.go index d725db41..1de00c0f 100644 --- a/rpcserver/cert.go +++ b/internal/rpcserver/cert.go @@ -2,8 +2,8 @@ package rpcserver import ( "crypto/tls" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" "github.com/lightningnetwork/lnd/cert" "os" "time" diff --git a/rpcserver/cert_test.go b/internal/rpcserver/cert_test.go similarity index 95% rename from rpcserver/cert_test.go rename to internal/rpcserver/cert_test.go index 42b3ada5..95b8d774 100644 --- a/rpcserver/cert_test.go +++ b/internal/rpcserver/cert_test.go @@ -1,7 +1,7 @@ package rpcserver import ( - "github.com/BoltzExchange/boltz-client/v2/test" + "github.com/BoltzExchange/boltz-client/v2/internal/test" "os" "testing" diff --git a/rpcserver/macaroons.go b/internal/rpcserver/macaroons.go similarity index 87% rename from rpcserver/macaroons.go rename to internal/rpcserver/macaroons.go index 3e3dc1cd..e0f4c2b1 100644 --- a/rpcserver/macaroons.go +++ b/internal/rpcserver/macaroons.go @@ -3,10 +3,10 @@ package rpcserver import ( "os" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/macaroons" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/macaroons" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" "gopkg.in/macaroon-bakery.v2/bakery" ) diff --git a/rpcserver/router.go b/internal/rpcserver/router.go similarity index 98% rename from rpcserver/router.go rename to internal/rpcserver/router.go index ebaff72f..c7ccfe30 100644 --- a/rpcserver/router.go +++ b/internal/rpcserver/router.go @@ -9,7 +9,7 @@ import ( "encoding/hex" "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/serializers" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/serializers" "github.com/fiatjaf/go-lnurl" "math" "net/url" @@ -20,18 +20,18 @@ import ( "sync" "time" - "github.com/BoltzExchange/boltz-client/v2/autoswap" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/build" - "github.com/BoltzExchange/boltz-client/v2/database" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/macaroons" - "github.com/BoltzExchange/boltz-client/v2/nursery" - "github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/onchain/wallet" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/autoswap" + "github.com/BoltzExchange/boltz-client/v2/internal/build" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/macaroons" + "github.com/BoltzExchange/boltz-client/v2/internal/nursery" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain/wallet" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcec/v2/schnorr" "github.com/btcsuite/btcd/btcutil" diff --git a/rpcserver/router_test.go b/internal/rpcserver/router_test.go similarity index 93% rename from rpcserver/router_test.go rename to internal/rpcserver/router_test.go index 3fccb22a..eb60b9ad 100644 --- a/rpcserver/router_test.go +++ b/internal/rpcserver/router_test.go @@ -1,8 +1,8 @@ package rpcserver import ( - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "github.com/stretchr/testify/require" "testing" "time" diff --git a/rpcserver/rpcserver_test.go b/internal/rpcserver/rpcserver_test.go similarity index 98% rename from rpcserver/rpcserver_test.go rename to internal/rpcserver/rpcserver_test.go index 712ed966..bbd3c56c 100644 --- a/rpcserver/rpcserver_test.go +++ b/internal/rpcserver/rpcserver_test.go @@ -8,41 +8,40 @@ import ( "crypto/sha256" "encoding/hex" "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/serializers" + "github.com/BoltzExchange/boltz-client/v2/internal/test" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/serializers" "net" "os" "strings" "testing" "time" - "github.com/BoltzExchange/boltz-client/v2/macaroons" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/macaroons" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" "github.com/btcsuite/btcd/btcutil" "github.com/stretchr/testify/mock" "google.golang.org/grpc" "google.golang.org/protobuf/types/known/fieldmaskpb" - "github.com/BoltzExchange/boltz-client/v2/database" + "github.com/BoltzExchange/boltz-client/v2/internal/database" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/autoswaprpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/autoswaprpc" "github.com/vulpemventures/go-elements/address" - "github.com/BoltzExchange/boltz-client/v2/autoswap" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/client" - lnmock "github.com/BoltzExchange/boltz-client/v2/mocks/github.com/BoltzExchange/boltz-client/v2/lightning" - onchainmock "github.com/BoltzExchange/boltz-client/v2/mocks/github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/onchain/wallet" + "github.com/BoltzExchange/boltz-client/v2/internal/autoswap" + lnmock "github.com/BoltzExchange/boltz-client/v2/internal/mocks/lightning" + onchainmock "github.com/BoltzExchange/boltz-client/v2/internal/mocks/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain/wallet" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/client" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/txscript" "github.com/lightningnetwork/lnd/zpay32" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/test" - - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/config" - "github.com/BoltzExchange/boltz-client/v2/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/config" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc/codes" diff --git a/rpcserver/serializer.go b/internal/rpcserver/serializer.go similarity index 95% rename from rpcserver/serializer.go rename to internal/rpcserver/serializer.go index 6e529ff7..3700feb6 100644 --- a/rpcserver/serializer.go +++ b/internal/rpcserver/serializer.go @@ -1,16 +1,16 @@ package rpcserver import ( - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/serializers" - "github.com/BoltzExchange/boltz-client/v2/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/serializers" "time" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/onchain/wallet" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain/wallet" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/database" + "github.com/BoltzExchange/boltz-client/v2/internal/database" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" ) func serializeOptionalString(value string) *string { diff --git a/rpcserver/server.go b/internal/rpcserver/server.go similarity index 94% rename from rpcserver/server.go rename to internal/rpcserver/server.go index 8e67e285..2801bfbf 100644 --- a/rpcserver/server.go +++ b/internal/rpcserver/server.go @@ -4,10 +4,10 @@ import ( "context" "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/config" - "github.com/BoltzExchange/boltz-client/v2/electrum" - "github.com/BoltzExchange/boltz-client/v2/mempool" - "github.com/BoltzExchange/boltz-client/v2/onchain/wallet" + "github.com/BoltzExchange/boltz-client/v2/internal/config" + "github.com/BoltzExchange/boltz-client/v2/internal/electrum" + "github.com/BoltzExchange/boltz-client/v2/internal/mempool" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain/wallet" "google.golang.org/grpc/keepalive" "io/fs" "net" @@ -20,13 +20,13 @@ import ( "sync" "time" - "github.com/BoltzExchange/boltz-client/v2/autoswap" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/autoswaprpc" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/autoswap" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/autoswaprpc" "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/rs/cors" "google.golang.org/grpc" diff --git a/rpcserver/sync.go b/internal/rpcserver/sync.go similarity index 87% rename from rpcserver/sync.go rename to internal/rpcserver/sync.go index d196eced..d631f835 100644 --- a/rpcserver/sync.go +++ b/internal/rpcserver/sync.go @@ -1,8 +1,8 @@ package rpcserver import ( - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" "strconv" "strings" "time" diff --git a/rpcserver/test/boltz.toml b/internal/rpcserver/test/boltz.toml similarity index 57% rename from rpcserver/test/boltz.toml rename to internal/rpcserver/test/boltz.toml index 1b58667c..c348ef76 100644 --- a/rpcserver/test/boltz.toml +++ b/internal/rpcserver/test/boltz.toml @@ -3,9 +3,9 @@ network = "regtest" [LND] host = "127.0.0.1" port = 10009 -datadir = "../regtest/data/lnd1" +datadir = "../../regtest/data/lnd1" [CLN] host = "127.0.0.1" port = 9736 -datadir = "../regtest/data/cln1" +datadir = "../../regtest/data/cln1" diff --git a/rpcserver/version.go b/internal/rpcserver/version.go similarity index 75% rename from rpcserver/version.go rename to internal/rpcserver/version.go index 0e044192..41461e73 100644 --- a/rpcserver/version.go +++ b/internal/rpcserver/version.go @@ -1,10 +1,10 @@ package rpcserver import ( - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/lightning" - "github.com/BoltzExchange/boltz-client/v2/logger" - "github.com/BoltzExchange/boltz-client/v2/utils" + "github.com/BoltzExchange/boltz-client/v2/internal/lightning" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/utils" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" ) const minLndVersion = "0.15.0" diff --git a/test/test.go b/internal/test/test.go similarity index 94% rename from test/test.go rename to internal/test/test.go index 496f5f02..e54f2208 100644 --- a/test/test.go +++ b/internal/test/test.go @@ -11,14 +11,14 @@ import ( "testing" "time" - "github.com/BoltzExchange/boltz-client/v2/database" + "github.com/BoltzExchange/boltz-client/v2/internal/database" - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/onchain" - "github.com/BoltzExchange/boltz-client/v2/onchain/wallet" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain/wallet" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" "github.com/stretchr/testify/require" - "github.com/BoltzExchange/boltz-client/v2/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" ) type Cli func(string) string diff --git a/utils/channelforwarder.go b/internal/utils/channelforwarder.go similarity index 100% rename from utils/channelforwarder.go rename to internal/utils/channelforwarder.go diff --git a/utils/datadir.go b/internal/utils/datadir.go similarity index 100% rename from utils/datadir.go rename to internal/utils/datadir.go diff --git a/utils/datadir_test.go b/internal/utils/datadir_test.go similarity index 100% rename from utils/datadir_test.go rename to internal/utils/datadir_test.go diff --git a/utils/fees.go b/internal/utils/fees.go similarity index 65% rename from utils/fees.go rename to internal/utils/fees.go index dd7da702..68c7baab 100644 --- a/utils/fees.go +++ b/internal/utils/fees.go @@ -1,8 +1,8 @@ package utils import ( - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" ) func CalculateFeeEstimate(fees *boltzrpc.SwapFees, amount uint64) uint64 { diff --git a/utils/json.go b/internal/utils/json.go similarity index 100% rename from utils/json.go rename to internal/utils/json.go diff --git a/utils/memo.go b/internal/utils/memo.go similarity index 100% rename from utils/memo.go rename to internal/utils/memo.go diff --git a/utils/memo_test.go b/internal/utils/memo_test.go similarity index 100% rename from utils/memo_test.go rename to internal/utils/memo_test.go diff --git a/utils/utils.go b/internal/utils/utils.go similarity index 100% rename from utils/utils.go rename to internal/utils/utils.go diff --git a/utils/utils_test.go b/internal/utils/utils_test.go similarity index 100% rename from utils/utils_test.go rename to internal/utils/utils_test.go diff --git a/utils/version.go b/internal/utils/version.go similarity index 100% rename from utils/version.go rename to internal/utils/version.go diff --git a/utils/version_test.go b/internal/utils/version_test.go similarity index 100% rename from utils/version_test.go rename to internal/utils/version_test.go diff --git a/boltz/address.go b/pkg/boltz/address.go similarity index 100% rename from boltz/address.go rename to pkg/boltz/address.go diff --git a/boltz/address_test.go b/pkg/boltz/address_test.go similarity index 100% rename from boltz/address_test.go rename to pkg/boltz/address_test.go diff --git a/boltz/api.go b/pkg/boltz/api.go similarity index 100% rename from boltz/api.go rename to pkg/boltz/api.go diff --git a/boltz/blocktime.go b/pkg/boltz/blocktime.go similarity index 100% rename from boltz/blocktime.go rename to pkg/boltz/blocktime.go diff --git a/boltz/blocktime_test.go b/pkg/boltz/blocktime_test.go similarity index 100% rename from boltz/blocktime_test.go rename to pkg/boltz/blocktime_test.go diff --git a/boltz/btc.go b/pkg/boltz/btc.go similarity index 100% rename from boltz/btc.go rename to pkg/boltz/btc.go diff --git a/boltz/currency.go b/pkg/boltz/currency.go similarity index 100% rename from boltz/currency.go rename to pkg/boltz/currency.go diff --git a/boltz/events.go b/pkg/boltz/events.go similarity index 100% rename from boltz/events.go rename to pkg/boltz/events.go diff --git a/boltz/fees.go b/pkg/boltz/fees.go similarity index 100% rename from boltz/fees.go rename to pkg/boltz/fees.go diff --git a/boltz/fees_test.go b/pkg/boltz/fees_test.go similarity index 100% rename from boltz/fees_test.go rename to pkg/boltz/fees_test.go diff --git a/boltz/liquid.go b/pkg/boltz/liquid.go similarity index 100% rename from boltz/liquid.go rename to pkg/boltz/liquid.go diff --git a/boltz/musig.go b/pkg/boltz/musig.go similarity index 100% rename from boltz/musig.go rename to pkg/boltz/musig.go diff --git a/boltz/network.go b/pkg/boltz/network.go similarity index 100% rename from boltz/network.go rename to pkg/boltz/network.go diff --git a/boltz/pair.go b/pkg/boltz/pair.go similarity index 100% rename from boltz/pair.go rename to pkg/boltz/pair.go diff --git a/boltz/routing_hints.go b/pkg/boltz/routing_hints.go similarity index 100% rename from boltz/routing_hints.go rename to pkg/boltz/routing_hints.go diff --git a/boltz/routing_hints_test.go b/pkg/boltz/routing_hints_test.go similarity index 100% rename from boltz/routing_hints_test.go rename to pkg/boltz/routing_hints_test.go diff --git a/boltz/swaptree.go b/pkg/boltz/swaptree.go similarity index 100% rename from boltz/swaptree.go rename to pkg/boltz/swaptree.go diff --git a/boltz/swaptree_test.go b/pkg/boltz/swaptree_test.go similarity index 100% rename from boltz/swaptree_test.go rename to pkg/boltz/swaptree_test.go diff --git a/boltz/transaction.go b/pkg/boltz/transaction.go similarity index 100% rename from boltz/transaction.go rename to pkg/boltz/transaction.go diff --git a/boltz/ws.go b/pkg/boltz/ws.go similarity index 98% rename from boltz/ws.go rename to pkg/boltz/ws.go index ec66def4..de42222e 100644 --- a/boltz/ws.go +++ b/pkg/boltz/ws.go @@ -9,7 +9,7 @@ import ( "slices" "time" - "github.com/BoltzExchange/boltz-client/v2/logger" + "github.com/BoltzExchange/boltz-client/v2/internal/logger" "github.com/gorilla/websocket" "github.com/mitchellh/mapstructure" ) diff --git a/boltzrpc/autoswaprpc/autoswaprpc.pb.go b/pkg/boltzrpc/autoswaprpc/autoswaprpc.pb.go similarity index 99% rename from boltzrpc/autoswaprpc/autoswaprpc.pb.go rename to pkg/boltzrpc/autoswaprpc/autoswaprpc.pb.go index 418e1df4..92209722 100644 --- a/boltzrpc/autoswaprpc/autoswaprpc.pb.go +++ b/pkg/boltzrpc/autoswaprpc/autoswaprpc.pb.go @@ -7,7 +7,7 @@ package autoswaprpc import ( - boltzrpc "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + boltzrpc "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" empty "github.com/golang/protobuf/ptypes/empty" field_mask "google.golang.org/genproto/protobuf/field_mask" protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/boltzrpc/autoswaprpc/autoswaprpc.proto b/pkg/boltzrpc/autoswaprpc/autoswaprpc.proto similarity index 100% rename from boltzrpc/autoswaprpc/autoswaprpc.proto rename to pkg/boltzrpc/autoswaprpc/autoswaprpc.proto diff --git a/boltzrpc/autoswaprpc/autoswaprpc_grpc.pb.go b/pkg/boltzrpc/autoswaprpc/autoswaprpc_grpc.pb.go similarity index 100% rename from boltzrpc/autoswaprpc/autoswaprpc_grpc.pb.go rename to pkg/boltzrpc/autoswaprpc/autoswaprpc_grpc.pb.go diff --git a/boltzrpc/boltzrpc.pb.go b/pkg/boltzrpc/boltzrpc.pb.go similarity index 100% rename from boltzrpc/boltzrpc.pb.go rename to pkg/boltzrpc/boltzrpc.pb.go diff --git a/boltzrpc/boltzrpc.pb.gw.go b/pkg/boltzrpc/boltzrpc.pb.gw.go similarity index 100% rename from boltzrpc/boltzrpc.pb.gw.go rename to pkg/boltzrpc/boltzrpc.pb.gw.go diff --git a/boltzrpc/boltzrpc.proto b/pkg/boltzrpc/boltzrpc.proto similarity index 100% rename from boltzrpc/boltzrpc.proto rename to pkg/boltzrpc/boltzrpc.proto diff --git a/boltzrpc/boltzrpc_grpc.pb.go b/pkg/boltzrpc/boltzrpc_grpc.pb.go similarity index 100% rename from boltzrpc/boltzrpc_grpc.pb.go rename to pkg/boltzrpc/boltzrpc_grpc.pb.go diff --git a/boltzrpc/client/autoswap.go b/pkg/boltzrpc/client/autoswap.go similarity index 98% rename from boltzrpc/client/autoswap.go rename to pkg/boltzrpc/client/autoswap.go index 8e118957..37661ebd 100644 --- a/boltzrpc/client/autoswap.go +++ b/pkg/boltzrpc/client/autoswap.go @@ -3,7 +3,7 @@ package client import ( "errors" "fmt" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc/autoswaprpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc/autoswaprpc" "github.com/golang/protobuf/ptypes/empty" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/known/fieldmaskpb" diff --git a/boltzrpc/client/client.go b/pkg/boltzrpc/client/client.go similarity index 99% rename from boltzrpc/client/client.go rename to pkg/boltzrpc/client/client.go index 059e369e..3053defe 100644 --- a/boltzrpc/client/client.go +++ b/pkg/boltzrpc/client/client.go @@ -1,7 +1,7 @@ package client import ( - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" "github.com/golang/protobuf/ptypes/empty" ) diff --git a/boltzrpc/client/connection.go b/pkg/boltzrpc/client/connection.go similarity index 100% rename from boltzrpc/client/connection.go rename to pkg/boltzrpc/client/connection.go diff --git a/boltzrpc/gen_protos.sh b/pkg/boltzrpc/gen_protos.sh similarity index 100% rename from boltzrpc/gen_protos.sh rename to pkg/boltzrpc/gen_protos.sh diff --git a/boltzrpc/grpc_docs.template b/pkg/boltzrpc/grpc_docs.template similarity index 100% rename from boltzrpc/grpc_docs.template rename to pkg/boltzrpc/grpc_docs.template diff --git a/boltzrpc/rest-annotations.yaml b/pkg/boltzrpc/rest-annotations.yaml similarity index 100% rename from boltzrpc/rest-annotations.yaml rename to pkg/boltzrpc/rest-annotations.yaml diff --git a/boltzrpc/serializers/utils.go b/pkg/boltzrpc/serializers/utils.go similarity index 88% rename from boltzrpc/serializers/utils.go rename to pkg/boltzrpc/serializers/utils.go index 5ac73df5..6459c5da 100644 --- a/boltzrpc/serializers/utils.go +++ b/pkg/boltzrpc/serializers/utils.go @@ -1,9 +1,9 @@ package serializers import ( - "github.com/BoltzExchange/boltz-client/v2/boltz" - "github.com/BoltzExchange/boltz-client/v2/boltzrpc" - "github.com/BoltzExchange/boltz-client/v2/onchain" + "github.com/BoltzExchange/boltz-client/v2/internal/onchain" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltz" + "github.com/BoltzExchange/boltz-client/v2/pkg/boltzrpc" ) func ParseCurrency(grpcCurrency *boltzrpc.Currency) boltz.Currency {