Skip to content

Commit

Permalink
Merge pull request #58 from bitcoin-sv/rename-bux-to-spv-wallet
Browse files Browse the repository at this point in the history
feat(BUX-594): migrate bux-wallet-backend name
  • Loading branch information
dorzepowski authored Feb 16, 2024
2 parents fa60394 + 5ad7777 commit 33d4eea
Show file tree
Hide file tree
Showing 55 changed files with 609 additions and 609 deletions.
6 changes: 3 additions & 3 deletions .github/CODE_STANDARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@ Additional information and guidelines on Conventional Commits can be found [here

Good example:

```bash
feat: add possibility to create a new user by admin (#BUX-123)
```
feat(#123): add possibility to create a new user by admin
```

Bad example:

```bash
```
debugo feature - checkpoint full work
```

Expand Down
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

# Pull Request Checklist

- [ ] 📖 I created my PR using provided : [CODE_STANDARDS](https://github.com/bitcoin-sv/bux-wallet-backend/blob/main/.github/CODE_STANDARDS.md)
- [ ] 📖 I have read the short Code of Conduct: [CODE_OF_CONDUCT](https://github.com/bitcoin-sv/bux-wallet-backend/blob/main/.github/CODE_OF_CONDUCT.md)
- [ ] 📖 I created my PR using provided : [CODE_STANDARDS](https://github.com/bitcoin-sv/spv-wallet-web-backend/blob/main/.github/CODE_STANDARDS.md)
- [ ] 📖 I have read the short Code of Conduct: [CODE_OF_CONDUCT](https://github.com/bitcoin-sv/spv-wallet-web-backend/blob/main/.github/CODE_OF_CONDUCT.md)
- [ ] 🏠 I tested my changes locally.
- [ ] ✅ I have provided tests for my changes.
- [ ] 📝 I have used conventional commits.
Expand Down
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Bux wallet
# SPV WALLET WEB BACKEND

_Go application used as backend side for bsv wallet using BUX_
_Go application used as a web backend with storage for custodial wallet's xpriv keys, utilizing a non-custodial spv-wallet service._

-------------------------------------------------------------------------
---

The `bux-wallet-backend` is an HTTP server that serves as the referential backend server for a custodial web wallet for Bitcoin SV (BSV). It integrates and utilizes the `bux-server` component to handle various BSV-related operations, including the creation of transactions and listing incoming and outgoing transactions.
The `spv-wallet-web-backend` is an HTTP server that serves as the referential backend server for a custodial web wallet for Bitcoin SV (BSV). It integrates and utilizes the `spv-wallet` component to handle various BSV-related operations, including the creation of transactions and listing incoming and outgoing transactions.

## How to use it

### Endpoints documentation

For endpoints documentation you can visit swagger which is exposed on port 8080 by default.

```
http://localhost:8080/swagger/index.html
```
Expand All @@ -19,58 +21,67 @@ http://localhost:8080/swagger/index.html
To easy development process we use https://taskfile.dev/

### Installation of taskfile

Task offers many installation methods. Check out the available methods on [the installation documentation page](https://taskfile.dev/installation/).

### Tasks

#### List

To see the list of available tasks just call

```bash
task
```

#### Installing and set up tools

To install missing tools that are need just call

```bash
task install
```

##### Git hooks

Also consider installing git hooks with the command:

```bash
task git-hooks:install
```

So it will ensure that tests are passing and linter is not complaining before git push.

#### Start application

To start application locally with performed all the code checks first use the command

```bash
task start
```

if you just want to run app without all the checks
if you just want to run app without all the checks

```bash
task run
```

#### Run checks & tests

To verify the code overall run verification task

```bash
task verify
```

If you just want a static check of a code run

```bash
task verify:check
```

If you want to run tests then run

```bash
task test
```
Expand Down
23 changes: 12 additions & 11 deletions cmd/main.go
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
package main

import (
"bux-wallet/config"
"bux-wallet/config/databases"
db_users "bux-wallet/data/users"
"bux-wallet/domain"
"bux-wallet/logging"
"bux-wallet/transports/http/endpoints"
httpserver "bux-wallet/transports/http/server"
"bux-wallet/transports/websocket"
"errors"
"net/http"
"os"
"os/signal"
"syscall"

"github.com/bitcoin-sv/spv-wallet-web-backend/config"
"github.com/bitcoin-sv/spv-wallet-web-backend/config/databases"
db_users "github.com/bitcoin-sv/spv-wallet-web-backend/data/users"
"github.com/bitcoin-sv/spv-wallet-web-backend/domain"
"github.com/bitcoin-sv/spv-wallet-web-backend/logging"
"github.com/bitcoin-sv/spv-wallet-web-backend/transports/http/endpoints"
httpserver "github.com/bitcoin-sv/spv-wallet-web-backend/transports/http/server"
"github.com/bitcoin-sv/spv-wallet-web-backend/transports/websocket"

"github.com/spf13/viper"
)

const appname = "bux-wallet-backend"
const appname = "spv-wallet-web-backend"

// nolint: godot
// @title Bux Wallet API
// @title SPV Wallet WEB Backend
// @version 1.0
// @description This is an API for bux wallet.
// @description This is an API for the spv-wallet-web-frontend.
func main() {
defaultLogger := logging.GetDefaultLogger()

Expand Down
30 changes: 15 additions & 15 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package config

// Define basic db config.
// Define basic db config keys.
const (
// EnvDbHost define the database host.
EnvDbHost = "db.host"
Expand All @@ -18,7 +18,7 @@ const (
EnvDbMigrationsPath = "db.migrationsPath"
)

// Define basic http server config.
// Define basic http server config keys.
const (
// EnvHttpServerReadTimeout http server read timeout.
EnvHttpServerReadTimeout = "http.server.readTimeout"
Expand All @@ -34,20 +34,20 @@ const (
EnvHttpServerCorsAllowedDomains = "http.server.cors.allowedDomains"
)

// Define basic bux config.
// Define basic spv-wallet config keys.
const (
// EnvBuxAdminXpriv define the bux admin xpriv.
EnvBuxAdminXpriv = "bux.admin.xpriv"
// EnvBuxServerUrl define the bux server url.
EnvBuxServerUrl = "bux.server.url"
// EnvBuxWithDebug define whether to turn debugging on.
EnvBuxWithDebug = "bux.withDebug"
// EnvBuxSignRequest define whether to sign all requests.
EnvBuxSignRequest = "bux.sign.request"
// EnvBuxPaymailDomain define the bux paymail domain.
EnvBuxPaymailDomain = "bux.paymail.domain"
// EnvBuxPaymailAvatar define the bux paymail avatar url.
EnvBuxPaymailAvatar = "bux.paymail.avatar"
// EnvAdminXpriv define the admin xpriv.
EnvAdminXpriv = "spvwallet.admin.xpriv"
// EnvServerUrl define the url of the spv-wallet (non-custodial wallet) service.
EnvServerUrl = "spvwallet.server.url"
// EnvWithDebug define whether to turn debugging on.
EnvWithDebug = "spvwallet.withDebug"
// EnvSignRequest define whether to sign all requests.
EnvSignRequest = "spvwallet.sign.request"
// EnvPaymailDomain define the paymail domain.
EnvPaymailDomain = "spvwallet.paymail.domain"
// EnvPaymailAvatar define the paymail avatar url.
EnvPaymailAvatar = "spvwallet.paymail.avatar"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion config/databases/databases.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package databases

import (
"bux-wallet/config"
"github.com/bitcoin-sv/spv-wallet-web-backend/config"

"github.com/rs/zerolog"

"database/sql"
Expand Down
20 changes: 10 additions & 10 deletions config/viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func NewViperConfig(appname string) *Config {
viper.AutomaticEnv()
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
setHttpServerDefaults()
setBuxDefaults()
setSpvWalletDefaults()
setHashDefaults()
setLoggingDefaults()
setEndpointsDefaults()
Expand Down Expand Up @@ -51,14 +51,14 @@ func setHttpServerDefaults() {
viper.SetDefault(EnvHttpServerCorsAllowedDomains, []string{})
}

// setBuxDefaults sets default values for bux connection.
func setBuxDefaults() {
viper.SetDefault(EnvBuxAdminXpriv, "xprv9s21ZrQH143K3CbJXirfrtpLvhT3Vgusdo8coBritQ3rcS7Jy7sxWhatuxG5h2y1Cqj8FKmPp69536gmjYRpfga2MJdsGyBsnB12E19CESK")
viper.SetDefault(EnvBuxServerUrl, "http://localhost:3003/v1")
viper.SetDefault(EnvBuxWithDebug, true)
viper.SetDefault(EnvBuxSignRequest, true)
viper.SetDefault(EnvBuxPaymailDomain, "bux.com")
viper.SetDefault(EnvBuxPaymailAvatar, "http://localhost:3003/static/paymail/avatar.jpg")
// setSpvWalletDefaults sets default values for spv-wallet connection.
func setSpvWalletDefaults() {
viper.SetDefault(EnvAdminXpriv, "xprv9s21ZrQH143K3CbJXirfrtpLvhT3Vgusdo8coBritQ3rcS7Jy7sxWhatuxG5h2y1Cqj8FKmPp69536gmjYRpfga2MJdsGyBsnB12E19CESK")
viper.SetDefault(EnvServerUrl, "http://localhost:3003/v1")
viper.SetDefault(EnvWithDebug, true)
viper.SetDefault(EnvSignRequest, true)
viper.SetDefault(EnvPaymailDomain, "example.com")
viper.SetDefault(EnvPaymailAvatar, "http://localhost:3003/static/paymail/avatar.jpg")
}

// setHashDefaults sets default values for hash.
Expand All @@ -68,7 +68,7 @@ func setHashDefaults() {

func setLoggingDefaults() {
viper.SetDefault(EnvLoggingLevel, "Debug")
viper.SetDefault(EnvLoggingInstanceName, "bux-wallet-backend")
viper.SetDefault(EnvLoggingInstanceName, "spv-wallet-web-backend")
viper.SetDefault(EnvLoggingFormat, "console")
viper.SetDefault(EnvLoggingLogOrigin, false)
}
Expand Down
3 changes: 2 additions & 1 deletion data/users/users_dto.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package users

import (
"bux-wallet/domain/users"
"time"

"github.com/bitcoin-sv/spv-wallet-web-backend/domain/users"
)

// UserDto is a struct that represent user database record.
Expand Down
3 changes: 2 additions & 1 deletion data/users/users_postgres_repository.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package users

import (
"bux-wallet/domain/users"
"context"
"database/sql"

"github.com/bitcoin-sv/spv-wallet-web-backend/domain/users"
)

const (
Expand Down
17 changes: 8 additions & 9 deletions docs/docs.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Code generated by swaggo/swag. DO NOT EDIT.

// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs

import "github.com/swaggo/swag"
Expand Down Expand Up @@ -83,7 +82,7 @@ const docTemplate = `{
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/buxclient.Transaction"
"$ref": "#/definitions/spvwallet.Transaction"
}
}
}
Expand Down Expand Up @@ -112,7 +111,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/buxclient.FullTransaction"
"$ref": "#/definitions/spvwallet.FullTransaction"
}
}
}
Expand Down Expand Up @@ -140,7 +139,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/buxclient.FullTransaction"
"$ref": "#/definitions/spvwallet.FullTransaction"
}
}
}
Expand Down Expand Up @@ -245,7 +244,7 @@ const docTemplate = `{
}
}
},
"buxclient.FullTransaction": {
"spvwallet.FullTransaction": {
"type": "object",
"properties": {
"blockHash": {
Expand Down Expand Up @@ -286,7 +285,7 @@ const docTemplate = `{
}
}
},
"buxclient.Transaction": {
"spvwallet.Transaction": {
"type": "object",
"properties": {
"createdAt": {
Expand Down Expand Up @@ -394,8 +393,8 @@ var SwaggerInfo = &swag.Spec{
Host: "",
BasePath: "",
Schemes: []string{},
Title: "Bux Wallet API",
Description: "This is an API for bux wallet.",
Title: "SPV Wallet WEB Backend",
Description: "This is an API for the spv-wallet-web-frontend.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
Expand Down
5 changes: 0 additions & 5 deletions docs/http/http-client.env.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/http/status.http

This file was deleted.

Loading

0 comments on commit 33d4eea

Please sign in to comment.