Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add endpoints for solana waitlist #2761

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/datastore/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (
}
dbs = map[string]*sqlx.DB{}
// CurrentMigrationVersion holds the default migration version
CurrentMigrationVersion = uint(69)
CurrentMigrationVersion = uint(70)
// MigrationTracks holds the migration version for a given track (eyeshade, promotion, wallet)
MigrationTracks = map[string]uint{
"eyeshade": 20,
Expand Down
1 change: 1 addition & 0 deletions migrations/0070_create_solana_waitlist.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP TABLE IF EXISTS solana_waitlist;
4 changes: 4 additions & 0 deletions migrations/0070_create_solana_waitlist.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CREATE TABLE solana_waitlist (
payment_id uuid PRIMARY KEY,
joined_at TIMESTAMP NOT NULL
)
1 change: 1 addition & 0 deletions services/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ require (
github.com/jmoiron/sqlx v1.3.5
github.com/lib/pq v1.10.9
github.com/linkedin/goavro v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.13.0
github.com/redis/go-redis/v9 v9.7.0
github.com/rs/zerolog v1.28.0
Expand Down
9 changes: 8 additions & 1 deletion services/grant/cmd/grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,14 @@ func setupRouter(ctx context.Context, logger *zerolog.Logger) (context.Context,
if len(dappAO) == 0 {
logger.Panic().Msg("dapp origin env missing")
}
r = wallet.RegisterRoutes(ctx, walletService, r, middleware.InstrumentHandler, wallet.NewDAppCorsMw(dappAO))

origins := strings.Split(os.Getenv("ALLOWED_ORIGINS"), ",")
dbg, _ := strconv.ParseBool(os.Getenv("DEBUG"))

corsOpts := wallet.NewCORSOpts(origins, dbg)
solMw := wallet.NewCORSMwr(corsOpts, http.MethodPost, http.MethodDelete)

r = wallet.RegisterRoutes(ctx, walletService, r, middleware.InstrumentHandler, wallet.NewDAppCorsMw(dappAO), solMw)

promotionDB, promotionRODB, err := promotion.NewPostgres()
if err != nil {
Expand Down
18 changes: 13 additions & 5 deletions services/wallet/cmd/rest_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ import (
// pprof imports
_ "net/http/pprof"
"os"
"strconv"
"strings"
"time"

"github.com/getsentry/sentry-go"
"github.com/go-chi/chi"
"github.com/spf13/cobra"
"github.com/spf13/viper"

cmdutils "github.com/brave-intl/bat-go/cmd"
appctx "github.com/brave-intl/bat-go/libs/context"
"github.com/brave-intl/bat-go/libs/middleware"
"github.com/brave-intl/bat-go/services/cmd"
"github.com/brave-intl/bat-go/services/wallet"
"github.com/getsentry/sentry-go"
"github.com/go-chi/chi"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

// WalletRestRun - Main entrypoint of the REST subcommand
Expand All @@ -35,7 +37,13 @@ func WalletRestRun(command *cobra.Command, args []string) {
logger.Panic().Msg("dapp origin env missing")
}

wallet.RegisterRoutes(ctx, service, router, middleware.InstrumentHandler, wallet.NewDAppCorsMw(dappAO))
origins := strings.Split(os.Getenv("ALLOWED_ORIGINS"), ",")
dbg, _ := strconv.ParseBool(os.Getenv("DEBUG"))

corsOpts := wallet.NewCORSOpts(origins, dbg)
solMw := wallet.NewCORSMwr(corsOpts, http.MethodPost, http.MethodDelete)

wallet.RegisterRoutes(ctx, service, router, middleware.InstrumentHandler, wallet.NewDAppCorsMw(dappAO), solMw)

// add profiling flag to enable profiling routes
if viper.GetString("pprof-enabled") != "" {
Expand Down
5 changes: 3 additions & 2 deletions services/wallet/controllers_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import (
"strings"

"github.com/asaskevich/govalidator"
"github.com/go-chi/chi"
uuid "github.com/satori/go.uuid"

"github.com/brave-intl/bat-go/libs/altcurrency"
appctx "github.com/brave-intl/bat-go/libs/context"
errorutils "github.com/brave-intl/bat-go/libs/errors"
Expand All @@ -23,8 +26,6 @@ import (
walletutils "github.com/brave-intl/bat-go/libs/wallet"
"github.com/brave-intl/bat-go/libs/wallet/provider/uphold"
"github.com/brave-intl/bat-go/services/wallet/model"
"github.com/go-chi/chi"
uuid "github.com/satori/go.uuid"
)

const (
Expand Down
Loading
Loading