client: Use types 2.0.0
This commit is contained in:
parent
6d78e16b23
commit
0c06145d67
@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/decred/dcrd/txscript/v4/stdaddr"
|
"github.com/decred/dcrd/txscript/v4/stdaddr"
|
||||||
"github.com/decred/slog"
|
"github.com/decred/slog"
|
||||||
"github.com/decred/vspd/types"
|
"github.com/decred/vspd/types/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/decred/slog"
|
"github.com/decred/slog"
|
||||||
"github.com/decred/vspd/types"
|
"github.com/decred/vspd/types/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestErrorDetails ensures errors returned by client.do contain adequate
|
// TestErrorDetails ensures errors returned by client.do contain adequate
|
||||||
@ -22,21 +22,28 @@ func TestErrorDetails(t *testing.T) {
|
|||||||
respBodyBytes []byte
|
respBodyBytes []byte
|
||||||
expectedErr string
|
expectedErr string
|
||||||
vspdError bool
|
vspdError bool
|
||||||
vspdErrCode int64
|
vspdErrCode types.ErrorCode
|
||||||
}{
|
}{
|
||||||
"500, vspd error (generic bad request)": {
|
"500, vspd error (generic bad request)": {
|
||||||
respHTTPStatus: 500,
|
respHTTPStatus: 500,
|
||||||
respBodyBytes: []byte(`{"code": 1, "message": "bad request"}`),
|
respBodyBytes: []byte(`{"code": 0, "message": "bad request"}`),
|
||||||
expectedErr: `bad request`,
|
expectedErr: `bad request`,
|
||||||
vspdError: true,
|
vspdError: true,
|
||||||
vspdErrCode: 1,
|
vspdErrCode: types.ErrBadRequest,
|
||||||
|
},
|
||||||
|
"500, vspd error (generic internal error)": {
|
||||||
|
respHTTPStatus: 500,
|
||||||
|
respBodyBytes: []byte(`{"code": 1, "message": "something terrible happened"}`),
|
||||||
|
expectedErr: `something terrible happened`,
|
||||||
|
vspdError: true,
|
||||||
|
vspdErrCode: types.ErrInternalError,
|
||||||
},
|
},
|
||||||
"428, vspd error (cannot broadcast fee)": {
|
"428, vspd error (cannot broadcast fee)": {
|
||||||
respHTTPStatus: 428,
|
respHTTPStatus: 428,
|
||||||
respBodyBytes: []byte(`{"code": 16, "message": "fee transaction could not be broadcast due to unknown outputs"}`),
|
respBodyBytes: []byte(`{"code": 16, "message": "fee transaction could not be broadcast due to unknown outputs"}`),
|
||||||
expectedErr: `fee transaction could not be broadcast due to unknown outputs`,
|
expectedErr: `fee transaction could not be broadcast due to unknown outputs`,
|
||||||
vspdError: true,
|
vspdError: true,
|
||||||
vspdErrCode: 16,
|
vspdErrCode: types.ErrCannotBroadcastFeeUnknownOutputs,
|
||||||
},
|
},
|
||||||
"500, no body": {
|
"500, no body": {
|
||||||
respHTTPStatus: 500,
|
respHTTPStatus: 500,
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
module github.com/decred/vspd/client
|
module github.com/decred/vspd/client/v2
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/decred/dcrd/txscript/v4 v4.0.0
|
github.com/decred/dcrd/txscript/v4 v4.0.0
|
||||||
github.com/decred/slog v1.2.0
|
github.com/decred/slog v1.2.0
|
||||||
github.com/decred/vspd/types v1.1.0
|
github.com/decred/vspd/types/v2 v2.0.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|||||||
@ -27,5 +27,5 @@ github.com/decred/dcrd/wire v1.5.0 h1:3SgcEzSjqAMQvOugP0a8iX7yQSpiVT1yNi9bc4iOXV
|
|||||||
github.com/decred/dcrd/wire v1.5.0/go.mod h1:fzAjVqw32LkbAZIt5mnrvBR751GTa3e0rRQdOIhPY3w=
|
github.com/decred/dcrd/wire v1.5.0/go.mod h1:fzAjVqw32LkbAZIt5mnrvBR751GTa3e0rRQdOIhPY3w=
|
||||||
github.com/decred/slog v1.2.0 h1:soHAxV52B54Di3WtKLfPum9OFfWqwtf/ygf9njdfnPM=
|
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/slog v1.2.0/go.mod h1:kVXlGnt6DHy2fV5OjSeuvCJ0OmlmTF6LFpEPMu/fOY0=
|
||||||
github.com/decred/vspd/types v1.1.0 h1:hTeqQwgRUN2FGIbuCIdyzBejKV+jxKrmEIcLKxpsB1g=
|
github.com/decred/vspd/types/v2 v2.0.0 h1:FaPA+W4OOMRWK+Vk4fyyYdXoVLRMMRQsxzsnSjJjOnI=
|
||||||
github.com/decred/vspd/types v1.1.0/go.mod h1:THsO8aBSwWBq6ZsIG25cNqbkNb+EEASXzLhFvODVc0s=
|
github.com/decred/vspd/types/v2 v2.0.0/go.mod h1:2xnNqedkt9GuL+pK8uIzDxqYxFlwLRflYFJH64b76n0=
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user