From f46b1a08eebb92fcd0b188cd0dc19368dd351d5a Mon Sep 17 00:00:00 2001 From: zhaoweijie Date: Thu, 5 Dec 2024 17:50:39 +0800 Subject: [PATCH] feat: change ClientResponse.result struct --- client/client_test.go | 4 ++-- client/dto.go | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/client/client_test.go b/client/client_test.go index 0d2f17d..e316795 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -19,7 +19,7 @@ func TestStruct(t *testing.T) { } func genClient() (*Client, error) { - url := "https://cpnode.demo.internetapi.cn/api/ctrlproxy/SCIDE" + url := "http://021.node.internetapi.cn:43030/SCIDE" pub, err := sm2util.ParsePublicKey("04153ad2d70e67741e0fc33e0c92c702e2afba2480dbea73d23fd02a3ce3a1b69979a7006a8e045f8836ae4797a8fe426823d7ad3450817e794948c8e47b60b711") if err != nil { @@ -86,7 +86,7 @@ func TestClient_ExecuteContract(t *testing.T) { t.Error(err) } - resp, err := client.ExecuteContract("ShanxiControlProxy", "listRepository", "", false, true) + resp, err := client.ExecuteContract("GlobalRouter", "resolveDoIdTest", "{\"doId\":\"bdtest021/ControlProxy\"}", false, true) if err != nil { t.Log(resp) diff --git a/client/dto.go b/client/dto.go index 6a1693b..28416c9 100644 --- a/client/dto.go +++ b/client/dto.go @@ -8,14 +8,10 @@ type HttpResponse[D any] struct { // ClientResponse represents a generic response structure type ClientResponse[T any] struct { - NeedSeq bool `json:"needSeq,omitempty"` - Seq int `json:"seq,omitempty"` - Status string `json:"status,omitempty"` - Result struct { - Data T `json:"data,omitempty"` - Count int `json:"count,omitempty"` - Code int `json:"code,omitempty"` - } `json:"result,omitempty"` + NeedSeq bool `json:"needSeq,omitempty"` + Seq int `json:"seq,omitempty"` + Status string `json:"status,omitempty"` + Result any `json:"result,omitempty"` IsInsnLimit bool `json:"isInsnLimit,omitempty"` TotalGas int `json:"totalGas,omitempty"` ExecutionGas int `json:"executionGas,omitempty"`