diff --git a/actions/access_keys/access_keys_test.go b/actions/access_keys/access_keys_test.go index 763529b30..93957cd5b 100644 --- a/actions/access_keys/access_keys_test.go +++ b/actions/access_keys/access_keys_test.go @@ -3,7 +3,6 @@ package accesskeys import ( "testing" - "github.com/bitcoin-sv/spv-wallet/config" "github.com/bitcoin-sv/spv-wallet/server/handlers" "github.com/bitcoin-sv/spv-wallet/tests" "github.com/stretchr/testify/suite" @@ -27,7 +26,7 @@ func (ts *TestSuite) TearDownSuite() { // SetupTest runs before each test func (ts *TestSuite) SetupTest() { ts.BaseSetupTest() - handlersManager := handlers.NewManager(ts.Router, config.APIVersion) + handlersManager := handlers.NewManager(ts.Router, ts.AppConfig) RegisterRoutes(handlersManager) } diff --git a/actions/admin/admin_test.go b/actions/admin/admin_test.go index 229d27281..0f0d988db 100644 --- a/actions/admin/admin_test.go +++ b/actions/admin/admin_test.go @@ -3,7 +3,6 @@ package admin import ( "testing" - "github.com/bitcoin-sv/spv-wallet/config" "github.com/bitcoin-sv/spv-wallet/server/handlers" "github.com/bitcoin-sv/spv-wallet/tests" "github.com/stretchr/testify/suite" @@ -28,7 +27,7 @@ func (ts *TestSuite) TearDownSuite() { func (ts *TestSuite) SetupTest() { ts.BaseSetupTest() - handlersManager := handlers.NewManager(ts.Router, config.APIVersion) + handlersManager := handlers.NewManager(ts.Router, ts.AppConfig) RegisterRoutes(handlersManager) } diff --git a/actions/base/base_test.go b/actions/base/base_test.go index 86bfd5452..d13743807 100644 --- a/actions/base/base_test.go +++ b/actions/base/base_test.go @@ -3,7 +3,6 @@ package base import ( "testing" - "github.com/bitcoin-sv/spv-wallet/config" "github.com/bitcoin-sv/spv-wallet/server/handlers" "github.com/bitcoin-sv/spv-wallet/tests" "github.com/stretchr/testify/suite" @@ -28,7 +27,7 @@ func (ts *TestSuite) TearDownSuite() { func (ts *TestSuite) SetupTest() { ts.BaseSetupTest() - handlersManager := handlers.NewManager(ts.Router, config.APIVersion) + handlersManager := handlers.NewManager(ts.Router, ts.AppConfig) RegisterRoutes(handlersManager) } diff --git a/actions/contacts/contacts_test.go b/actions/contacts/contacts_test.go index 66b2ca42f..ce96ae18a 100644 --- a/actions/contacts/contacts_test.go +++ b/actions/contacts/contacts_test.go @@ -3,7 +3,6 @@ package contacts import ( "testing" - "github.com/bitcoin-sv/spv-wallet/config" "github.com/bitcoin-sv/spv-wallet/server/handlers" "github.com/bitcoin-sv/spv-wallet/tests" "github.com/stretchr/testify/suite" @@ -17,6 +16,7 @@ type TestSuite struct { // SetupSuite runs at the start of the suite func (ts *TestSuite) SetupSuite() { ts.BaseSetupSuite() + ts.AppConfig.ExperimentalFeatures.PikeContactsEnabled = true } // TearDownSuite runs after the suite finishes @@ -28,7 +28,7 @@ func (ts *TestSuite) TearDownSuite() { func (ts *TestSuite) SetupTest() { ts.BaseSetupTest() - handlersManager := handlers.NewManager(ts.Router, config.APIVersion) + handlersManager := handlers.NewManager(ts.Router, ts.AppConfig) RegisterRoutes(handlersManager) } diff --git a/actions/destinations/destination_test.go b/actions/destinations/destination_test.go index 52fa29377..7b84d520d 100644 --- a/actions/destinations/destination_test.go +++ b/actions/destinations/destination_test.go @@ -3,7 +3,6 @@ package destinations import ( "testing" - "github.com/bitcoin-sv/spv-wallet/config" "github.com/bitcoin-sv/spv-wallet/server/handlers" "github.com/bitcoin-sv/spv-wallet/tests" "github.com/stretchr/testify/suite" @@ -28,7 +27,7 @@ func (ts *TestSuite) TearDownSuite() { func (ts *TestSuite) SetupTest() { ts.BaseSetupTest() - handlersManager := handlers.NewManager(ts.Router, config.APIVersion) + handlersManager := handlers.NewManager(ts.Router, ts.AppConfig) RegisterRoutes(handlersManager) } diff --git a/actions/register.go b/actions/register.go index 331035248..0b15fb70b 100644 --- a/actions/register.go +++ b/actions/register.go @@ -12,12 +12,11 @@ import ( "github.com/bitcoin-sv/spv-wallet/actions/transactions" "github.com/bitcoin-sv/spv-wallet/actions/users" "github.com/bitcoin-sv/spv-wallet/actions/utxos" - "github.com/bitcoin-sv/spv-wallet/config" "github.com/bitcoin-sv/spv-wallet/server/handlers" ) // Register collects all the action's routes and registers them using the handlersManager -func Register(appConfig *config.AppConfig, handlersManager *handlers.Manager) { +func Register(handlersManager *handlers.Manager) { admin.RegisterRoutes(handlersManager) base.RegisterRoutes(handlersManager) accesskeys.RegisterRoutes(handlersManager) diff --git a/actions/transactions/outlines_endpoint_test.go b/actions/transactions/outlines_endpoint_test.go index 2b78de6c5..0916a642b 100644 --- a/actions/transactions/outlines_endpoint_test.go +++ b/actions/transactions/outlines_endpoint_test.go @@ -6,6 +6,7 @@ import ( "github.com/bitcoin-sv/spv-wallet/actions/testabilities" "github.com/bitcoin-sv/spv-wallet/actions/testabilities/apierror" + testengine "github.com/bitcoin-sv/spv-wallet/engine/testabilities" "github.com/bitcoin-sv/spv-wallet/engine/tester/fixtures" ) @@ -144,7 +145,7 @@ func TestPOSTTransactionOutlines(t *testing.T) { t.Run(name, func(t *testing.T) { // given: given, then := testabilities.New(t) - cleanup := given.StartedSPVWallet() + cleanup := given.StartedSPVWalletWithConfiguration(testengine.WithNewTransactionFlowEnabled()) defer cleanup() // and: @@ -164,7 +165,7 @@ func TestPOSTTransactionOutlines(t *testing.T) { t.Run("not allowed for anonymous", func(t *testing.T) { // given: given, then := testabilities.New(t) - cleanup := given.StartedSPVWallet() + cleanup := given.StartedSPVWalletWithConfiguration(testengine.WithNewTransactionFlowEnabled()) defer cleanup() // and: @@ -180,7 +181,7 @@ func TestPOSTTransactionOutlines(t *testing.T) { t.Run("not allowed for admin", func(t *testing.T) { // given: given, then := testabilities.New(t) - cleanup := given.StartedSPVWallet() + cleanup := given.StartedSPVWalletWithConfiguration(testengine.WithNewTransactionFlowEnabled()) defer cleanup() // and: @@ -196,7 +197,7 @@ func TestPOSTTransactionOutlines(t *testing.T) { t.Run("Bad Request: when user has no paymail address", func(t *testing.T) { // given: given, then := testabilities.New(t) - cleanup := given.StartedSPVWallet() + cleanup := given.StartedSPVWalletWithConfiguration(testengine.WithNewTransactionFlowEnabled()) defer cleanup() // and: @@ -223,7 +224,7 @@ func TestPOSTTransactionOutlines(t *testing.T) { t.Run("Bad Request: no body", func(t *testing.T) { // given: given, then := testabilities.New(t) - cleanup := given.StartedSPVWallet() + cleanup := given.StartedSPVWalletWithConfiguration(testengine.WithNewTransactionFlowEnabled()) defer cleanup() // and: @@ -433,7 +434,7 @@ func TestPOSTTransactionOutlines(t *testing.T) { t.Run(name, func(t *testing.T) { // given: given, then := testabilities.New(t) - cleanup := given.StartedSPVWallet() + cleanup := given.StartedSPVWalletWithConfiguration(testengine.WithNewTransactionFlowEnabled()) defer cleanup() // and: diff --git a/actions/transactions/outlines_record_test.go b/actions/transactions/outlines_record_test.go index a1ddaf0de..5eaa6916e 100644 --- a/actions/transactions/outlines_record_test.go +++ b/actions/transactions/outlines_record_test.go @@ -6,6 +6,7 @@ import ( "github.com/bitcoin-sv/spv-wallet/actions/testabilities" "github.com/bitcoin-sv/spv-wallet/actions/testabilities/apierror" chainmodels "github.com/bitcoin-sv/spv-wallet/engine/chain/models" + testengine "github.com/bitcoin-sv/spv-wallet/engine/testabilities" "github.com/bitcoin-sv/spv-wallet/engine/tester/fixtures" ) @@ -24,7 +25,7 @@ func TestOutlinesRecordOpReturn(t *testing.T) { t.Run("Record op_return data", func(t *testing.T) { // given: given, then := testabilities.New(t) - cleanup := given.StartedSPVWallet() + cleanup := given.StartedSPVWalletWithConfiguration(testengine.WithNewTransactionFlowEnabled()) defer cleanup() // and: @@ -122,7 +123,7 @@ func TestOutlinesRecordOpReturnErrorCases(t *testing.T) { t.Run(name, func(t *testing.T) { // given: given, then := testabilities.New(t) - cleanup := given.StartedSPVWallet() + cleanup := given.StartedSPVWalletWithConfiguration(testengine.WithNewTransactionFlowEnabled()) defer cleanup() // and: @@ -143,7 +144,7 @@ func TestOutlinesRecordOpReturnErrorCases(t *testing.T) { func TestOutlinesRecordOpReturnOnBroadcastError(t *testing.T) { // given: given, then := testabilities.New(t) - cleanup := given.StartedSPVWallet() + cleanup := given.StartedSPVWalletWithConfiguration(testengine.WithNewTransactionFlowEnabled()) defer cleanup() // and: diff --git a/actions/transactions/routes.go b/actions/transactions/routes.go index 667b24f95..6439827e4 100644 --- a/actions/transactions/routes.go +++ b/actions/transactions/routes.go @@ -25,9 +25,11 @@ func RegisterRoutes(handlersManager *handlers.Manager) { group.POST("/drafts", handlers.AsUser(newTransactionDraft)) group.POST("", handlers.AsUser(recordTransaction)) - v2 := handlersManager.Group(handlers.GroupAPIV2, "/transactions") - v2.POST("/outlines", handlers.AsUser(transactionOutlines)) - v2.POST("", handlers.AsUser(transactionRecordOutline)) - handlersManager.Get(handlers.GroupTransactionCallback).POST(config.BroadcastCallbackRoute, broadcastCallback) + + if handlersManager.GetFeatureFlags().NewTransactionFlowEnabled { + v2 := handlersManager.Group(handlers.GroupAPIV2, "/transactions") + v2.POST("/outlines", handlers.AsUser(transactionOutlines)) + v2.POST("", handlers.AsUser(transactionRecordOutline)) + } } diff --git a/actions/transactions/transaction_test.go b/actions/transactions/transaction_test.go index 4c8a2873a..e00093820 100644 --- a/actions/transactions/transaction_test.go +++ b/actions/transactions/transaction_test.go @@ -3,7 +3,6 @@ package transactions import ( "testing" - "github.com/bitcoin-sv/spv-wallet/config" "github.com/bitcoin-sv/spv-wallet/server/handlers" "github.com/bitcoin-sv/spv-wallet/tests" "github.com/stretchr/testify/suite" @@ -28,7 +27,7 @@ func (ts *TestSuite) TearDownSuite() { func (ts *TestSuite) SetupTest() { ts.BaseSetupTest() - handlersManager := handlers.NewManager(ts.Router, config.APIVersion) + handlersManager := handlers.NewManager(ts.Router, ts.AppConfig) RegisterRoutes(handlersManager) } diff --git a/actions/utxos/utxo_test.go b/actions/utxos/utxo_test.go index 2deb5171f..cd245c0ee 100644 --- a/actions/utxos/utxo_test.go +++ b/actions/utxos/utxo_test.go @@ -3,7 +3,6 @@ package utxos import ( "testing" - "github.com/bitcoin-sv/spv-wallet/config" "github.com/bitcoin-sv/spv-wallet/server/handlers" "github.com/bitcoin-sv/spv-wallet/tests" "github.com/stretchr/testify/suite" @@ -28,7 +27,7 @@ func (ts *TestSuite) TearDownSuite() { func (ts *TestSuite) SetupTest() { ts.BaseSetupTest() - handlersManager := handlers.NewManager(ts.Router, config.APIVersion) + handlersManager := handlers.NewManager(ts.Router, ts.AppConfig) RegisterRoutes(handlersManager) } diff --git a/config/config.go b/config/config.go index cd536248c..81535b8d2 100644 --- a/config/config.go +++ b/config/config.go @@ -243,6 +243,8 @@ type ExperimentalConfig struct { PikePaymentEnabled bool `json:"pike_payment_enabled" mapstructure:"pike_payment_enabled"` // Use junglebus external service to fetch missing source transactions for inputs UseJunglebus bool `json:"use_junglebus" mapstructure:"use_junglebus"` + // NewTransactionFlowEnabled is a flag for enabling the new transaction flow + NewTransactionFlowEnabled bool `json:"new_transaction_flow_enabled" mapstructure:"new_transaction_flow_enabled"` } // GetUserAgent will return the outgoing user agent diff --git a/config/config_to_options.go b/config/config_to_options.go index a1221edd6..66cf19450 100644 --- a/config/config_to_options.go +++ b/config/config_to_options.go @@ -242,6 +242,9 @@ func (c *AppConfig) addPaymailOpts(options []engine.ClientOps) []engine.ClientOp if c.ExperimentalFeatures.PikePaymentEnabled { options = append(options, engine.WithPaymailPikePaymentSupport()) } + if c.ExperimentalFeatures.NewTransactionFlowEnabled { + options = append(options, engine.WithPaymailExperimentalNewTransactionFlow()) + } return options } diff --git a/engine/client.go b/engine/client.go index e61be518d..f03111186 100644 --- a/engine/client.go +++ b/engine/client.go @@ -94,6 +94,7 @@ type ( *server.Configuration // Server configuration if Paymail is enabled options []server.ConfigOps // Options for the paymail server DefaultFromPaymail string // IE: from@domain.com + ExperimentalProvider bool } // taskManagerOptions holds the configuration for taskmanager @@ -175,11 +176,8 @@ func NewClient(ctx context.Context, opts ...ClientOps) (ClientInterface, error) return nil, err } - // Default paymail server config (generic capabilities and domain check disabled) - if client.options.paymail.serverConfig.Configuration == nil { - if err = client.loadDefaultPaymailConfig(); err != nil { - return nil, err - } + if err = client.loadPaymailServer(); err != nil { + return nil, err } if client.options.feeUnit == nil { diff --git a/engine/client_internal.go b/engine/client_internal.go index 8b5969c55..adca5546f 100644 --- a/engine/client_internal.go +++ b/engine/client_internal.go @@ -3,14 +3,14 @@ package engine import ( "context" - "github.com/bitcoin-sv/go-paymail" - "github.com/bitcoin-sv/go-paymail/server" + paymailclient "github.com/bitcoin-sv/go-paymail" + paymailserver "github.com/bitcoin-sv/go-paymail/server" "github.com/bitcoin-sv/spv-wallet/engine/chain" "github.com/bitcoin-sv/spv-wallet/engine/cluster" "github.com/bitcoin-sv/spv-wallet/engine/database/dao" "github.com/bitcoin-sv/spv-wallet/engine/datastore" "github.com/bitcoin-sv/spv-wallet/engine/notifications" - paymailclient "github.com/bitcoin-sv/spv-wallet/engine/paymail" + "github.com/bitcoin-sv/spv-wallet/engine/paymail" "github.com/bitcoin-sv/spv-wallet/engine/paymailaddress" "github.com/bitcoin-sv/spv-wallet/engine/spverrors" "github.com/bitcoin-sv/spv-wallet/engine/taskmanager" @@ -148,7 +148,7 @@ func (c *Client) loadPaymailComponents() (err error) { // Only load if it's not set (the client can be overloaded) if c.options.paymail.client == nil { - c.options.paymail.client, err = paymail.NewClient() + c.options.paymail.client, err = paymailclient.NewClient() if err != nil { return } @@ -157,7 +157,7 @@ func (c *Client) loadPaymailComponents() (err error) { if c.options.paymail.service == nil { logger := c.Logger().With().Str("subservice", "paymail").Logger() - c.options.paymail.service = paymailclient.NewServiceClient(c.Cachestore(), c.options.paymail.client, logger) + c.options.paymail.service = paymail.NewServiceClient(c.Cachestore(), c.options.paymail.client, logger) } return } @@ -251,8 +251,8 @@ func (c *Client) registerCronJobs() error { return spverrors.Wrapf(err, "failed to init cron jobs") } -// loadDefaultPaymailConfig will load the default paymail server configuration -func (c *Client) loadDefaultPaymailConfig() (err error) { +// loadPaymailServer will load the default paymail server configuration +func (c *Client) loadPaymailServer() (err error) { // Default FROM paymail if len(c.options.paymail.serverConfig.DefaultFromPaymail) == 0 { c.options.paymail.serverConfig.DefaultFromPaymail = defaultSenderPaymail @@ -261,22 +261,29 @@ func (c *Client) loadDefaultPaymailConfig() (err error) { // Set default options if none are found if len(c.options.paymail.serverConfig.options) == 0 { c.options.paymail.serverConfig.options = append(c.options.paymail.serverConfig.options, - server.WithP2PCapabilities(), - server.WithDomainValidationDisabled(), + paymailserver.WithP2PCapabilities(), + paymailserver.WithDomainValidationDisabled(), ) } paymailLogger := c.Logger().With().Str("subservice", "go-paymail").Logger() - c.options.paymail.serverConfig.options = append(c.options.paymail.serverConfig.options, server.WithLogger(&paymailLogger)) + c.options.paymail.serverConfig.options = append(c.options.paymail.serverConfig.options, paymailserver.WithLogger(&paymailLogger)) // Create the paymail configuration using the client and default service provider - paymailLocator := &server.PaymailServiceLocator{} - paymailService := &PaymailDefaultServiceProvider{client: c} - paymailLocator.RegisterPaymailService(paymailService) + paymailLocator := &paymailserver.PaymailServiceLocator{} + + var serviceProvider paymailserver.PaymailServiceProvider + if c.options.paymail.serverConfig.ExperimentalProvider { + serviceProvider = paymail.NewServiceProvider() + } else { + serviceProvider = &PaymailDefaultServiceProvider{client: c} + } + + paymailLocator.RegisterPaymailService(serviceProvider) paymailLocator.RegisterPikeContactService(&PikeContactServiceProvider{client: c}) paymailLocator.RegisterPikePaymentService(&PikePaymentServiceProvider{client: c}) - c.options.paymail.serverConfig.Configuration, err = server.NewConfig( + c.options.paymail.serverConfig.Configuration, err = paymailserver.NewConfig( paymailLocator, c.options.paymail.serverConfig.options..., ) diff --git a/engine/client_options.go b/engine/client_options.go index d2ed6874b..aaf4f687c 100644 --- a/engine/client_options.go +++ b/engine/client_options.go @@ -62,8 +62,7 @@ func defaultClientOptions() *clientOptions { paymail: &paymailOptions{ client: nil, serverConfig: &PaymailServerOptions{ - Configuration: nil, - options: []server.ConfigOps{}, + options: []server.ConfigOps{}, }, }, @@ -349,6 +348,13 @@ func WithPaymailPikePaymentSupport() ClientOps { } } +// WithPaymailExperimentalNewTransactionFlow switches to the new transaction flow (experimental) +func WithPaymailExperimentalNewTransactionFlow() ClientOps { + return func(c *clientOptions) { + c.paymail.serverConfig.ExperimentalProvider = true + } +} + // ----------------------------------------------------------------- // TASK MANAGER // ----------------------------------------------------------------- diff --git a/engine/paymail/paymail_service_provider.go b/engine/paymail/paymail_service_provider.go new file mode 100644 index 000000000..e0af6e240 --- /dev/null +++ b/engine/paymail/paymail_service_provider.go @@ -0,0 +1,42 @@ +package paymail + +import ( + "context" + + "github.com/bitcoin-sv/go-paymail" + "github.com/bitcoin-sv/go-paymail/server" + "github.com/bitcoin-sv/go-paymail/spv" +) + +// NewServiceProvider create a new paymail service server which handlers incoming paymail requests +func NewServiceProvider() server.PaymailServiceProvider { + return &serviceProvider{} +} + +type serviceProvider struct { +} + +func (s *serviceProvider) CreateAddressResolutionResponse(ctx context.Context, alias, domain string, senderValidation bool, metaData *server.RequestMetadata) (*paymail.ResolutionPayload, error) { + //TODO implement me + panic("implement me") +} + +func (s *serviceProvider) CreateP2PDestinationResponse(ctx context.Context, alias, domain string, satoshis uint64, metaData *server.RequestMetadata) (*paymail.PaymentDestinationPayload, error) { + //TODO implement me + panic("implement me") +} + +func (s *serviceProvider) GetPaymailByAlias(ctx context.Context, alias, domain string, metaData *server.RequestMetadata) (*paymail.AddressInformation, error) { + //TODO implement me + panic("implement me") +} + +func (s *serviceProvider) RecordTransaction(ctx context.Context, p2pTx *paymail.P2PTransaction, metaData *server.RequestMetadata) (*paymail.P2PTransactionPayload, error) { + //TODO implement me + panic("implement me") +} + +func (s *serviceProvider) VerifyMerkleRoots(ctx context.Context, merkleProofs []*spv.MerkleRootConfirmationRequestItem) error { + //TODO implement me + panic("implement me") +} diff --git a/engine/testabilities/fixture_configopts.go b/engine/testabilities/fixture_configopts.go new file mode 100644 index 000000000..e97b3e66d --- /dev/null +++ b/engine/testabilities/fixture_configopts.go @@ -0,0 +1,11 @@ +package testabilities + +import "github.com/bitcoin-sv/spv-wallet/config" + +type ConfigOpts func(*config.AppConfig) + +func WithNewTransactionFlowEnabled() ConfigOpts { + return func(c *config.AppConfig) { + c.ExperimentalFeatures.NewTransactionFlowEnabled = true + } +} diff --git a/engine/testabilities/fixture_engine.go b/engine/testabilities/fixture_engine.go index 46701fd1f..25b897cab 100644 --- a/engine/testabilities/fixture_engine.go +++ b/engine/testabilities/fixture_engine.go @@ -22,8 +22,6 @@ import ( const inMemoryDbConnectionString = "file:spv-wallet-test.db?mode=memory" const fileDbConnectionString = "file:spv-wallet-test.db" -type ConfigOpts func(*config.AppConfig) - type EngineFixture interface { Engine() (walletEngine EngineWithConfig, cleanup func()) EngineWithConfiguration(opts ...ConfigOpts) (walletEngine EngineWithConfig, cleanup func()) diff --git a/server/handlers/manager.go b/server/handlers/manager.go index 45a906c4e..be8a2d896 100644 --- a/server/handlers/manager.go +++ b/server/handlers/manager.go @@ -1,6 +1,7 @@ package handlers import ( + "github.com/bitcoin-sv/spv-wallet/config" "github.com/bitcoin-sv/spv-wallet/server/middleware" "github.com/gin-gonic/gin" ) @@ -27,21 +28,22 @@ const ( // Manager is a struct helps to group routes with proper middleware type Manager struct { - engine *gin.Engine - groups map[GroupType]*gin.RouterGroup + engine *gin.Engine + appConfig *config.AppConfig + groups map[GroupType]*gin.RouterGroup } // NewManager creates a new Grouper -func NewManager(engine *gin.Engine, apiVersion string) *Manager { - prefix := "/" + apiVersion +func NewManager(engine *gin.Engine, appConfig *config.AppConfig) *Manager { authRouter := engine.Group("", middleware.AuthMiddleware(), middleware.CheckSignatureMiddleware()) return &Manager{ - engine: engine, + engine: engine, + appConfig: appConfig, groups: map[GroupType]*gin.RouterGroup{ GroupRoot: engine.Group(""), - GroupOldAPI: authRouter.Group(prefix), - GroupAPI: authRouter.Group("/api" + prefix), + GroupOldAPI: authRouter.Group("/" + config.APIVersion), + GroupAPI: authRouter.Group("/api" + "/" + config.APIVersion), GroupAPIV2: authRouter.Group("/api/v2"), GroupTransactionCallback: engine.Group("", middleware.CallbackTokenMiddleware()), }, @@ -57,3 +59,8 @@ func (mg *Manager) Group(endpointType GroupType, relativePath string, middleware func (mg *Manager) Get(endpointType GroupType) *gin.RouterGroup { return mg.groups[endpointType] } + +// GetFeatureFlags returns the experimental feature flags from app configuration +func (mg *Manager) GetFeatureFlags() *config.ExperimentalConfig { + return mg.appConfig.ExperimentalFeatures +} diff --git a/server/server.go b/server/server.go index b295ec685..6a7a2910f 100644 --- a/server/server.go +++ b/server/server.go @@ -105,8 +105,8 @@ func (s *Server) Handlers() *gin.Engine { } func setupServerRoutes(appConfig *config.AppConfig, spvWalletEngine engine.ClientInterface, ginEngine *gin.Engine) { - handlersManager := handlers.NewManager(ginEngine, config.APIVersion) - actions.Register(appConfig, handlersManager) + handlersManager := handlers.NewManager(ginEngine, appConfig) + actions.Register(handlersManager) spvWalletEngine.GetPaymailConfig().RegisterRoutes(ginEngine)