From 2115fc972e81338e6373db754afb66ce8c653645 Mon Sep 17 00:00:00 2001
From: yarex-4chain <jaroslaw.gudz@4chain.studio>
Date: Tue, 30 Jul 2024 08:12:46 +0200
Subject: [PATCH] feat(SPV-904) update routes

---
 access_keys_test.go                            |  4 ++--
 client_options.go                              |  2 +-
 examples/access_key/access_key.go              |  2 +-
 .../get_shared_config/get_shared_config.go     |  2 +-
 examples/go.mod                                |  2 +-
 examples/go.sum                                | 18 ++++--------------
 .../update_xpub_metadata.go                    |  2 +-
 xpubs_test.go                                  |  2 +-
 8 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/access_keys_test.go b/access_keys_test.go
index a1fa548..baca93b 100644
--- a/access_keys_test.go
+++ b/access_keys_test.go
@@ -17,12 +17,12 @@ import (
 func TestAccessKeys(t *testing.T) {
 	server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 		switch r.URL.Path {
-		case "/v1/users/current/keys/" + fixtures.AccessKey.ID:
+		case "/api/v1/users/current/keys/" + fixtures.AccessKey.ID:
 			switch r.Method {
 			case http.MethodGet, http.MethodDelete:
 				json.NewEncoder(w).Encode(fixtures.AccessKey)
 			}
-		case "/v1/users/current/keys":
+		case "/api/v1/users/current/keys":
 			switch r.Method {
 			case http.MethodGet, http.MethodPost, http.MethodDelete:
 				json.NewEncoder(w).Encode(fixtures.AccessKey)
diff --git a/client_options.go b/client_options.go
index a5d06fa..163c4cb 100644
--- a/client_options.go
+++ b/client_options.go
@@ -81,7 +81,7 @@ func (w *httpConf) Configure(c *WalletClient) {
 		return
 	}
 
-	const basePath = "/v1"
+	const basePath = "/api/v1"
 	c.server = fmt.Sprintf("%s%s", baseURL, basePath)
 
 	c.httpClient = w.HTTPClient
diff --git a/examples/access_key/access_key.go b/examples/access_key/access_key.go
index 622ec55..4886200 100644
--- a/examples/access_key/access_key.go
+++ b/examples/access_key/access_key.go
@@ -17,7 +17,7 @@ func main() {
 
 	examples.CheckIfXPrivExists()
 
-	const server = "http://localhost:3003/v1"
+	const server = "http://localhost:3003/api/v1"
 
 	client := walletclient.NewWithXPriv(server, examples.ExampleXPriv)
 	ctx := context.Background()
diff --git a/examples/get_shared_config/get_shared_config.go b/examples/get_shared_config/get_shared_config.go
index 7f834c3..796363f 100644
--- a/examples/get_shared_config/get_shared_config.go
+++ b/examples/get_shared_config/get_shared_config.go
@@ -17,7 +17,7 @@ func main() {
 
 	examples.CheckIfXPrivExists()
 
-	const server = "http://localhost:3003/v1"
+	const server = "http://localhost:3003/api/v1"
 
 	client := walletclient.NewWithXPriv(server, examples.ExampleXPriv)
 	ctx := context.Background()
diff --git a/examples/go.mod b/examples/go.mod
index cd17a33..178451d 100644
--- a/examples/go.mod
+++ b/examples/go.mod
@@ -6,7 +6,7 @@ replace github.com/bitcoin-sv/spv-wallet-go-client => ../
 
 require (
 	github.com/bitcoin-sv/spv-wallet-go-client v0.0.0-00010101000000-000000000000
-	github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.16
+	github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.17
 )
 
 require (
diff --git a/examples/go.sum b/examples/go.sum
index 14202d0..637ee33 100644
--- a/examples/go.sum
+++ b/examples/go.sum
@@ -1,20 +1,11 @@
-github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.13 h1:rBscs3Gbz0RWY03eI3Z9AwD7/MxajdJF54oy3xMqKRQ=
-github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.13/go.mod h1:i3txysriHpprqYd3u97wEQsC4/jn+KHcyFOmuFYMw8M=
-github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.14.0.20240626082725-2c073c5330a6 h1:ZTEHuSNbXszs+5TKN0uiW6DY7JdWIM5m6NQpBJZyre4=
-github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.14.0.20240626082725-2c073c5330a6/go.mod h1:u3gnRDS3uHWZNM2qbYATTpN+mAphyozCJrYIKGwBX7k=
-github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.15 h1:Qjp9gSe1XlBwADgDlkaIGuzqNoQwktu1DuB6tzurdQI=
-github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.15/go.mod h1:Ni6SFkmMjV39Bg4FtlgPAsnsiJUfRDVEPlbzTZa8z40=
-github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.15.0.20240704130751-f3156fd52a0e h1:Bw8bq7YUvMSNwRNQUm8gFKakICyNk8ScBqhJ9LFr54o=
-github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.15.0.20240704130751-f3156fd52a0e/go.mod h1:Ni6SFkmMjV39Bg4FtlgPAsnsiJUfRDVEPlbzTZa8z40=
-github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.16 h1:iHLUofGb40sQ31KpVwtdjuKVs3W/vW1w8exF8Vidvfc=
-github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.16/go.mod h1:Ni6SFkmMjV39Bg4FtlgPAsnsiJUfRDVEPlbzTZa8z40=
+github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.17 h1:WPCOogz2nQhSxOf8PvDqCU2QzWo4jvw31dmmOAz5MQE=
+github.com/bitcoin-sv/spv-wallet/models v1.0.0-beta.17/go.mod h1:DEeKPtcJqjuXIi8qQSHNSS1/t2tEMskJnnWvdlybzmA=
 github.com/bitcoinschema/go-bitcoin/v2 v2.0.5 h1:Sgh5Eb746Zck/46rFDrZZEXZWyO53fMuWYhNoZa1tck=
 github.com/bitcoinschema/go-bitcoin/v2 v2.0.5/go.mod h1:JjO1ivfZv6vhK0uAXzyH08AAHlzNMAfnyK1Fiv9r4ZA=
 github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173 h1:2yTIV9u7H0BhRDGXH5xrAwAz7XibWJtX2dNezMeNsUo=
 github.com/bitcoinsv/bsvd v0.0.0-20190609155523-4c29707f7173/go.mod h1:BZ1UcC9+tmcDEcdVXgpt13hMczwJxWzpAn68wNs7zRA=
 github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
-github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyXcs=
-github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
+github.com/boombuler/barcode v1.0.2 h1:79yrbttoZrLGkL/oOI8hBrUKucwOL0oOjUgEguGMcJ4=
 github.com/boombuler/barcode v1.0.2/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -33,8 +24,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
 github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
 github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
-golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
-golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
+golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
 golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
 gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
 gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/examples/update_xpub_metadata/update_xpub_metadata.go b/examples/update_xpub_metadata/update_xpub_metadata.go
index 529cea2..fefd076 100644
--- a/examples/update_xpub_metadata/update_xpub_metadata.go
+++ b/examples/update_xpub_metadata/update_xpub_metadata.go
@@ -17,7 +17,7 @@ func main() {
 
 	examples.CheckIfXPrivExists()
 
-	const server = "http://localhost:3003/v1"
+	const server = "http://localhost:3003/api/v1"
 
 	client := walletclient.NewWithXPriv(server, examples.ExampleXPriv)
 	ctx := context.Background()
diff --git a/xpubs_test.go b/xpubs_test.go
index 5100239..8319e0a 100644
--- a/xpubs_test.go
+++ b/xpubs_test.go
@@ -24,7 +24,7 @@ func TestXpub(t *testing.T) {
 		var response xpub
 		// Check path and method to customize the response
 		switch {
-		case r.URL.Path == "/v1/users/current":
+		case r.URL.Path == "/api/v1/users/current":
 			metadata := &models.Metadata{"key": "value"}
 			if update {
 				metadata = &models.Metadata{"updated": "info"}