feat(sdk-go): add contract sdk
This commit is contained in:
@@ -1,13 +1,35 @@
|
||||
package client
|
||||
|
||||
type HttpResponse[D any] struct {
|
||||
Data D `json:"data"`
|
||||
ErrData string `json:"errData"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
// ClientResponse represents a generic response structure
|
||||
type ClientResponse[T any] struct {
|
||||
Data *T `json:"data,omitempty"`
|
||||
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"`
|
||||
IsInsnLimit bool `json:"isInsnLimit,omitempty"`
|
||||
TotalGas int `json:"totalGas,omitempty"`
|
||||
ExecutionGas int `json:"executionGas,omitempty"`
|
||||
ExtraGas int `json:"extraGas,omitempty"`
|
||||
Size int `json:"size,omitempty"`
|
||||
EventRelated bool `json:"eventRelated,omitempty"`
|
||||
ResponseID string `json:"responseID,omitempty"`
|
||||
Action string `json:"action,omitempty"`
|
||||
ExecuteTime string `json:"executeTime,omitempty"`
|
||||
}
|
||||
|
||||
// PingResponse is a specific response type for ping operations
|
||||
type PingResponse struct {
|
||||
ClientResponse[string] // will contain "pong"
|
||||
Action string `json:"action"`
|
||||
}
|
||||
|
||||
// SaveFileRequest represents the request structure for saving files
|
||||
@@ -85,21 +107,9 @@ type DistributeContractResponse struct {
|
||||
Progress string `json:"progress"`
|
||||
}
|
||||
|
||||
// ExecuteContractArgs represents arguments for contract execution
|
||||
type ExecuteContractArgs struct {
|
||||
Method string `json:"method,omitempty"`
|
||||
WithSignature bool `json:"withSignature,omitempty"`
|
||||
WithDynamicAnalysis bool `json:"withDynamicAnalysis,omitempty"`
|
||||
}
|
||||
|
||||
// ExecuteContractResponse represents the response from contract execution
|
||||
type ExecuteContractResponse[T any] struct {
|
||||
Status *bool `json:"status,omitempty"`
|
||||
Data *T `json:"data,omitempty"`
|
||||
ExecuteTime *float64 `json:"executeTime,omitempty"`
|
||||
CID *string `json:"cid,omitempty"`
|
||||
IsPrivate *bool `json:"isPrivate,omitempty"`
|
||||
AdditionalData map[string]interface{} `json:"-"`
|
||||
ClientResponse[T]
|
||||
}
|
||||
|
||||
// ConfigNodeArgs represents configuration arguments for a node
|
||||
|
||||
Reference in New Issue
Block a user