Skip to content

Commit

Permalink
Merge pull request #143 from flow-hydraulics/latenssi/rename-and-refa…
Browse files Browse the repository at this point in the history
…ctor

Rename module, refactor main.go and tokentype passing
  • Loading branch information
latenssi authored Aug 17, 2021
2 parents 4fc9af2 + f5185ba commit ff872c0
Show file tree
Hide file tree
Showing 46 changed files with 173 additions and 213 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/eqlabs/flow-wallet-api
ghcr.io/flow-hydraulics/flow-wallet-api
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
Expand Down
39 changes: 10 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,23 @@

current_dir = $(shell pwd)

cli_version = 0.25.1
cli_image=flow-cli

.PHONY: run
up:
FLOW_CLI_VERSION=${cli_version} docker-compose up -d
.PHONY: dev
dev:
docker-compose up -d db emulator
docker-compose logs -f

.PHONY: stop
stop:
FLOW_CLI_VERSION=${cli_version} docker-compose stop
docker-compose stop

.PHONY: down
down:
FLOW_CLI_VERSION=${cli_version} docker-compose down
docker-compose down

.PHONY: reset
reset: down dev

.PHONY: test
test:
go test ./...

.PHONY: build-cli
build-cli:
docker build \
--network host \
--build-arg VERSION=${cli_version} \
-t ${cli_image}:${cli_version} \
./docker/flow-cli

.PHONY: deploy
deploy:
docker run --rm -it -v "${current_dir}:/app" --net host ${cli_image}:${cli_version} project deploy --update

.PHONY: shell
shell:
docker exec -it flow-emulator ash

.PHONY: reset
reset:
FLOW_CLI_VERSION=${cli_version} docker-compose down
FLOW_CLI_VERSION=${cli_version} docker-compose up -d
flow project deploy --update
10 changes: 5 additions & 5 deletions accounts/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"fmt"
"time"

"github.com/eqlabs/flow-wallet-api/flow_helpers"
"github.com/eqlabs/flow-wallet-api/keys"
"github.com/eqlabs/flow-wallet-api/templates"
"github.com/eqlabs/flow-wallet-api/templates/template_strings"
"github.com/eqlabs/flow-wallet-api/transactions"
"github.com/flow-hydraulics/flow-wallet-api/flow_helpers"
"github.com/flow-hydraulics/flow-wallet-api/keys"
"github.com/flow-hydraulics/flow-wallet-api/templates"
"github.com/flow-hydraulics/flow-wallet-api/templates/template_strings"
"github.com/flow-hydraulics/flow-wallet-api/transactions"
"github.com/onflow/cadence"
"github.com/onflow/flow-go-sdk"
"github.com/onflow/flow-go-sdk/client"
Expand Down
16 changes: 8 additions & 8 deletions accounts/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"net/http"
"strings"

"github.com/eqlabs/flow-wallet-api/datastore"
"github.com/eqlabs/flow-wallet-api/errors"
"github.com/eqlabs/flow-wallet-api/flow_helpers"
"github.com/eqlabs/flow-wallet-api/jobs"
"github.com/eqlabs/flow-wallet-api/keys"
"github.com/eqlabs/flow-wallet-api/templates"
"github.com/eqlabs/flow-wallet-api/templates/template_strings"
"github.com/eqlabs/flow-wallet-api/transactions"
"github.com/flow-hydraulics/flow-wallet-api/datastore"
"github.com/flow-hydraulics/flow-wallet-api/errors"
"github.com/flow-hydraulics/flow-wallet-api/flow_helpers"
"github.com/flow-hydraulics/flow-wallet-api/jobs"
"github.com/flow-hydraulics/flow-wallet-api/keys"
"github.com/flow-hydraulics/flow-wallet-api/templates"
"github.com/flow-hydraulics/flow-wallet-api/templates/template_strings"
"github.com/flow-hydraulics/flow-wallet-api/transactions"
"github.com/onflow/cadence"
"github.com/onflow/flow-go-sdk"
"github.com/onflow/flow-go-sdk/client"
Expand Down
2 changes: 1 addition & 1 deletion accounts/store.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package accounts

import (
"github.com/eqlabs/flow-wallet-api/datastore"
"github.com/flow-hydraulics/flow-wallet-api/datastore"
)

// Store manages data regarding accounts.
Expand Down
2 changes: 1 addition & 1 deletion accounts/store_gorm.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package accounts

import (
"github.com/eqlabs/flow-wallet-api/datastore"
"github.com/flow-hydraulics/flow-wallet-api/datastore"
"gorm.io/gorm"
)

Expand Down
2 changes: 1 addition & 1 deletion api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ components:
Content-Type: application/json
Connection: close
ver: https://github.com/eqlabs/flow-wallet-api/commit/
ver: https://github.com/flow-hydraulics/flow-wallet-api/commit/
built on:
api version called: v1
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ version: "3.9"
services:
db:
image: postgres:13-alpine
ports:
- "5432:5432"
environment:
- POSTGRES_DB=wallet
- POSTGRES_USER=wallet
Expand All @@ -11,11 +13,12 @@ services:
build:
context: .
dockerfile: ./docker/wallet/Dockerfile
network: host # docker build sometimes has problems fetching from alpine's CDN
ports:
- "3000:3000"
env_file:
- ./.env
restart: unless-stopped
restart: unless-stopped
environment:
DATABASE_DSN: postgresql://wallet:wallet@db:5432/wallet
DATABASE_TYPE: psql
Expand Down
15 changes: 0 additions & 15 deletions docker/flow-cli/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion flow_helpers/flow_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"time"

"github.com/eqlabs/flow-wallet-api/errors"
"github.com/flow-hydraulics/flow-wallet-api/errors"
"github.com/onflow/flow-go-sdk"
"github.com/onflow/flow-go-sdk/client"
)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/eqlabs/flow-wallet-api
module github.com/flow-hydraulics/flow-wallet-api

go 1.16

Expand Down
2 changes: 1 addition & 1 deletion handlers/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"net/http"

"github.com/eqlabs/flow-wallet-api/accounts"
"github.com/flow-hydraulics/flow-wallet-api/accounts"
)

// Accounts is a HTTP server for account management.
Expand Down
2 changes: 1 addition & 1 deletion handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/http"
"strings"

"github.com/eqlabs/flow-wallet-api/errors"
"github.com/flow-hydraulics/flow-wallet-api/errors"
)

const SyncHeader = "Use-Sync"
Expand Down
2 changes: 1 addition & 1 deletion handlers/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"net/http"

"github.com/eqlabs/flow-wallet-api/jobs"
"github.com/flow-hydraulics/flow-wallet-api/jobs"
)

// Jobs is a HTTP server for jobs.
Expand Down
4 changes: 2 additions & 2 deletions handlers/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"net/http"

"github.com/eqlabs/flow-wallet-api/templates"
"github.com/flow-hydraulics/flow-wallet-api/templates"
)

// Templates is a HTTP server for template management.
Expand All @@ -22,7 +22,7 @@ func (s *Templates) AddToken() http.Handler {
return UseJson(h)
}

func (s *Templates) ListTokens(tType *templates.TokenType) http.Handler {
func (s *Templates) ListTokens(tType templates.TokenType) http.Handler {
return s.MakeListTokensFunc(tType)
}

Expand Down
4 changes: 2 additions & 2 deletions handlers/templates_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"strconv"

"github.com/eqlabs/flow-wallet-api/templates"
"github.com/flow-hydraulics/flow-wallet-api/templates"
"github.com/gorilla/mux"
)

Expand Down Expand Up @@ -36,7 +36,7 @@ func (s *Templates) AddTokenFunc(rw http.ResponseWriter, r *http.Request) {
handleJsonResponse(rw, http.StatusCreated, newToken)
}

func (s *Templates) MakeListTokensFunc(tType *templates.TokenType) http.HandlerFunc {
func (s *Templates) MakeListTokensFunc(tType templates.TokenType) http.HandlerFunc {
return func(rw http.ResponseWriter, r *http.Request) {
tokens, err := s.service.ListTokens(tType)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions handlers/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"log"
"net/http"

"github.com/eqlabs/flow-wallet-api/templates"
"github.com/eqlabs/flow-wallet-api/tokens"
"github.com/flow-hydraulics/flow-wallet-api/templates"
"github.com/flow-hydraulics/flow-wallet-api/tokens"
)

type Tokens struct {
Expand Down
8 changes: 4 additions & 4 deletions handlers/tokens_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"fmt"
"net/http"

"github.com/eqlabs/flow-wallet-api/errors"
"github.com/eqlabs/flow-wallet-api/templates"
"github.com/eqlabs/flow-wallet-api/tokens"
"github.com/flow-hydraulics/flow-wallet-api/errors"
"github.com/flow-hydraulics/flow-wallet-api/templates"
"github.com/flow-hydraulics/flow-wallet-api/tokens"
"github.com/gorilla/mux"
)

Expand Down Expand Up @@ -39,7 +39,7 @@ func (s *Tokens) MakeAccountTokensFunc(tType templates.TokenType) http.HandlerFu
vars := mux.Vars(r)
a := vars["address"]

res, err := s.service.AccountTokens(a, &tType)
res, err := s.service.AccountTokens(a, tType)
if err != nil {
handleError(rw, s.log, err)
return
Expand Down
2 changes: 1 addition & 1 deletion handlers/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"net/http"

"github.com/eqlabs/flow-wallet-api/transactions"
"github.com/flow-hydraulics/flow-wallet-api/transactions"
)

type Transactions struct {
Expand Down
6 changes: 3 additions & 3 deletions handlers/transactions_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"net/http"
"strconv"

"github.com/eqlabs/flow-wallet-api/errors"
"github.com/eqlabs/flow-wallet-api/templates"
"github.com/eqlabs/flow-wallet-api/transactions"
"github.com/flow-hydraulics/flow-wallet-api/errors"
"github.com/flow-hydraulics/flow-wallet-api/templates"
"github.com/flow-hydraulics/flow-wallet-api/transactions"
"github.com/gorilla/mux"
)

Expand Down
2 changes: 1 addition & 1 deletion jobs/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sync"
"time"

"github.com/eqlabs/flow-wallet-api/errors"
"github.com/flow-hydraulics/flow-wallet-api/errors"
"github.com/google/uuid"
"gorm.io/gorm"
)
Expand Down
4 changes: 2 additions & 2 deletions jobs/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"net/http"

"github.com/eqlabs/flow-wallet-api/datastore"
"github.com/eqlabs/flow-wallet-api/errors"
"github.com/flow-hydraulics/flow-wallet-api/datastore"
"github.com/flow-hydraulics/flow-wallet-api/errors"
"github.com/google/uuid"
)

Expand Down
2 changes: 1 addition & 1 deletion jobs/store.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package jobs

import (
"github.com/eqlabs/flow-wallet-api/datastore"
"github.com/flow-hydraulics/flow-wallet-api/datastore"
"github.com/google/uuid"
)

Expand Down
2 changes: 1 addition & 1 deletion jobs/store_gorm.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package jobs

import (
"github.com/eqlabs/flow-wallet-api/datastore"
"github.com/flow-hydraulics/flow-wallet-api/datastore"
"github.com/google/uuid"
"gorm.io/gorm"
)
Expand Down
10 changes: 5 additions & 5 deletions keys/basic/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"context"
"fmt"

"github.com/eqlabs/flow-wallet-api/flow_helpers"
"github.com/eqlabs/flow-wallet-api/keys"
"github.com/eqlabs/flow-wallet-api/keys/encryption"
"github.com/eqlabs/flow-wallet-api/keys/google"
"github.com/eqlabs/flow-wallet-api/keys/local"
"github.com/flow-hydraulics/flow-wallet-api/flow_helpers"
"github.com/flow-hydraulics/flow-wallet-api/keys"
"github.com/flow-hydraulics/flow-wallet-api/keys/encryption"
"github.com/flow-hydraulics/flow-wallet-api/keys/google"
"github.com/flow-hydraulics/flow-wallet-api/keys/local"
"github.com/onflow/flow-go-sdk"
"github.com/onflow/flow-go-sdk/client"
"github.com/onflow/flow-go-sdk/crypto"
Expand Down
2 changes: 1 addition & 1 deletion keys/google/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"

"github.com/caarlos0/env/v6"
"github.com/eqlabs/flow-wallet-api/keys"
"github.com/flow-hydraulics/flow-wallet-api/keys"
"github.com/google/uuid"
"github.com/onflow/flow-go-sdk"
"github.com/onflow/flow-go-sdk/crypto"
Expand Down
2 changes: 1 addition & 1 deletion keys/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"crypto/rand"
"strings"

"github.com/eqlabs/flow-wallet-api/keys"
"github.com/flow-hydraulics/flow-wallet-api/keys"
"github.com/onflow/flow-go-sdk"
"github.com/onflow/flow-go-sdk/crypto"
)
Expand Down
Loading

0 comments on commit ff872c0

Please sign in to comment.