From 6b99c5d2b57f19510513dd567387da7e984ddaaf Mon Sep 17 00:00:00 2001 From: Jamie Holdstock Date: Wed, 12 Apr 2023 14:12:53 +0100 Subject: [PATCH] webapi: Use types 2.0.0 (#376) * webapi: Use types 2.0.0 * v3tool: Use types 2.0.0 --- cmd/v3tool/main.go | 4 ++-- go.mod | 4 ++-- go.sum | 8 ++++---- webapi/getfeeaddress.go | 2 +- webapi/middleware.go | 2 +- webapi/payfee.go | 2 +- webapi/setaltsignaddr.go | 2 +- webapi/setaltsignaddr_test.go | 4 ++-- webapi/setvotechoices.go | 2 +- webapi/ticketstatus.go | 2 +- webapi/vspinfo.go | 2 +- webapi/webapi.go | 4 ++-- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cmd/v3tool/main.go b/cmd/v3tool/main.go index eca7924..06f5104 100644 --- a/cmd/v3tool/main.go +++ b/cmd/v3tool/main.go @@ -9,8 +9,8 @@ import ( "time" "github.com/decred/slog" - "github.com/decred/vspd/client" - "github.com/decred/vspd/types" + "github.com/decred/vspd/client/v2" + "github.com/decred/vspd/types/v2" ) const ( diff --git a/go.mod b/go.mod index 77e19df..36efdc3 100644 --- a/go.mod +++ b/go.mod @@ -15,8 +15,8 @@ require ( github.com/decred/dcrd/txscript/v4 v4.0.0 github.com/decred/dcrd/wire v1.5.0 github.com/decred/slog v1.2.0 - github.com/decred/vspd/client v1.1.0 - github.com/decred/vspd/types v1.1.0 + github.com/decred/vspd/client/v2 v2.0.0 + github.com/decred/vspd/types/v2 v2.0.0 github.com/dustin/go-humanize v1.0.1 github.com/gin-gonic/gin v1.8.2 github.com/gorilla/sessions v1.2.1 diff --git a/go.sum b/go.sum index c3f4209..30af722 100644 --- a/go.sum +++ b/go.sum @@ -69,10 +69,10 @@ github.com/decred/dcrd/wire v1.5.0/go.mod h1:fzAjVqw32LkbAZIt5mnrvBR751GTa3e0rRQ github.com/decred/go-socks v1.1.0/go.mod h1:sDhHqkZH0X4JjSa02oYOGhcGHYp12FsY1jQ/meV8md0= github.com/decred/slog v1.2.0 h1:soHAxV52B54Di3WtKLfPum9OFfWqwtf/ygf9njdfnPM= github.com/decred/slog v1.2.0/go.mod h1:kVXlGnt6DHy2fV5OjSeuvCJ0OmlmTF6LFpEPMu/fOY0= -github.com/decred/vspd/client v1.1.0 h1:vyMjbT9jGuH96yNsv2msx5E/DP7xk3ePIU7XWhu1Des= -github.com/decred/vspd/client v1.1.0/go.mod h1:+gn860mKciikYxQrPm+hSVMEG8CQ7EWf/vN9pZa3Baw= -github.com/decred/vspd/types v1.1.0 h1:hTeqQwgRUN2FGIbuCIdyzBejKV+jxKrmEIcLKxpsB1g= -github.com/decred/vspd/types v1.1.0/go.mod h1:THsO8aBSwWBq6ZsIG25cNqbkNb+EEASXzLhFvODVc0s= +github.com/decred/vspd/client/v2 v2.0.0 h1:gaSF1Bm2/EvoAiSLxNR5fgStrObAO66xmanhedidYIM= +github.com/decred/vspd/client/v2 v2.0.0/go.mod h1:IDDviEe/6CuxxrW0PLOcg448enU3YmeElFHledYHw78= +github.com/decred/vspd/types/v2 v2.0.0 h1:FaPA+W4OOMRWK+Vk4fyyYdXoVLRMMRQsxzsnSjJjOnI= +github.com/decred/vspd/types/v2 v2.0.0/go.mod h1:2xnNqedkt9GuL+pK8uIzDxqYxFlwLRflYFJH64b76n0= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= diff --git a/webapi/getfeeaddress.go b/webapi/getfeeaddress.go index 9d04977..a4a35b9 100644 --- a/webapi/getfeeaddress.go +++ b/webapi/getfeeaddress.go @@ -12,7 +12,7 @@ import ( "github.com/decred/dcrd/dcrutil/v4" "github.com/decred/vspd/database" "github.com/decred/vspd/rpc" - "github.com/decred/vspd/types" + "github.com/decred/vspd/types/v2" "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" ) diff --git a/webapi/middleware.go b/webapi/middleware.go index 48362d6..2613402 100644 --- a/webapi/middleware.go +++ b/webapi/middleware.go @@ -15,7 +15,7 @@ import ( "github.com/decred/dcrd/blockchain/stake/v4" "github.com/decred/vspd/rpc" - "github.com/decred/vspd/types" + "github.com/decred/vspd/types/v2" "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" "github.com/gorilla/sessions" diff --git a/webapi/payfee.go b/webapi/payfee.go index 096e2bf..55e34a5 100644 --- a/webapi/payfee.go +++ b/webapi/payfee.go @@ -15,7 +15,7 @@ import ( "github.com/decred/dcrd/txscript/v4/stdaddr" "github.com/decred/vspd/database" "github.com/decred/vspd/rpc" - "github.com/decred/vspd/types" + "github.com/decred/vspd/types/v2" "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" ) diff --git a/webapi/setaltsignaddr.go b/webapi/setaltsignaddr.go index 5aaef59..dae7154 100644 --- a/webapi/setaltsignaddr.go +++ b/webapi/setaltsignaddr.go @@ -11,7 +11,7 @@ import ( "github.com/decred/dcrd/txscript/v4/stdaddr" "github.com/decred/vspd/database" "github.com/decred/vspd/rpc" - "github.com/decred/vspd/types" + "github.com/decred/vspd/types/v2" "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" ) diff --git a/webapi/setaltsignaddr_test.go b/webapi/setaltsignaddr_test.go index b57b6b7..0329d84 100644 --- a/webapi/setaltsignaddr_test.go +++ b/webapi/setaltsignaddr_test.go @@ -22,7 +22,7 @@ import ( dcrdtypes "github.com/decred/dcrd/rpc/jsonrpc/types/v3" "github.com/decred/slog" "github.com/decred/vspd/database" - "github.com/decred/vspd/types" + "github.com/decred/vspd/types/v2" "github.com/gin-gonic/gin" ) @@ -294,7 +294,7 @@ func TestSetAltSignAddress(t *testing.T) { t.Fatalf("could not unmarshal error response: %v", err) } - if int64(test.wantErrCode) != apiError.Code { + if test.wantErrCode != apiError.Code { t.Fatalf("incorrect error code, expected %d, actual %d", test.wantErrCode, apiError.Code) } diff --git a/webapi/setvotechoices.go b/webapi/setvotechoices.go index 59f722e..ec8cc26 100644 --- a/webapi/setvotechoices.go +++ b/webapi/setvotechoices.go @@ -11,7 +11,7 @@ import ( "github.com/decred/vspd/database" "github.com/decred/vspd/rpc" - "github.com/decred/vspd/types" + "github.com/decred/vspd/types/v2" "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" ) diff --git a/webapi/ticketstatus.go b/webapi/ticketstatus.go index a8263c8..ed35da2 100644 --- a/webapi/ticketstatus.go +++ b/webapi/ticketstatus.go @@ -8,7 +8,7 @@ import ( "time" "github.com/decred/vspd/database" - "github.com/decred/vspd/types" + "github.com/decred/vspd/types/v2" "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" ) diff --git a/webapi/vspinfo.go b/webapi/vspinfo.go index 0fc3288..a8f876f 100644 --- a/webapi/vspinfo.go +++ b/webapi/vspinfo.go @@ -7,7 +7,7 @@ package webapi import ( "time" - "github.com/decred/vspd/types" + "github.com/decred/vspd/types/v2" "github.com/decred/vspd/version" "github.com/gin-gonic/gin" ) diff --git a/webapi/webapi.go b/webapi/webapi.go index d1aaf44..4c86332 100644 --- a/webapi/webapi.go +++ b/webapi/webapi.go @@ -21,7 +21,7 @@ import ( "github.com/decred/slog" "github.com/decred/vspd/database" "github.com/decred/vspd/rpc" - "github.com/decred/vspd/types" + "github.com/decred/vspd/types/v2" "github.com/dustin/go-humanize" "github.com/gin-gonic/gin" "github.com/gorilla/sessions" @@ -313,7 +313,7 @@ func (s *Server) sendErrorWithMsg(msg string, e types.ErrorCode, c *gin.Context) status := e.HTTPStatus() resp := types.ErrorResponse{ - Code: int64(e), + Code: e, Message: msg, }