@@ -2,10 +2,11 @@ package auth | |||||
import ( | import ( | ||||
"fmt" | "fmt" | ||||
"github.com/golang-jwt/jwt/v4" | |||||
"github.com/spf13/viper" | |||||
"net/http" | "net/http" | ||||
"strings" | "strings" | ||||
"github.com/golang-jwt/jwt/v4" | |||||
"github.com/spf13/viper" | |||||
) | ) | ||||
type Claims struct { | type Claims struct { | ||||
@@ -3,14 +3,15 @@ package endpoints | |||||
import ( | import ( | ||||
"encoding/json" | "encoding/json" | ||||
"fmt" | "fmt" | ||||
"net/http" | |||||
"strings" | |||||
. "github.com/imosed/signet/data" | . "github.com/imosed/signet/data" | ||||
"github.com/stellar/go/clients/horizonclient" | "github.com/stellar/go/clients/horizonclient" | ||||
"github.com/stellar/go/keypair" | "github.com/stellar/go/keypair" | ||||
"github.com/stellar/go/network" | "github.com/stellar/go/network" | ||||
"github.com/stellar/go/protocols/horizon" | "github.com/stellar/go/protocols/horizon" | ||||
"github.com/stellar/go/txnbuild" | "github.com/stellar/go/txnbuild" | ||||
"net/http" | |||||
"strings" | |||||
) | ) | ||||
type ContributeRequest struct { | type ContributeRequest struct { | ||||
@@ -2,9 +2,10 @@ package endpoints | |||||
import ( | import ( | ||||
"encoding/json" | "encoding/json" | ||||
"net/http" | |||||
"github.com/imosed/signet/auth" | "github.com/imosed/signet/auth" | ||||
. "github.com/imosed/signet/data" | . "github.com/imosed/signet/data" | ||||
"net/http" | |||||
) | ) | ||||
type EscalatePrivilegesRequest struct { | type EscalatePrivilegesRequest struct { | ||||
@@ -2,11 +2,12 @@ package endpoints | |||||
import ( | import ( | ||||
"encoding/json" | "encoding/json" | ||||
"net/http" | |||||
"strconv" | |||||
"github.com/stellar/go/clients/horizonclient" | "github.com/stellar/go/clients/horizonclient" | ||||
"github.com/stellar/go/keypair" | "github.com/stellar/go/keypair" | ||||
"github.com/stellar/go/protocols/horizon" | "github.com/stellar/go/protocols/horizon" | ||||
"net/http" | |||||
"strconv" | |||||
) | ) | ||||
type GetBalanceRequest struct { | type GetBalanceRequest struct { | ||||
@@ -2,15 +2,16 @@ package endpoints | |||||
import ( | import ( | ||||
"encoding/json" | "encoding/json" | ||||
. "github.com/imosed/signet/data" | |||||
"net/http" | "net/http" | ||||
. "github.com/imosed/signet/data" | |||||
) | ) | ||||
type GetQueuesResponse struct { | type GetQueuesResponse struct { | ||||
Queues []Queue `json:"queues"` | Queues []Queue `json:"queues"` | ||||
} | } | ||||
func GetQueues(w http.ResponseWriter, r *http.Request) { | |||||
func GetQueues(w http.ResponseWriter, _ *http.Request) { | |||||
var resp GetQueuesResponse | var resp GetQueuesResponse | ||||
Db.Table("queues").Scan(&resp.Queues) | Db.Table("queues").Scan(&resp.Queues) | ||||
@@ -7,12 +7,13 @@ import ( | |||||
"encoding/json" | "encoding/json" | ||||
"errors" | "errors" | ||||
"fmt" | "fmt" | ||||
"net/http" | |||||
"strings" | |||||
"github.com/imosed/signet/auth" | "github.com/imosed/signet/auth" | ||||
. "github.com/imosed/signet/data" | . "github.com/imosed/signet/data" | ||||
"github.com/spf13/viper" | "github.com/spf13/viper" | ||||
"golang.org/x/crypto/argon2" | "golang.org/x/crypto/argon2" | ||||
"net/http" | |||||
"strings" | |||||
) | ) | ||||
const ( | const ( | ||||
@@ -2,11 +2,12 @@ package endpoints | |||||
import ( | import ( | ||||
"encoding/json" | "encoding/json" | ||||
. "github.com/imosed/signet/data" | |||||
"net/http" | "net/http" | ||||
. "github.com/imosed/signet/data" | |||||
) | ) | ||||
func UsersExist(w http.ResponseWriter, r *http.Request) { | |||||
func UsersExist(w http.ResponseWriter, _ *http.Request) { | |||||
var numUsers int64 | var numUsers int64 | ||||
Db.Table("users").Count(&numUsers) | Db.Table("users").Count(&numUsers) | ||||
@@ -1,11 +0,0 @@ | |||||
package main | |||||
import "github.com/imosed/signet/data" | |||||
func SumContributions(contributions []data.Contribution) (sum float64) { | |||||
total := 0.0 | |||||
for _, contribution := range contributions { | |||||
total += contribution.Amount | |||||
} | |||||
return total | |||||
} |
@@ -2,11 +2,12 @@ package main | |||||
import ( | import ( | ||||
"fmt" | "fmt" | ||||
"net/http" | |||||
"github.com/gorilla/mux" | "github.com/gorilla/mux" | ||||
"github.com/imosed/signet/data" | "github.com/imosed/signet/data" | ||||
"github.com/imosed/signet/endpoints" | "github.com/imosed/signet/endpoints" | ||||
"github.com/spf13/viper" | "github.com/spf13/viper" | ||||
"net/http" | |||||
) | ) | ||||
var err error | var err error | ||||
@@ -36,7 +37,7 @@ func main() { | |||||
router.HandleFunc("/GetQueueMembers", endpoints.GetQueueMembers) | router.HandleFunc("/GetQueueMembers", endpoints.GetQueueMembers) | ||||
router.HandleFunc("/CreateRewardFund", endpoints.CreateRewardFund) | router.HandleFunc("/CreateRewardFund", endpoints.CreateRewardFund) | ||||
router.HandleFunc("/CloseRewardFund", endpoints.CloseRewardFund) | router.HandleFunc("/CloseRewardFund", endpoints.CloseRewardFund) | ||||
//router.HandleFunc("/SubmitFund", endpoints.SubmitFund) | |||||
// router.HandleFunc("/SubmitFund", endpoints.SubmitFund) | |||||
router.HandleFunc("/GetBalance", endpoints.GetBalance) | router.HandleFunc("/GetBalance", endpoints.GetBalance) | ||||
router.HandleFunc("/Contribute", endpoints.Contribute) | router.HandleFunc("/Contribute", endpoints.Contribute) | ||||
router.HandleFunc("/ContributorStream", endpoints.ContributorStream) | router.HandleFunc("/ContributorStream", endpoints.ContributorStream) | ||||